private void SendMessageButton_Click(object sender, EventArgs e) { if (SendMessageTextField.Text != "") { Client.SendMessageToServer(Client.current.id, 0, Client.current.username + ": " + SendMessageTextField.Text); SendMessageTextField.Text = null; MainChatWindow.SelectedIndex = (MainChatWindow.Items.Count - 1); MainChatWindow.ClearSelected(); } }
private async void Btn_Registration_Click(object sender, RoutedEventArgs e) { try { WebserviceAPI.Registrate(FirstNameInput.Text, LastNameInput.Text, UsernameInput.Text, PasswordInput.Password, StatusMessageInput.Text); await this.Dispatcher.Invoke(async() => { MainChatWindow mainChatWindow = new MainChatWindow(); mainChatWindow.Show(); this.Close(); }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private async void Btn_Login_Click(object sender, RoutedEventArgs e) { try { await WebserviceAPI.LoginAsync(UserNameInput.Text, PasswordInput.Password); await this.Dispatcher.Invoke(async() => { MainChatWindow mainChatWindow = new MainChatWindow(); mainChatWindow.Show(); this.Close(); }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void CreateMainChatWindow() { m_MainChatWindow = new MainChatWindow(); m_MainChatWindow.SendMessage += new EventHandler<GenericEventArgs<string>>(mcw_SendMessage); TabItem ti = new TabItem(); ti.Header = "Main Chanel"; ti.Content = m_MainChatWindow; tabChatWindows.Items.Add(ti); tabChatWindows.SelectedItem = ti; }