コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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;
            }
        }