private void Button_Click(object sender, RoutedEventArgs e) { if (txtbox_VereficationCode.Text == client.GetVerificationCodeFromEmail(client.GetUserByLogin(login).Email).ToString()) { this.DialogResult = true; this.Close(); } else { MsgBox msg = new MsgBox("Error!", "Wrong code"); msg.Show(); } }