public void AdjustWindow() { //读取窗体设置 WindowConfig cj = new WindowConfig(this.GetType().Name); Rect rect; (rect, WinState) = cj.GetValue(); if (rect.X != -1 && rect.Y != -1) { this.WindowState = WindowState.Normal; this.Left = rect.X > 0 ? rect.X : 0; this.Top = rect.Y > 0 ? rect.Y : 0; this.Height = rect.Height <= SystemParameters.PrimaryScreenHeight ? rect.Height : SystemParameters.PrimaryScreenHeight / 2; this.Width = rect.Width <= SystemParameters.PrimaryScreenWidth ? rect.Width : SystemParameters.PrimaryScreenWidth / 2; if (this.Width == SystemParameters.WorkArea.Width | this.Height == SystemParameters.WorkArea.Height) { WinState = JvedioWindowState.Maximized; } } else { WinState = JvedioWindowState.Normal; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; } }
private void AdjustWindow() { //读取窗体设置 WindowConfig cj = new WindowConfig(this.GetType().Name); Rect rect; (rect, WinState) = cj.GetValue(); if (rect.X != -1 && rect.Y != -1) { //读到属性值 if (WinState == JvedioWindowState.Maximized) { MaxWindow(this, new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, 0, MouseButton.Left)); } else { this.WindowState = WindowState.Normal; this.Left = rect.X > 0 ? rect.X : 0; this.Top = rect.Y > 0 ? rect.Y : 0; this.Height = rect.Height > 100 ? rect.Height : 100; this.Width = rect.Width > 100 ? rect.Width : 100; if (this.Width == SystemParameters.WorkArea.Width | this.Height == SystemParameters.WorkArea.Height) { WinState = JvedioWindowState.Maximized; } } } else { WinState = JvedioWindowState.Normal; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; } HideMargin(); }