private void btnSendPrivate_Click(object sender, RoutedEventArgs e) { User userTo = (User)lstClients.SelectedItem; if (userTo != null) { Message msg = new Message(); msg.From = user; msg.To = userTo; if (ErrorControls.NotEmptyTextBox(tbMsg)) { msg.Msg = tbMsg.Text; AddTextToResult(user.Name + ": " + tbMsg.Text); try { parent.Proxy.SendPrivateMessage(msg); } catch (Exception ex) { MessageBox.Show(ex.Message); } tbMsg.Text = ""; } } else { MessageBox.Show("Выберите пользователя"); } }
private void Button_Click(object sender, RoutedEventArgs e) { bool check = ErrorControls.NotEmptyTextBox(tbName); if (check) { ReplyNewUser newUser = null; try { // connect to the server ... handler = new CallbackHandler(); site = new InstanceContext(handler); proxy = new ConnectionClient(site); // logging newUser = proxy.Join(tbName.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (newUser != null) { ClientWindow client = new ClientWindow(newUser); client.Owner = this; client.Show(); this.Hide(); } } }
private void btnSendAll_Click(object sender, RoutedEventArgs e) { if (ErrorControls.NotEmptyTextBox(tbMsg)) { try { parent.Proxy.SendMessageToAll(user.Name + ": " + tbMsg.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } tbMsg.Text = ""; } }