private void buttonRegister_Click(object sender, RoutedEventArgs e) { try { if (this.Connect() == false) { throw new ConnectingException(); } var windowCreateAccount = new WindowCreateAccount(); windowCreateAccount.Owner = this; windowCreateAccount.Show(); } catch (ConnectingException) { } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!"); } }