Skip to content

Commit

Permalink
Log exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
MoshiMoshi0 committed Oct 10, 2019
1 parent 91f3e9d commit 040c0f3
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,19 +753,18 @@ private void razer_wrapper_install_button_Click(object sender, RoutedEventArgs e
{
void HandleExceptions(AggregateException ae)
{
ShowMessageBox(ae.ToString(), "Exception!", MessageBoxImage.Error);
ae.Handle(ex => {
Application.Current.Dispatcher.Invoke(() =>
System.Windows.MessageBox.Show(ex.ToString(), "Exception!",
MessageBoxButton.OK, MessageBoxImage.Error));
Global.logger.Error(ex.ToString());
return true;
});
}

void SetButtonContent(string s)
=> Application.Current.Dispatcher.Invoke(() => razer_wrapper_install_button.Content = s);

void ShowMessageBox(string message, string title)
=> Application.Current.Dispatcher.Invoke(() => System.Windows.MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Exclamation));
void ShowMessageBox(string message, string title, MessageBoxImage image = MessageBoxImage.Exclamation)
=> Application.Current.Dispatcher.Invoke(() => System.Windows.MessageBox.Show(message, title, MessageBoxButton.OK, image));

razer_wrapper_install_button.IsEnabled = false;
razer_wrapper_uninstall_button.IsEnabled = false;
Expand Down Expand Up @@ -833,19 +832,18 @@ private void razer_wrapper_uninstall_button_Click(object sender, RoutedEventArgs
{
void HandleExceptions(AggregateException ae)
{
ShowMessageBox(ae.ToString(), "Exception!", MessageBoxImage.Error);
ae.Handle(ex => {
Application.Current.Dispatcher.Invoke(() =>
System.Windows.MessageBox.Show(ex.ToString(), "Exception!",
MessageBoxButton.OK, MessageBoxImage.Error));
Global.logger.Error(ex.ToString());
return true;
});
}

void SetButtonContent(string s)
=> Application.Current.Dispatcher.Invoke(() => razer_wrapper_uninstall_button.Content = s);

void ShowMessageBox(string message, string title)
=> Application.Current.Dispatcher.Invoke(() => System.Windows.MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Exclamation));
void ShowMessageBox(string message, string title, MessageBoxImage image = MessageBoxImage.Exclamation)
=> Application.Current.Dispatcher.Invoke(() => System.Windows.MessageBox.Show(message, title, MessageBoxButton.OK, image));

razer_wrapper_install_button.IsEnabled = false;
razer_wrapper_uninstall_button.IsEnabled = false;
Expand Down

0 comments on commit 040c0f3

Please sign in to comment.