private void ListenSocket_OnClientDisconnect(object sender, SocketEventArgs e) { Application.Current.Dispatcher.Invoke((Action)(() => { ChatListView.Items.Add(string.Format("Client disconnected! {0}", sender)); })); }
private void SNetClient_OnDisconnect(object o, SocketEventArgs e) { Application.SynchronizationContext.Post((c) => { _adapter.Add("Disconnected from server!"); _adapter.NotifyDataSetChanged(); }, this); }
private void SNetClient_OnRecieve(object o, SocketEventArgs e) { Application.SynchronizationContext.Post((c) => { switch (e.Message.Type) { case MessageType.TextMessage: _adapter.Add(String.Format("{0}", e.Message.Body)); _adapter.NotifyDataSetChanged(); break; default: break; } }, this); }
private void ListenSocket_OnRecieve(object sender, SocketEventArgs e) { TextMessage inMessage = (TextMessage)e.Message; Application.Current.Dispatcher.Invoke(() => { switch (e.Message.Type) { case MessageType.TextMessage: ChatListView.Items.Add(string.Format("{0}", (e.Message as TextMessage).Text)); break; default: break; } (sender as SNetServer).SendToAllClients(e.Message.Buffer); }); }
private void SNetClient_OnRecieve(object sender, SocketEventArgs e) { switch (e.Message.Type) { case MessageType.TextMessage: LogMessage("{0}", TextMessage.FromMessageBase(e.Message).Text); break; default: break; } }
private void SNetClient_OnDisconnect(object sender, SocketEventArgs e) { // TODO: Сами становимся сервером, или ищем новый ? LogMessage("Server shuted down"); _sNetClient = null; }
private void SNetClient_OnConnect(object sender, SocketEventArgs e) { LogMessage("Connected to server {0}!", _serverHostName); }
private void ListenSocket_OnRecieve(object sender, SocketEventArgs e) { switch (e.Message.Type) { case MessageType.TextMessage: LogMessage("{0}", TextMessage.FromMessageBase(e.Message).Text); break; default: break; } (sender as SNetServer).SendToAllClients(e.Message.Buffer); }
private void ListenSocket_OnClientDisconnect(object sender, SocketEventArgs e) { LogMessage("Client disconnected!"); }