Пример #1
0
        /// <summary>
        /// Gets all files in a directory with the given extensions
        /// </summary>
        private void setFileInfo()
        {
            Properties.Settings.Default.folderpath = this.folderpath;
            Properties.Settings.Default.Save();

            if (folderpath != "" && Directory.Exists(folderpath))
            {
                di = new DirectoryInfo(folderpath);
                fi = new List <FileInfo>();

                foreach (string s in ext)
                {
                    fi.AddRange(di.EnumerateFiles(s, so).ToList());
                }

                MyExtensions.Shuffle(fi, rng);
                pos = -1;

                toolsToolStripMenuItem.Enabled     = true;
                lastImageToolStripMenuItem.Enabled = true;
                nextImageToolStripMenuItem.Enabled = true;
                toolStripMenuItem1.Enabled         = true;
            }
            else
            {
                di = null;
                fi = null;

                toolsToolStripMenuItem.Enabled     = false;
                lastImageToolStripMenuItem.Enabled = false;
                nextImageToolStripMenuItem.Enabled = false;
                toolStripMenuItem1.Enabled         = false;
            }
        }
Пример #2
0
        /// <summary>
        /// Toggles whether or not the favorites are being viewed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void favoritesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem _sender = (ToolStripMenuItem)sender;

            if (!(_sender.Checked))
            {
                setFileInfo();
            }
            else
            {
                fi = new List <FileInfo>();
                foreach (string s in favorites)
                {
                    FileInfo f = new FileInfo(s);
                    fi.Add(f);
                }
                MyExtensions.Shuffle(fi, rng);
            }

            pos = -1;
            doit();
        }