Skip to content

Commit

Permalink
add failsave
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelo420 committed Jan 9, 2024
1 parent 636e0fb commit 204c175
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gamevault/UserControls/AdminConsoleUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ private void Activated_Toggled(object sender, RoutedEventArgs e)

private async void DeleteUser_Clicked(object sender, MouseButtonEventArgs e)
{
this.IsEnabled = false;

User selectedUser = (User)((FrameworkElement)sender).DataContext;
if (selectedUser == null)
return;

if (selectedUser.DeletedAt == null)
{
MessageDialogResult result = await ((MetroWindow)App.Current.MainWindow).ShowMessageAsync($"Are you sure you want to delete User '{selectedUser.Username}' ?",
"", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "Yes", NegativeButtonText = "No", AnimateHide = false });
if (result != MessageDialogResult.Affirmative)
{
this.IsEnabled = true;
return;
}
}
this.IsEnabled = false;
await Task.Run(async () =>
{
try
Expand Down

0 comments on commit 204c175

Please sign in to comment.