private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //_wndClosing = true; if (IsRunning) { if (MessageBox.Show("File operation is in progress. Are you sure want to close the application?", Caption, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { return; } } e.Cancel = SaveSettings(); if (!e.Cancel) { var up = new ChoUserPreferences(); if (RememberWindowSizeAndPosition) { up.WindowHeight = this.Height; up.WindowWidth = this.Width; up.WindowTop = this.Top; up.WindowLeft = this.Left; up.WindowState = this.WindowState; } up.RememberWindowSizeAndPosition = RememberWindowSizeAndPosition; up.ScrollOutput = ScrollOutput; up.Save(); } }
public MainWindow(string settingsFilePath) { SettingsFilePath = settingsFilePath; InitializeComponent(); Caption = Title; Title = "{0} (v{1})".FormatString(Title, Assembly.GetEntryAssembly().GetName().Version); var up = new ChoUserPreferences(); RememberWindowSizeAndPosition = up.RememberWindowSizeAndPosition; ScrollOutput = up.ScrollOutput; if (up.RememberWindowSizeAndPosition) { this.Height = up.WindowHeight; this.Width = up.WindowWidth; this.Top = up.WindowTop; this.Left = up.WindowLeft; this.WindowState = up.WindowState; } }