Beispiel #1
0
        private void MainWindowLoadedSetState(object sender, RoutedEventArgs e)
        {
            var status = App.Setting.Window.Main;

            this.Loaded -= this.MainWindowLoadedSetState;

            if (status.State.HasValue)
            {
                this.WindowState = WindowStatus.ConvertWindowState(status.State.Value);
            }
        }
Beispiel #2
0
        protected override void OnClosing(CancelEventArgs e)
        {
            var status = App.Setting.Window.Main;

            status.Top    = this.Top;
            status.Left   = this.Left;
            status.Width  = this.Width;
            status.Height = this.Height;

            status.State = WindowStatus.ConvertWindowState(this.WindowState);

            if (App.Setting.MinimizeAtCloseButtonClick)
            {
                this.WindowState = System.Windows.WindowState.Minimized;
                e.Cancel         = true;
            }

            base.OnClosing(e);
        }