private void ShowSideHtmlWidgetWindow() { this.ParentWindow.Dispatcher.BeginInvoke((Delegate)(() => { this.mBrowser.Visibility = Visibility.Visible; this.mCloseButton.Visibility = Visibility.Visible; this.Visibility = Visibility.Visible; this.Activate(); if (this.ParentWindow.WindowState == WindowState.Maximized || this.ParentWindow.mIsFullScreen) { IntereopRect fullscreenMonitorSize = WindowWndProcHandler.GetFullscreenMonitorSize(this.ParentWindow.Handle, true); this.Left = (double)(fullscreenMonitorSize.Left + fullscreenMonitorSize.Width) / MainWindow.sScalingFactor - this.Width + 30.0 - (this.ParentWindow.mIsFullScreen || !this.ParentWindow.EngineInstanceRegistry.IsSidebarVisible ? 0.0 : 62.0); this.Top = (double)(fullscreenMonitorSize.Top + fullscreenMonitorSize.Height) / MainWindow.sScalingFactor - this.Height + 30.0; } else { this.Left = this.ParentWindow.Left + this.ParentWindow.Width - this.Width + 30.0 - (this.ParentWindow.EngineInstanceRegistry.IsSidebarVisible ? 62.0 : 0.0); this.Top = this.ParentWindow.Top + this.ParentWindow.Height - this.Height + 30.0; } if (this.ParentWindow != null) { this.ParentWindow.Activated -= new EventHandler(this.ParentWindow_Activated); this.ParentWindow.Activated += new EventHandler(this.ParentWindow_Activated); } SystemEvents.DisplaySettingsChanged -= new EventHandler(this.DisplaySettingsChanged); SystemEvents.DisplaySettingsChanged += new EventHandler(this.DisplaySettingsChanged); })); }
internal void InitLayout() { MainWindow parentWindow = this.ParentWindow; Grid mFrontendGrid = parentWindow.mFrontendGrid; Point point1 = mFrontendGrid.TranslatePoint(new Point(), (UIElement)parentWindow); if (this.IsInOverlayMode) { this.Background = (Brush)Brushes.Transparent; this.mCanvas.Background = (Brush)Brushes.Transparent; this.mCanvas2.Background = (Brush)Brushes.Transparent; this.mCanvas.Margin = new Thickness(); if (Oem.IsOEMDmm) { this.Opacity = RegistryManager.Instance.TranslucentControlsTransparency; } else { string path = Path.Combine(Path.Combine(RegistryManager.Instance.ClientInstallDir, "ImapImages"), this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab.PackageName + ".png"); if (File.Exists(path)) { this.mCanvasImage.ImageName = path; this.mCanvas.Opacity = 0.0; } else { this.mCanvas.Opacity = 1.0; } } this.Handle = WindowInteropHelperExtensions.EnsureHandle(new WindowInteropHelper((Window)this)); InteropWindow.SetWindowLong(this.Handle, -16, 1207959552); } else { IntereopRect fullscreenMonitorSize = WindowWndProcHandler.GetFullscreenMonitorSize(this.ParentWindow.Handle, true); double width = (double)fullscreenMonitorSize.Width - (double)this.mSidebarWidth * MainWindow.sScalingFactor; if (!this.ParentWindow.EngineInstanceRegistry.IsSidebarVisible) { width -= this.ParentWindow.mSidebar.Width * MainWindow.sScalingFactor; } double height = this.ParentWindow.GetHeightFromWidth(width, true, false); if (height > (double)fullscreenMonitorSize.Height) { height = (double)fullscreenMonitorSize.Height; width = this.ParentWindow.GetWidthFromHeight(height, true, false); } double top = this.ParentWindow.Top * MainWindow.sScalingFactor + height <= (double)(fullscreenMonitorSize.Y + fullscreenMonitorSize.Height) ? this.ParentWindow.Top * MainWindow.sScalingFactor : (double)fullscreenMonitorSize.Y + ((double)fullscreenMonitorSize.Height - height) / 2.0; double left = this.ParentWindow.Left * MainWindow.sScalingFactor + width + (double)this.mSidebarWidth * MainWindow.sScalingFactor <= (double)(fullscreenMonitorSize.X + fullscreenMonitorSize.Width) ? this.ParentWindow.Left * MainWindow.sScalingFactor : (double)fullscreenMonitorSize.X + ((double)fullscreenMonitorSize.Width - width - (double)this.mSidebarWidth * MainWindow.sScalingFactor) / 2.0; this.ParentWindow.ChangeHeightWidthTopLeft(width, height, top, left); this.Width = this.ParentWindow.ActualWidth; this.Height = this.ParentWindow.ActualHeight; this.Top = this.ParentWindow.Top; this.Left = this.ParentWindow.Left; this.mCanvas.Width = this.ParentWindow.mFullScreenRestoredButNotSidebar ? mFrontendGrid.ActualWidth - this.ParentWindow.mSidebar.Width : mFrontendGrid.ActualWidth; this.mCanvas.Height = mFrontendGrid.ActualHeight; Point point2 = new Point(parentWindow.ActualWidth - (this.mCanvas.Width + point1.X), parentWindow.ActualHeight - (mFrontendGrid.ActualHeight + point1.Y)); this.mCanvas.Margin = new Thickness(point1.X, point1.Y, point2.X, point2.Y); } }