Beispiel #1
0
        private void WindowStateChanged(object sender, EventArgs e)
        {
            UserSettings.CurrentSettings.WindowCollection[Name].IsMaximized = WindowState.HasFlag(System.Windows.WindowState.Maximized);

            if (!UserSettings.CurrentSettings.WindowCollection[Name].IsMaximized)
            {
                return;
            }
            UserSettings.CurrentSettings.WindowCollection[Name].ThisLocation = RestoreBounds.Location;
            UserSettings.CurrentSettings.WindowCollection[Name].ThisSize     = RestoreBounds.Size;
        }
Beispiel #2
0
        public void WindowAction(AppWindowState state)
        {
            if (state == AppWindowState.Maximize && WindowState.HasFlag(AppWindowState.Maximize))
            {
                WindowState = AppWindowState.Default;
            }
            else if (state == AppWindowState.Maximize)
            {
                WindowState = state;
            }
            else if (state == AppWindowState.CloseRequest)
            {
                WindowState = state;
            }
            else
            {
                WindowState |= state;
            }

            OnWindowAction?.Invoke(AppData);
        }
Beispiel #3
0
        private void ChangeWindowState()
        {
            screen = Screen.GetWorkingArea(new Point((int)(this.Left + this.ActualWidth / 2),
                                                     (int)(this.Top + this.ActualHeight / 2)));

            var dpiXProperty = typeof(SystemParameters).GetProperty("DpiX", BindingFlags.NonPublic | BindingFlags.Static);
            var dpiX         = (int)dpiXProperty.GetValue(null, null);

            MaxHeight = screen.Size.Height + (BorderThickness.Right + SystemParameters.FixedFrameHorizontalBorderHeight * 2);;
            MaxWidth  = screen.Size.Width + (BorderThickness.Bottom + SystemParameters.FixedFrameVerticalBorderWidth * 2);;

            if (dpiX == 120)
            {
                MaxHeight = MaxHeight / 125 * 100 + 2;
                MaxWidth  = MaxWidth / 125 * 100 + 2;
            }
            else if (dpiX == 144)
            {
                MaxHeight = MaxHeight / 150 * 100 + 3;
                MaxWidth  = MaxWidth / 150 * 100 + 3;
            }

            WindowState = WindowState.HasFlag(WindowState.Maximized) ? WindowState.Normal : WindowState.Maximized;
        }