Пример #1
0
 /// <summary>
 /// Display MRU item containers
 /// </summary>
 /// <param name="containers">MRU containers to display</param>
 public override void ShowMRUItems(List <MRUItemsContainer> containers)
 {
     if (ItemViews != null)
     {
         ItemViews.Clear();
     }
     ItemViews    = new List <IMRUItemView>();
     menuContents = new List <ToolStripItem>();
     containers.ForEach(container =>
     {
         MRUContainerToolStripSeparator separator = new MRUContainerToolStripSeparator();
         separator.Text = container.ContainerCaption;
         separator.SetTextPresentation(this.Font, new SolidBrush(Color.Gray));
         menuContents.Add(separator);
         container.Items.ToList().ForEach(item =>
         {
             var mruItemMenu = new MRUItemMenu();
             mruItemMenu.Initialize(item, localization.ItemLocalization);
             ItemViews.Add(mruItemMenu);
             menuContents.Add(mruItemMenu);
         });
     });
     if (containers.Count() > 0)
     {
         menuContents.Add(new ToolStripSeparator());
         menuContents.Add(CreateClearAllMenu());
     }
     AttachMenuItems();
 }
Пример #2
0
 private void AttachMenuItems()
 {
     if (menuItem == null)
     {
         return;
     }
     menuItem.DropDownItems.Clear();
     if (menuContents != null && menuContents.Count() > 0)
     {
         menuItem.Enabled = true;
         menuContents.ForEach(item =>
         {
             MRUItemMenu mruItem = item as MRUItemMenu;
             if (mruItem != null)
             {
                 mruItem.Appearance = menuItemAppearance;
             }
             menuItem.DropDownItems.Add(item);
         });
     }
     else
     {
         menuItem.Enabled = false;
     }
 }
Пример #3
0
 /// <summary>
 /// Display MRU item containers
 /// </summary>
 /// <param name="containers">MRU containers to display</param>
 public override void ShowMRUItems(List <MRUItemsContainer> containers)
 {
     if (ItemViews != null)
     {
         ItemViews.Clear();
     }
     ItemViews = new List <IMRUItemView>();
     containers.ForEach(container =>
     {
         container.Items.ToList().ForEach(item =>
         {
             var mruItemMenu = new MRUItemMenu();
             mruItemMenu.Initialize(item, localization.ItemLocalization);
             ItemViews.Add(mruItemMenu);
         });
     });
     AttachMenuItems();
 }