Exemplo n.º 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);
     }
 }
Exemplo n.º 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 < Globals.Settings.MaxRecentFiles)
             {
                 reopenMenu.DropDownItems.Add(item);
             }
             else
             {
                 Globals.PreviousDocuments.Remove(file);
             }
         }
         if (Globals.PreviousDocuments.Count > 0)
         {
             String cleanLabel = TextHelper.GetString("Label.CleanReopenList");
             String clearLabel = TextHelper.GetString("Label.ClearReopenList");
             reopenMenu.DropDownItems.Add(new ToolStripSeparator());
             reopenMenu.DropDownItems.Add(new ToolStripMenuItem(cleanLabel, null, new EventHandler(Globals.MainForm.CleanReopenList)));
             reopenMenu.DropDownItems.Add(new ToolStripMenuItem(clearLabel, null, new EventHandler(Globals.MainForm.ClearReopenList)));
             reopenMenu.Enabled = true;
         }
         else
         {
             reopenMenu.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }