private void ShowWindow() { if (_windowViewModel != null) { _windowViewModel.Conductor.ActivateItemAsync(_windowViewModel); } else { _windowViewModel = new WindowViewModel(); _windowViewModel.Activated += OnWindowActivated; _windowViewModel.Deactivated += OnWindowDeactivated; _windowService.ShowWindow(_windowViewModel); } }
private void OnWindowDeactivated(object sender, DeactivationEventArgs eventArgs) { Log.Add("Window deactivated"); if (eventArgs.Closed) { _windowViewModel.Activated -= OnWindowActivated; _windowViewModel.Deactivated -= OnWindowDeactivated; _windowViewModel = null; Log.Add("Window closed"); } RefreshButtons(); }