/// <summary> /// Fullscreen/restore window /// </summary> internal static void Fullscreen_Restore(bool forceFullscreen = false) { if (forceFullscreen || !Properties.Settings.Default.Fullscreen) { // Show fullscreen logic // Save size to get back to it when restoring if (!Properties.Settings.Default.AutoFitWindow) { Properties.Settings.Default.Top = LoadWindows.GetMainWindow.Top; Properties.Settings.Default.Left = LoadWindows.GetMainWindow.Left; Properties.Settings.Default.Height = LoadWindows.GetMainWindow.Height; Properties.Settings.Default.Width = LoadWindows.GetMainWindow.Width; } Properties.Settings.Default.Fullscreen = true; ShowTopandBottom(false); LoadWindows.GetMainWindow.Topmost = true; LoadWindows.GetMainWindow.ResizeMode = ResizeMode.CanMinimize; LoadWindows.GetMainWindow.SizeToContent = SizeToContent.Manual; LoadWindows.GetMainWindow.Width = MonitorInfo.Width; LoadWindows.GetMainWindow.Height = MonitorInfo.Height; LoadWindows.GetMainWindow.Top = MonitorInfo.WorkArea.Top; LoadWindows.GetMainWindow.Left = MonitorInfo.WorkArea.Left; // Handle if browsing gallery if (GalleryFunctions.IsOpen) { GalleryLoad.LoadLayout(); GalleryScroll.ScrollTo(); } else { ShowNavigation(true); ShowShortcuts(true); if (GetGalleryShortcut != null) { GetGalleryShortcut.Opacity = GetClickArrowLeft.Opacity = GetClickArrowRight.Opacity = Getx2.Opacity = GetRestorebutton.Opacity = GetMinus.Opacity = 1; } } ConfigureSettings.ConfigColors.UpdateColor(true); Properties.Settings.Default.Save(); } else { LoadWindows.GetMainWindow.Topmost = false; if (Properties.Settings.Default.ShowInterface) { ShowNavigation(false); ShowTopandBottom(true); ShowShortcuts(false); } else { ShowNavigation(true); ShowTopandBottom(false); ShowShortcuts(true); } if (AutoFitWindow) { LoadWindows.GetMainWindow.SizeToContent = SizeToContent.WidthAndHeight; LoadWindows.GetMainWindow.ResizeMode = ResizeMode.NoResize; if (GetQuickSettingsMenu != null) { GetQuickSettingsMenu.SetFit.IsChecked = true; } LoadWindows.GetMainWindow.WindowState = WindowState.Normal; LoadWindows.GetMainWindow.Width = double.NaN; LoadWindows.GetMainWindow.Height = double.NaN; LoadWindows.GetMainWindow.Top -= LoadWindows.GetMainWindow.LowerBar.ActualHeight / 2; // It works... } else { LoadWindows.GetMainWindow.SizeToContent = SizeToContent.Manual; LoadWindows.GetMainWindow.ResizeMode = ResizeMode.CanResizeWithGrip; if (GetQuickSettingsMenu != null) { GetQuickSettingsMenu.SetFit.IsChecked = false; } LoadWindows.GetMainWindow.Top = Properties.Settings.Default.Top; LoadWindows.GetMainWindow.Left = Properties.Settings.Default.Left; LoadWindows.GetMainWindow.Height = Properties.Settings.Default.Height; LoadWindows.GetMainWindow.Width = Properties.Settings.Default.Width; LoadWindows.GetMainWindow.ParentContainer.Width = double.NaN; LoadWindows.GetMainWindow.ParentContainer.Height = double.NaN; } TryFitImage(); ConfigureSettings.ConfigColors.UpdateColor(); // Regain border Properties.Settings.Default.Fullscreen = false; } }
/// <summary> /// Fullscreen/restore window /// </summary> internal static void Fullscreen_Restore(bool forceFullscreen = false) { if (forceFullscreen || !Properties.Settings.Default.Fullscreen) { // Show fullscreen logic RenderFullscreen(); // Handle if browsing gallery if (GalleryFunctions.IsOpen) { GalleryLoad.LoadLayout(); GalleryNavigation.ScrollTo(); } ShowNavigation(Properties.Settings.Default.ShowAltInterfaceButtons); ShowShortcuts(Properties.Settings.Default.ShowAltInterfaceButtons); Properties.Settings.Default.Fullscreen = true; } else { GetMainWindow.Topmost = Properties.Settings.Default.TopMost; if (Properties.Settings.Default.ShowInterface) { ShowNavigation(false); ShowTopandBottom(true); ShowShortcuts(false); } else { ShowNavigation(true); ShowTopandBottom(false); ShowShortcuts(true); } if (AutoFitWindow) { GetMainWindow.SizeToContent = SizeToContent.WidthAndHeight; GetMainWindow.ResizeMode = ResizeMode.NoResize; if (GetQuickSettingsMenu != null) { GetQuickSettingsMenu.SetFit.IsChecked = true; } GetMainWindow.Width = double.NaN; GetMainWindow.Height = double.NaN; GetMainWindow.Top -= GetMainWindow.LowerBar.ActualHeight / 2; // It works... } else { GetMainWindow.SizeToContent = SizeToContent.Manual; GetMainWindow.ResizeMode = ResizeMode.CanResizeWithGrip; if (GetQuickSettingsMenu != null) { GetQuickSettingsMenu.SetFit.IsChecked = false; } GetMainWindow.Top = Properties.Settings.Default.Top; GetMainWindow.Left = Properties.Settings.Default.Left; GetMainWindow.Height = Properties.Settings.Default.Height; GetMainWindow.Width = Properties.Settings.Default.Width; GetMainWindow.ParentContainer.Width = double.NaN; GetMainWindow.ParentContainer.Height = double.NaN; } if (GetMainWindow.WindowState == WindowState.Maximized) { GetMainWindow.WindowState = WindowState.Normal; // Reset margin from fullscreen GetMainWindow.ParentContainer.Margin = new Thickness(0); } if (Slideshow.SlideTimer != null && Slideshow.SlideTimer.Enabled) { Slideshow.SlideTimer.Enabled = false; } Properties.Settings.Default.Fullscreen = false; TryFitImage(); ConfigureSettings.ConfigColors.UpdateColor(); // Regain border } }