コード例 #1
0
        /// <summary>
        /// Refresh the current list of pics and reload them if there is some missing or changes.
        /// </summary>
        internal static void Reload(bool fromBackup = false)
        {
            if (fromBackup && string.IsNullOrWhiteSpace(xPicPath))
            {
                Unload();
                return;
            }

            var x = fromBackup ? xPicPath : Pics[FolderIndex];

            if (File.Exists(x))
            {
                // Force reloading values by setting freshStartup to true
                freshStartup = true;

                // Clear Preloader, to avoid errors by FolderIndex changing location because of re-sorting
                Preloader.Clear();

                // Need a sort method instead
                PicGalleryLogic.Clear();
                PicGalleryLoad.Load();

                Pic(x);

                // Reset
                if (isZoomed)
                {
                    ResetZoom();
                }

                if (Flipped)
                {
                    Flip();
                }

                if (Rotateint != 0)
                {
                    Rotate(0);
                }
            }
            else
            {
                Unload();
                ToolTipStyle("Unknown error occured");
            }
        }
コード例 #2
0
        /// <summary>
        /// Clears data, to free objects no longer necessary to store in memory and allow changing folder without error.
        /// </summary>
        internal static void ChangeFolder(bool backup = false)
        {
            if (backup)
            {
                // Make a backup of xPicPath and FolderIndex
                if (!string.IsNullOrWhiteSpace(Pics[FolderIndex]))
                {
                    xPicPath = Pics[FolderIndex];
                }
            }

            Pics.Clear();
            Preloader.Clear();
            DeleteTempFiles();
            PreloadCount = 0;
            freshStartup = true;

            if (Properties.Settings.Default.PicGallery > 0)
            {
                PicGalleryLogic.Clear();
            }
        }