internal void ShowWindow() { if (this.IsWindowVisible) { return; } this.IsWindowVisible = true; this.Show(); if (this.Control == null) { return; } if (!this.Control.ShowControlInSeparateWindow) { this.Control.Show(); } else { this.Control.Show(); this.cw = new ContainerWindow(this.Owner, (UserControl)this.Control, this.Control.Width, this.Control.Height, false, false, this.Control.ShowTransparentWindow, -1.0, (Brush)null); this.cw.Show(); } }
public ContainerWindow( MainWindow window, UserControl control, double width, double height, bool autoHeight = false, bool isShow = true, bool isWindowTransparent = false, double radius = -1.0, Brush brush = null) { ContainerWindow containerWindow = this; this.InitializeComponent(); this.Closing += (CancelEventHandler)((o, e) => containerWindow.ClosingContainerWindow(o, e, control)); if (radius != -1.0) { this.CustomCornerRadius = new CornerRadius(radius); } if (brush != null) { this.CustomBorderBrush = brush; } if (!isWindowTransparent) { this.SetShadowBorder(); this.SetOuterBorder(); this.SetMaskGrid(); } if (autoHeight) { this.Width = width + (isWindowTransparent ? 0.0 : 64.0); this.SizeToContent = SizeToContent.Height; } else { this.Width = width + (isWindowTransparent ? 0.0 : 64.0); this.Height = height + (isWindowTransparent ? 0.0 : 64.0); } this.Owner = (Window)window; if (window == null) { return; } if (window.mDMMRecommendedWindow != null && window.mDMMRecommendedWindow.Visibility == Visibility.Visible && window.IsUIInPortraitMode) { double num1 = (window.Width + window.mDMMRecommendedWindow.Width - this.Width) / 2.0 + window.Left; double num2 = (window.Height - this.Height) / 2.0 + window.Top; double num3 = num1 + this.Width; double num4 = num2 + this.Height; if (num1 > 0.0 && num3 < SystemParameters.PrimaryScreenWidth && (num2 > 0.0 && num4 < SystemParameters.PrimaryScreenHeight)) { this.Left = num1; this.Top = num2; } else { this.WindowStartupLocation = WindowStartupLocation.CenterOwner; } } else if (window.WindowState == WindowState.Minimized) { this.WindowStartupLocation = WindowStartupLocation.CenterScreen; } else { this.WindowStartupLocation = WindowStartupLocation.CenterOwner; } this.ContentGrid.Children.Add((UIElement)control); if (!isShow) { return; } if (window != null) { window.ShowDimOverlay((IDimOverlayControl)null); this.Owner = (Window)window.mDimOverlay; } this.ShowDialog(); window?.HideDimOverlay(); }