示例#1
0
        private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
        {
            // Update size when screen resulution changes

            MonitorInfo = MonitorSize.GetMonitorSize();
            ZoomFit(img.Width, img.Height);
        }
示例#2
0
        /// <summary>
        /// Move window and maximize on double click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal static void Move(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton != MouseButton.Left)
            {
                return;
            }

            if (e.ClickCount == 2)
            {
                // Prevent method from being called twice
                var bar = sender as TextBlock;
                if (bar != null)
                {
                    if (bar.Name == "Bar")
                    {
                        return;
                    }
                }
                Maximize_Restore();
            }
            else
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    mainWindow.DragMove();
                }

                // Update info for possible new screen, needs more engineering
                MonitorInfo = MonitorSize.GetMonitorSize();
            }
        }
示例#3
0
        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();
        }