public MessengerViewModel() { Thread.CurrentThread.Name = "UI Thread"; _server = null; _client = null; _isConnected = false; _address = "127.0.0.1"; _message = string.Empty; StatusMessages = new ObservableCollection<string>(); }
private void ExecuteConnect() { if (_isServer) { IsConnected = true; _server = new MsgServer(); _server.ClientConnected += _server_ClientConnected; _server.MessageReceived += _server_MessageReceived; _server.ConnectionClosed += _server_ConnectionClosed; _server.Start(10000); } else { _client = new MsgClient(); _client.Connect(_address); } }