Mercurial > silverbladetech
comparison 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 |
comparison
equal
deleted
inserted
replaced
25:81f9b72a44ce | 26:045dac571339 |
---|---|
1 using System.Windows.Input; | |
2 using Common; | |
3 using Common.Logger; | |
4 using GalaSoft.MvvmLight; | |
5 using GalaSoft.MvvmLight.Command; | |
6 using System.Windows; | |
7 using Server.Interfaces; | |
8 using Server.Sockets; | |
9 | |
10 namespace Server.UI | |
11 { | |
12 public class MainWindowViewModel : ViewModelBase | |
13 { | |
14 #region Properties | |
15 | |
16 #region OverrideSwitch | |
17 | |
18 public const string OverrideSwitchPropertyName = "OverrideSwitch"; | |
19 private bool? _overrideSwitch = false; | |
20 public bool? OverrideSwitch | |
21 { | |
22 get { return _overrideSwitch; } | |
23 set | |
24 { | |
25 if (_overrideSwitch == value) return; | |
26 var oldValue = _overrideSwitch; | |
27 _overrideSwitch = value; | |
28 RaisePropertyChanged(() => OverrideSwitch, oldValue, value, false); | |
29 } | |
30 } | |
31 | |
32 #endregion | |
33 | |
34 #endregion | |
35 | |
36 | |
37 #region DisplayText | |
38 | |
39 public const string DisplayTextPropertyName = "DisplayText"; | |
40 private string _displayText; | |
41 public string DisplayText | |
42 { | |
43 get { return _displayText; } | |
44 set | |
45 { | |
46 if (_displayText == value) return; | |
47 _displayText = value; | |
48 RaisePropertyChanged(() => DisplayText); | |
49 } | |
50 } | |
51 | |
52 #endregion | |
53 | |
54 public ICommand CloseCommand { get; set; } | |
55 | |
56 public MessagingEndPoint SocketEndPoint { get; set; } | |
57 public MessagingEndPoint RabbitEndPoint { get; set; } | |
58 public MessagingEndPoint RabbitProtoEndPoint { get; set; } | |
59 | |
60 #region Constructor | |
61 | |
62 public MainWindowViewModel() | |
63 { | |
64 IListener listener = new AsyncSocketListener(Settings.SocketsPortNumber); | |
65 SocketEndPoint = new MessagingEndPoint(listener) | |
66 { | |
67 DisplayText = "Async Sockets", | |
68 ToolTip = "Listening over TCP/IP on localhost:" + Settings.SocketsPortNumber, | |
69 DisplayCount = 9, | |
70 DisplayLog = "test for display log" | |
71 }; | |
72 | |
73 DisplayText = "Does this work?!"; | |
74 | |
75 CloseCommand = new RelayCommand(CloseCommandExecute); | |
76 } | |
77 | |
78 private void CloseCommandExecute() | |
79 { | |
80 Log.Write("Closing command executed"); | |
81 Application.Current.Shutdown(); | |
82 } | |
83 | |
84 #endregion | |
85 } | |
86 } |