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()); } }