internal static void PicGallery_Loaded(object sender, RoutedEventArgs e) { // Add events and set fields, when it's loaded. picGallery.Scroller.PreviewMouseWheel += ScrollTo; picGallery.Scroller.ScrollChanged += (s, x) => mainWindow.Focus(); // Maintain window focus when scrolling manually picGallery.grid.MouseLeftButtonDown += (s, x) => mainWindow.Focus(); picGallery.x2.MouseLeftButtonUp += delegate { PicGalleryToggle.ToggleGallery(); }; IsLoading = IsOpen = false; }
private void MainWindow_ContentRendered(object sender, EventArgs e) { // Update values AllowDrop = true; IsScrollEnabled = Properties.Settings.Default.ScrollEnabled; Pics = new List <string>(); //DataContext = this; MonitorInfo = MonitorSize.GetMonitorSize(); // Load image if possible if (Application.Current.Properties["ArbitraryArgName"] == null) { Unload(); UpdateColor(); } else { Pic(Application.Current.Properties["ArbitraryArgName"].ToString()); if (Properties.Settings.Default.Fullscreen) { Fullscreen_Restore(true); } else { UpdateColor(); } } LoadClickArrow(true); LoadClickArrow(false); Loadx2(); LoadMinus(); // Update WindowStyle if (!Properties.Settings.Default.ShowInterface) { clickArrowLeft.Opacity = clickArrowRight.Opacity = x2.Opacity = minus.Opacity = 0; clickArrowLeft.Visibility = clickArrowRight.Visibility = x2.Visibility = minus.Visibility = Visibility.Visible; } mainColor = (Color)Application.Current.Resources["MainColor"]; if (!Properties.Settings.Default.BgColorWhite) { imgBorder.Background = new SolidColorBrush(Colors.Transparent); } backgroundBorderColor = (Color)Application.Current.Resources["BackgroundColorAlt"]; // Load PicGallery, if needed if (Properties.Settings.Default.PicGallery > 0) { picGallery = new PicGallery { Opacity = 0, Visibility = Visibility.Collapsed }; bg.Children.Add(picGallery); Panel.SetZIndex(picGallery, 999); if (Properties.Settings.Default.PicGallery == 2 && freshStartup) { PicGalleryToggle.ToggleGallery(); } } // Add UserControls :) LoadTooltipStyle(); LoadFileMenu(); LoadImageSettingsMenu(); LoadQuickSettingsMenu(); LoadFunctionsMenu(); LoadAutoScrollSign(); // Update UserControl values quickSettingsMenu.ToggleScroll.IsChecked = IsScrollEnabled; if (FitToWindow) { quickSettingsMenu.SetFit.IsChecked = true; quickSettingsMenu.SetCenter.IsChecked = false; } else { quickSettingsMenu.SetCenter.IsChecked = true; quickSettingsMenu.SetFit.IsChecked = false; } // Initilize Things! RecentFiles.Initialize(); InitializeZoom(); // Add things! AddEvents(); AddTimers(); AddContextMenus(); // Updates settings from older version to newer version if (Properties.Settings.Default.CallUpgrade) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.CallUpgrade = false; } AjaxLoadingEnd(); }