Mercurial > silverbladetech
diff Messaging/Server/UI/MainWindowViewModel.cs @ 26:045dac571339
Working on data binding to a user control
author | adminsh@apollo |
---|---|
date | Wed, 21 Mar 2012 15:39:53 +0000 |
parents | |
children | 96fdf58e05b4 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Messaging/Server/UI/MainWindowViewModel.cs Wed Mar 21 15:39:53 2012 +0000 @@ -0,0 +1,86 @@ +using System.Windows.Input; +using Common; +using Common.Logger; +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using System.Windows; +using Server.Interfaces; +using Server.Sockets; + +namespace Server.UI +{ + public class MainWindowViewModel : ViewModelBase + { + #region Properties + + #region OverrideSwitch + + public const string OverrideSwitchPropertyName = "OverrideSwitch"; + private bool? _overrideSwitch = false; + public bool? OverrideSwitch + { + get { return _overrideSwitch; } + set + { + if (_overrideSwitch == value) return; + var oldValue = _overrideSwitch; + _overrideSwitch = value; + RaisePropertyChanged(() => OverrideSwitch, oldValue, value, false); + } + } + + #endregion + + #endregion + + + #region DisplayText + + public const string DisplayTextPropertyName = "DisplayText"; + private string _displayText; + public string DisplayText + { + get { return _displayText; } + set + { + if (_displayText == value) return; + _displayText = value; + RaisePropertyChanged(() => DisplayText); + } + } + + #endregion + + public ICommand CloseCommand { get; set; } + + public MessagingEndPoint SocketEndPoint { get; set; } + public MessagingEndPoint RabbitEndPoint { get; set; } + public MessagingEndPoint RabbitProtoEndPoint { get; set; } + + #region Constructor + + public MainWindowViewModel() + { + IListener listener = new AsyncSocketListener(Settings.SocketsPortNumber); + SocketEndPoint = new MessagingEndPoint(listener) + { + DisplayText = "Async Sockets", + ToolTip = "Listening over TCP/IP on localhost:" + Settings.SocketsPortNumber, + DisplayCount = 9, + DisplayLog = "test for display log" + }; + + DisplayText = "Does this work?!"; + + CloseCommand = new RelayCommand(CloseCommandExecute); + } + + private void CloseCommandExecute() + { + Log.Write("Closing command executed"); + Application.Current.Shutdown(); + } + + #endregion + } +}