|
@@ -80,49 +80,27 @@ public class ViewModelBase : ReactiveValidationObject
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
-#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
|
- Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
- {
|
|
|
- if (Application.Current is not null && Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
|
- {
|
|
|
- Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
- {
|
|
|
- var ErrorMessageViewModel = new MessageWindowViewModel(message, "Error message", MessageBoxButtons.Ok, stackTrace, logfile:logfile);
|
|
|
- var ErrorMessage = new MessageWindow()
|
|
|
- {
|
|
|
- DataContext = ErrorMessageViewModel
|
|
|
- };
|
|
|
- //TODO change it to binding
|
|
|
- ErrorMessage.FindControl<TitleBarWindow>("titleBar").TitleText = "Error Message";
|
|
|
-
|
|
|
- ErrorMessage.ShowDialog(desktop.MainWindow);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
|
+ OpenErrorWindow(message, logfile, stackTrace);
|
|
|
}
|
|
|
|
|
|
- public static void OpenErrorWindow(string message, string logfile = "")
|
|
|
+ public static void OpenErrorWindow(string message, string logfile = "", string stackTrace = "")
|
|
|
{
|
|
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
|
- Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
+ if (Application.Current is not null && Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
|
{
|
|
|
- if (Application.Current is not null && Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
|
+ Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
{
|
|
|
- Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
+ var ErrorMessageViewModel = new MessageWindowViewModel(message, "Error message", logfile: logfile);
|
|
|
+ var ErrorMessage = new MessageWindow()
|
|
|
{
|
|
|
- var ErrorMessageViewModel = new MessageWindowViewModel(message, "Error message", logfile: logfile);
|
|
|
- var ErrorMessage = new MessageWindow()
|
|
|
- {
|
|
|
- DataContext = ErrorMessageViewModel
|
|
|
- };
|
|
|
- //TODO change it to binding
|
|
|
- ErrorMessage.GetControl<TitleBarWindow>("titleBar").TitleText = "Error Message";
|
|
|
+ DataContext = ErrorMessageViewModel
|
|
|
+ };
|
|
|
+ //TODO change it to binding
|
|
|
+ ErrorMessage.GetControl<TitleBarWindow>("titleBar").TitleText = "Error Message";
|
|
|
|
|
|
- ErrorMessage.ShowDialog(desktop.MainWindow);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ ErrorMessage.ShowDialog(desktop.MainWindow);
|
|
|
+ });
|
|
|
+ }
|
|
|
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
|
}
|
|
|
}
|