public Org(string directory) { // Initialization InitializeComponent(); KeyPreview = true; // Hotkeys Setup hotkeys = new Dictionary <Tuple <Keys, Modes>, HotkeysSettings>(); foreach (Keys key in DataExtensions.GetCommonKeysAndButtons()) { foreach (Modes mode in Enum.GetValues(typeof(Modes))) { hotkeys.Add(new Tuple <Keys, Modes>(key, mode), new HotkeysSettings(key)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control, mode), new HotkeysSettings(key | Keys.Control)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control | Keys.Shift, mode), new HotkeysSettings(key | Keys.Control | Keys.Shift)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control | Keys.Alt, mode), new HotkeysSettings(key | Keys.Control | Keys.Alt)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control | Keys.Shift | Keys.Alt, mode), new HotkeysSettings(key | Keys.Control | Keys.Shift | Keys.Alt)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Shift, mode), new HotkeysSettings(key | Keys.Shift)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Shift | Keys.Alt, mode), new HotkeysSettings(key | Keys.Shift | Keys.Alt)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Alt, mode), new HotkeysSettings(key | Keys.Alt)); } } undoHistory = new Stack <UndoActions>(); pictureBox.MouseWheel += PictureBox_MouseWheel; // PictureBox Context Menu Setup pictureBoxContextMenu = new ContextMenu(); pictureBoxContextMenu.MenuItems.Add("Randomize", PictureBoxContextMenu_Randomize_onClick); pictureBoxContextMenu.MenuItems.Add("Reference", PictureBoxContextMenu_Reference_onClick); pictureBox.ContextMenu = pictureBoxContextMenu; // TreeView Context Menu Setup treeViewContextMenu = new ContextMenu(); treeViewContextMenu.MenuItems.Add("Add to Favorites", TreeViewContextMenu_AddToFavorites_onClick); treeViewContextMenu.MenuItems.Add("Remove from Favorites", TreeViewContextMenu_RemoveFromFavorites_onClick); treeViewContextMenu.MenuItems.Add("Randomize", TreeViewContextMenu_Randomize_onClick); folderBrowser.ContextMenu = treeViewContextMenu; //Dialogs fullScreen = new FullScreen(pictureBox, this); settings = new Settings(this); // Mode Setup mode = Modes.Browse; browseToolStripMenuItem.Checked = true; browseToolStripMenuItem.Tag = Modes.Browse; organizeToolStripMenuItem.Tag = Modes.Organize; randomizeToolStripMenuItem.Tag = Modes.Randomize; // Load Images images = new Images(directory); // TreeView Setup folderBrowser.Nodes.Clear(); favorites = new TreeNode("Favorites") { Tag = "" }; folderBrowser.Nodes.Add(favorites); ListDirectory(folderBrowser); }
private void SetMode(Modes _mode) { UncheckMode(); mode = _mode; Controls.OfType <ToolStripMenuItem>().Where(menuItem => menuItem.Tag.Equals(_mode)).FirstOrDefault().Checked = true; }