private void DeleteButton_Click(object sender, RoutedEventArgs e) { if ((imageName != "" || imgByteArrDB != null) && IsValidEmail(EmailAddress.Text.ToString())) { foreach (UserDBContext user in users) { if (user.Email.Equals(EmailAddress.Text.ToString())) { UserDBContext.IntitalizeDB(); UserDBContext.Delete(EmailAddress.Text.ToString()); InitializeDataGrid(); ClearAll(); WindowSuccess success = new WindowSuccess(); success.SetContent("Account Deleted Succefully"); success.Show(); } } } else { WindowError error = new WindowError(); error.SetContent("Account Is Not Selected"); error.Show(); } }