Пример #1
0
        /// <summary>
        /// Load app configurations
        /// </summary>
        private void LoadConfig()
        {
            //Load language pack-------------------------------------------------------------
            string s = GlobalSetting.GetConfig("Language", "English");
            if (s.ToLower().CompareTo("english") != 0 && File.Exists(s))
            {
                GlobalSetting.LangPack = new Library.Language(s);

                //force update language pack
                GlobalSetting.IsForcedActive = true;
                frmMain_Activated(null, null);
            }

            //Windows Bound (Position + Size)------------------------------------------------
            Rectangle rc = GlobalSetting.StringToRect(GlobalSetting.GetConfig("WindowsBound", "280,125,850,550"));
            Bounds = rc;

            //windows state--------------------------------------------------------------
            s = GlobalSetting.GetConfig("WindowsState", "Normal");
            if (s == "Normal")
            {
                WindowState = FormWindowState.Normal;
            }
            else if (s == "Maximized")
            {
                WindowState = FormWindowState.Maximized;
            }

            //check current version for the first time running
            s = GlobalSetting.GetConfig("igVersion", Application.ProductVersion);
            if (s.CompareTo(Application.ProductVersion) == 0) //Old version
            {
                //Load Extra extensions
                GlobalSetting.SupportedExtraExtensions = GlobalSetting.GetConfig("ExtraExtensions", GlobalSetting.SupportedExtraExtensions);
            }

            //Slideshow Interval-----------------------------------------------------------
            int i = int.Parse(GlobalSetting.GetConfig("Interval", "5"));
            if (!(0 < i && i < 61)) i = 5;//time limit [1; 60] seconds
            timSlideShow.Interval = 1000 * i;

            //Show checked bakcground-------------------------------------------------------
            GlobalSetting.IsShowCheckedBackground = bool.Parse(GlobalSetting.GetConfig("IsShowCheckedBackground", "False").ToString());
            GlobalSetting.IsShowCheckedBackground = !GlobalSetting.IsShowCheckedBackground;
            mnuMainCheckBackground_Click(null, EventArgs.Empty);

            //Recursive loading--------------------------------------------------------------
            GlobalSetting.IsRecursive = bool.Parse(GlobalSetting.GetConfig("Recursive", "False"));

            //Get welcome screen------------------------------------------------------------
            GlobalSetting.IsWelcomePicture = bool.Parse(GlobalSetting.GetConfig("Welcome", "True"));

            //Load default image------------------------------------------------------------
            string y = GlobalSetting.GetConfig("Welcome", "True");
            if (y.ToLower() == "true")
            {
                //Do not show welcome image if params exist.
                if(Environment.GetCommandLineArgs().Count() < 2)
                {
                    Prepare(GlobalSetting.StartUpDir + "default.png");
                }
            }

            //Load is loop back slideshow---------------------------------------------------
            GlobalSetting.IsLoopBackSlideShow = bool.Parse(GlobalSetting.GetConfig("IsLoopBackSlideShow", "True"));

            //Load IsPressESCToQuit---------------------------------------------------------
            GlobalSetting.IsPressESCToQuit = bool.Parse(GlobalSetting.GetConfig("IsPressESCToQuit", "True"));

            //Load image order config------------------------------------------------------
            GlobalSetting.LoadImageOrderConfig();

            //Load state of Image Booster --------------------------------------------------
            GlobalSetting.IsImageBoosterBack = bool.Parse(GlobalSetting.GetConfig("IsImageBoosterBack", "True"));

            //Load state of Toolbar---------------------------------------------------------
            GlobalSetting.IsShowToolBar = bool.Parse(GlobalSetting.GetConfig("IsShowToolBar", "True"));
            GlobalSetting.IsShowToolBar = !GlobalSetting.IsShowToolBar;
            mnuMainToolbar_Click(null, EventArgs.Empty);

            //Load Zoom to Fit value---------------------------------------------------------
            GlobalSetting.IsZoomToFit = bool.Parse(GlobalSetting.GetConfig("IsZoomToFit", "False"));
            mnuMainZoomToFit.Checked = GlobalSetting.IsZoomToFit;

            //Load Zoom lock value
            int zoomLock = int.Parse(GlobalSetting.GetConfig("ZoomLockValue", "-1"));
            GlobalSetting.IsEnabledZoomLock = zoomLock > 0 ? true : false;
            mnuMainLockZoomRatio.Checked = btnZoomLock.Checked = GlobalSetting.IsEnabledZoomLock;
            GlobalSetting.ZoomLockValue = zoomLock > 0 ? zoomLock : 100;

            //Zoom optimization method-------------------------------------------------------
            string z = GlobalSetting.GetConfig("ZoomOptimization", "0");
            if (z == "1")
            {
                GlobalSetting.ZoomOptimizationMethod = ZoomOptimizationValue.SmoothPixels;
            }
            else if (z == "2")
            {
                GlobalSetting.ZoomOptimizationMethod = ZoomOptimizationValue.ClearPixels;
            }
            else //auto
            {
                GlobalSetting.ZoomOptimizationMethod = ZoomOptimizationValue.Auto;
            }

            //Load theme--------------------------------------------------------------------
            thumbnailBar.SetRenderer(new ImageListView.ImageListViewRenderers.ThemeRenderer()); //ThumbnailBar Renderer must be done BEFORE loading theme
            LoadTheme();
            Application.DoEvents();

            //Load Thumbnail dimension
            if (int.TryParse(GlobalSetting.GetConfig("ThumbnailDimension", "48"), out i))
            {
                GlobalSetting.ThumbnailDimension = i;
            }
            else
            {
                GlobalSetting.ThumbnailDimension = 48;
            }

            //Load thumbnail bar width
            int tb_width = 0;
            if (!int.TryParse(GlobalSetting.GetConfig("ThumbnailBarWidth", "0"), out tb_width))
            {
                tb_width = 0;
            }

            //Get minimum width needed for thumbnail dimension
            var tb_minWidth = new ThumbnailItemInfo(GlobalSetting.ThumbnailDimension, true).TotalDimension;
            //Get the greater width value
            GlobalSetting.ThumbnailBarWidth = Math.Max(tb_width, tb_minWidth);

            thumbnailBar.ThumbnailSize = new Size(GlobalSetting.ThumbnailDimension + GlobalSetting.ThumbnailDimension / 3, GlobalSetting.ThumbnailDimension);

            //Load thumbnail orientation state: NOTE needs to be done BEFORE the mnuMainThumbnailBar_Click invocation below!
            GlobalSetting.IsThumbnailHorizontal = bool.Parse(GlobalSetting.GetConfig("IsThumbnailHorizontal", "True"));

            //Load state of Thumbnail---------------------------------------------------------
            GlobalSetting.IsShowThumbnail = bool.Parse(GlobalSetting.GetConfig("IsShowThumbnail", "False"));
            GlobalSetting.IsShowThumbnail = !GlobalSetting.IsShowThumbnail;
            mnuMainThumbnailBar_Click(null, EventArgs.Empty);

            //Load background---------------------------------------------------------------
            z = GlobalSetting.GetConfig("BackgroundColor", "-1");
            GlobalSetting.BackgroundColor = Color.FromArgb(int.Parse(z));
            picMain.BackColor = GlobalSetting.BackgroundColor;

            //Load state of IsWindowAlwaysOnTop value-----------------------------------------
            GlobalSetting.IsWindowAlwaysOnTop = bool.Parse(GlobalSetting.GetConfig("IsWindowAlwaysOnTop", "False"));
            TopMost = mnuMainAlwaysOnTop.Checked = GlobalSetting.IsWindowAlwaysOnTop;

            //Load state of IsMouseNavigation value-------------------------------------------
            GlobalSetting.IsMouseNavigation = bool.Parse(GlobalSetting.GetConfig("IsMouseNavigation", "False"));
            picMain.AllowZoom = !GlobalSetting.IsMouseNavigation;
        }
