/// <summary> /// Extra functionality and error checking when clicking /// on the navigation buttons /// </summary> /// <param name="arrow"></param> /// <param name="right"></param> internal static void PicButton(bool arrow, bool right) { if (!arrow) // Normal buttons { if (GalleryFunctions.IsOpen) { GalleryScroll.ScrollTo(!right); return; } if (!CanNavigate) { return; } if (right) { RightbuttonClicked = true; Pic(); } else { LeftbuttonClicked = true; Pic(false, false); } } else // Alternative interface buttons { if (!CanNavigate) { return; } if (right) { ClickArrowRightClicked = true; Pic(); } else { ClickArrowLeftClicked = true; Pic(false, false); } } }
/// <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> /// Goes to next, previous, first or last file in folder /// </summary> /// <param name="next">Whether it's forward or not</param> /// <param name="end">Whether to go to last or first, /// depending on the next value</param> internal static void Pic(bool next = true, bool end = false) { // Exit if not intended to change picture if (!CanNavigate) { return; } // exit if browsing PicGallery if (GetPicGallery != null) { if (Properties.Settings.Default.PicGallery == 1) { if (GalleryFunctions.IsOpen) { return; } } } // Make backup var indexBackup = FolderIndex; if (!end) // Go to next or previous { if (next) { // loop next if (Properties.Settings.Default.Looping || Slideshow.SlideTimer != null && Slideshow.SlideTimer.Enabled) { FolderIndex = FolderIndex == Pics.Count - 1 ? 0 : FolderIndex + 1; } else { // Go to next if able if (FolderIndex + 1 == Pics.Count) { return; } FolderIndex++; } Reverse = false; } else { // Loop prev if (Properties.Settings.Default.Looping || Slideshow.SlideTimer != null && Slideshow.SlideTimer.Enabled) { FolderIndex = FolderIndex == 0 ? Pics.Count - 1 : FolderIndex - 1; } else { // Go to prev if able if (FolderIndex - 1 < 0) { return; } FolderIndex--; } Reverse = true; } } else // Go to first or last { FolderIndex = next ? Pics.Count - 1 : 0; indexBackup = FolderIndex; // Reset preloader values to prevent errors if (Pics.Count > 20) { Preloader.Clear(); } } // Go to the image! Pic(FolderIndex); // Update PicGallery selected item, if needed if (GetPicGallery != null) { if (GetPicGallery.Container.Children.Count > FolderIndex && GetPicGallery.Container.Children.Count > indexBackup) { if (indexBackup != FolderIndex) { GalleryFunctions.SetUnselected(indexBackup); } GalleryFunctions.SetSelected(FolderIndex); GalleryScroll.ScrollTo(); } else { // TODO Find way to get PicGalleryItem an alternative way... } } CloseToolTipMessage(); }
/// <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(); GalleryScroll.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; GetMainWindow.BorderThickness = 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 } }