public MainWindowViewModel(MainWindow mainWindow) { _mainWindow = mainWindow; _mainWindow.StateChanged += (o, e) => { if (_mainWindow.WindowState == (WindowState)2 || _mainWindow.WindowState == (WindowState)1) { _mainWindow.WindowState = (WindowState)0; } }; string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "save.notes"); if (NoteModel.ContainNotes() && File.Exists(path)) { _mainWindow.Hide(); } UpdateNotes(); }