Пример #2
0
        private void mnuMainThumbnailBar_Click(object sender, EventArgs e)
        {
            GlobalSetting.IsShowThumbnail = !GlobalSetting.IsShowThumbnail;
            sp1.Panel2Collapsed = !GlobalSetting.IsShowThumbnail;
            btnThumb.Checked = GlobalSetting.IsShowThumbnail;

            if (GlobalSetting.IsShowThumbnail)
            {
                //show
                var tb = new ThumbnailItemInfo(GlobalSetting.ThumbnailDimension, GlobalSetting.IsThumbnailHorizontal);
                sp1.Panel2MinSize = tb.TotalDimension;

                if (GlobalSetting.IsThumbnailHorizontal)
                {
                    // BOTTOM
                    sp1.SplitterWidth = 1;
                    sp1.Orientation = Orientation.Horizontal;
                    sp1.SplitterDistance = sp1.Height - tb.TotalDimension;
                    thumbnailBar.View = ImageListView.View.Gallery;

                    //hide splitter color
                    sp1.BackColor = Color.White;
                }
                else
                {
                    // RIGHT
                    sp1.IsSplitterFixed = false; //Allow user to resize
                    sp1.SplitterWidth = 2;
                    sp1.Orientation = Orientation.Vertical;
                    sp1.SplitterDistance = sp1.Width - Math.Max(GlobalSetting.ThumbnailBarWidth, tb.TotalDimension);
                    thumbnailBar.View = ImageListView.View.Thumbnails;

                    //theme for splitter of horizontal bar
                    sp1.BackColor = thumbnailBar.BackColor;
                }
            }
            else
            {
                //Save thumbnail bar width when closing
                if (!GlobalSetting.IsThumbnailHorizontal)
                {
                    GlobalSetting.ThumbnailBarWidth = sp1.Width - sp1.SplitterDistance;
                }
            }
            mnuMainThumbnailBar.Checked = GlobalSetting.IsShowThumbnail;
            SelectCurrentThumbnail();
        }