diff --git a/STranslate/View/MainWindow.xaml.cs b/STranslate/View/MainWindow.xaml.cs index a48f4ba..82b02b0 100644 --- a/STranslate/View/MainWindow.xaml.cs +++ b/STranslate/View/MainWindow.xaml.cs @@ -73,6 +73,7 @@ namespace STranslate.View /// private void Window_Deactivated(object sender, EventArgs e) { + if (vm == null) return; if (!vm.IsTopmost) { vm.Speech.SpeakAsyncCancelAll(); diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index 4bfb3a5..35b71e5 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -22,7 +22,7 @@ namespace STranslate.ViewModel if (!ReadConfig()) { - Task.Delay(3000); + IsVisibility = false; Environment.Exit(-1); }