public LogIntegrityStatWindow() { InitializeComponent(); _state = new WindowStateSaver(this, ApplicationSettingsBase.LocalApplicationDataPath + "\\RPD.Presentation.LogIntegrityStatWindowState.xml"); Closing += (sender, args) => _state.Dispose(); }
private void OnClosing(object p, CancelEventArgs e) { _messenger.Unregister(this); var cleanup = DataContext as ICleanup; if (cleanup != null) { cleanup.Cleanup(); } _state.Dispose(); }
private void OnClosing(object sender, CancelEventArgs cancelEventArgs) { _messenger.Unregister(this); var viewModel = (IDisposable)DataContext; viewModel.Dispose(); if (_isSimpleMode) { Application.Current.Shutdown(); } _state.Dispose(); }
public SettingsWindow() { InitializeComponent(); _state = new WindowStateSaver(this, ApplicationSettingsBase.LocalApplicationDataPath + "\\RPD.Presentation.SettingsWindowState.xml"); Messenger.Default.Register <DialogMessage <FolderBrowserDialog> >(this, Views.Settings, (msg) => { msg.Result.DialogResult = msg.Dialog.ShowDialog(); msg.ProcessResult(); }); // Закрыть. Messenger.Default.Register <ViewMessage>(this, Views.Settings, (msg) => { if (msg.Action == ViewAction.Close) { Close(); } }); Closing += (e, s) => { var vm = (SettingsViewModel)DataContext; if (!vm.CanClose()) { s.Cancel = true; return; } Messenger.Default.Unregister(this); _state.Dispose(); var cleanup = DataContext as ICleanup; if (cleanup != null) { cleanup.Cleanup(); } }; }
private void OnClosing(object sender, CancelEventArgs cancelEventArgs) { if (!_canClose) { cancelEventArgs.Cancel = true; return; } _messenger.Unregister(this); var cleanup = DataContext as ICleanup; if (cleanup != null) { cleanup.Cleanup(); } _state.Dispose(); }
private void OnClosing(object p, CancelEventArgs e) { if (!_canClose) { e.Cancel = true; return; } _messenger.Unregister(this); var cleanup = DataContext as ICleanup; if (cleanup != null) { cleanup.Cleanup(); } _state.Dispose(); if (_isSimpleMode) { Application.Current.Shutdown(); } }
private void OnClosing(object sender, CancelEventArgs cancelEventArgs) { _state.Dispose(); _messenger.Unregister(this); }