Beispiel #1
0
 private void UpdateRecentPresets()
 {
     recentPresetsMenu.DropDownItems.Clear();
     if (recentPresets == null || recentPresets.Count == 0)
     {
         ToolStripItem noneMenuItem = new ToolStripMenuItem();
         noneMenuItem.Name    = "recentPresetsMenuNone";
         noneMenuItem.Size    = new System.Drawing.Size(186, 22);
         noneMenuItem.Text    = "None";
         noneMenuItem.Enabled = false;
         recentPresetsMenu.DropDownItems.Add(noneMenuItem);
     }
     else
     {
         foreach (FileNameFromPath recentPreset in recentPresets)
         {
             RecentFileToolStripItem recentMenuItem = new RecentFileToolStripItem();
             recentMenuItem.Name     = "recentPresetsRecent_" + recentPreset.Path;
             recentMenuItem.Size     = new System.Drawing.Size(186, 22);
             recentMenuItem.Text     = recentPreset.Name;
             recentMenuItem.Click   += recentPresetsMenu_Click;
             recentMenuItem.FilePath = recentPreset.Path;
             recentPresetsMenu.DropDownItems.Add(recentMenuItem);
         }
     }
 }
Beispiel #2
0
 private void recentPresetsMenu_Click(object sender, System.EventArgs e)
 {
     if (!CheckForNeededSave())
     {
         return;
     }
     if (sender is RecentFileToolStripItem)
     {
         RecentFileToolStripItem recentFileToolStripItem = (RecentFileToolStripItem)sender;
         LoadPreset(recentFileToolStripItem.FilePath);
     }
 }