コード例 #1
0
 /// <summary>
 /// Adds a new menu item to the reopen menu
 /// </summary>
 public static void AddNewReopenMenuItem(String file)
 {
     try
     {
         ToolStripMenuItem reopenMenu = (ToolStripMenuItem)StripBarManager.FindMenuItem("ReopenMenu");
         if (Globals.PreviousDocuments.Contains(file))
         {
             Globals.PreviousDocuments.Remove(file);
         }
         Globals.PreviousDocuments.Insert(0, file);
         PopulateReopenMenu();
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
コード例 #2
0
 /// <summary>
 /// Populates the reopen menu from the documents class
 /// </summary>
 public static void PopulateReopenMenu()
 {
     try
     {
         ToolStripMenuItem reopenMenu = (ToolStripMenuItem)StripBarManager.FindMenuItem("ReopenMenu");
         reopenMenu.DropDownItems.Clear();
         for (Int32 i = 0; i < Globals.PreviousDocuments.Count; i++)
         {
             String            file = Globals.PreviousDocuments[i];
             ToolStripMenuItem item = new ToolStripMenuItem();
             item.Click += new EventHandler(Globals.MainForm.Reopen);
             item.Tag    = file; item.Text = PathHelper.GetCompactPath(file);
             if (i < 15)
             {
                 reopenMenu.DropDownItems.Add(item);
             }
             else
             {
                 Globals.PreviousDocuments.Remove(file);
             }
         }
         if (Globals.PreviousDocuments.Count > 0)
         {
             String label = TextHelper.GetString("Label.ClearReopenList");
             reopenMenu.DropDownItems.Add(new ToolStripSeparator());
             reopenMenu.DropDownItems.Add(new ToolStripMenuItem(label, null, new EventHandler(Globals.MainForm.ClearReopenList)));
             reopenMenu.Enabled = true;
         }
         else
         {
             reopenMenu.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }