private void Window_Loaded(object sender, RoutedEventArgs e) { windowChat = (WindowChat)this.Owner; mainWindow = (MainWindow)this.Owner.Owner; currentConversation = windowChat.currentConversations.Last().Key; this.Title += currentConversation; }
private void buttonSignIn_Click(object sender, RoutedEventArgs e) { try { if (this.Connect() == false) { throw new ConnectingException(); } if (proxy.SignIn(textBoxUsername.Text, textBoxPassword.Text) == false) { throw new UsernamePasswordMismatchException(); } username = textBoxUsername.Text; var windowChat = new WindowChat(); windowChat.Owner = this; windowChat.Show(); this.Hide(); } catch (ConnectingException) { } catch (UsernamePasswordMismatchException) { MessageBox.Show("Username and password mismatch or the contact doesn't exist or you have already entered", "Error!"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!"); } }