private void Login_Click(object sender, RoutedEventArgs e) { try { Login.Init(this.Username.Text, this.Password.Password); } catch (Exception exeption) { MessageBox.Show(exeption.Message); return; } var o = new UserPanel(); o.Show(); this.Close(); }