Example #1
0
 public static void CreateGroupItems(ToolStripDropDownItem dropDownItem)
 {
     QTUtility.RefreshGroupsDic();
     if (QTUtility.GroupPathsDic.Count > 0)
     {
         dropDownItem.Enabled = true;
         DropDownMenuReorderable dropDown = (DropDownMenuReorderable)dropDownItem.DropDown;
         while (dropDown.Items.Count > 0)
         {
             dropDown.Items[0].Dispose();
         }
         dropDown.ItemsClear();
         string key = "groups";
         foreach (string str2 in QTUtility.GroupPathsDic.Keys)
         {
             string str3 = QTUtility.GroupPathsDic[str2];
             string path = str3.Split(QTUtility.SEPARATOR_CHAR)[0];
             if (str3.Length == 0)
             {
                 dropDown.AddItem(new ToolStripSeparator(), key);
             }
             else if (QTUtility2.PathExists(path))
             {
                 QMenuItem item = new QMenuItem(str2, MenuGenre.Group);
                 item.SetImageReservationKey(path, null);
                 dropDown.AddItem(item, key);
                 if (QTUtility.StartUpGroupList.Contains(str2))
                 {
                     if (QTUtility.StartUpTabFont == null)
                     {
                         QTUtility.StartUpTabFont = new Font(item.Font, FontStyle.Underline);
                     }
                     item.Font = QTUtility.StartUpTabFont;
                 }
             }
         }
     }
     else
     {
         dropDownItem.Enabled = false;
     }
 }
Example #2
0
        public static List <ToolStripItem> CreateGroupItems(ToolStripDropDownItem dropDownItem)
        {
            List <ToolStripItem>    ret      = new List <ToolStripItem>();
            DropDownMenuReorderable dropDown = null;

            if (dropDownItem != null)
            {
                dropDown = (DropDownMenuReorderable)dropDownItem.DropDown;
                while (dropDown.Items.Count > 0)
                {
                    dropDown.Items[0].Dispose();
                }
                dropDown.ItemsClear();
            }
            const string key = "groups";

            foreach (Group group in GroupsManager.Groups)
            {
                if (group.Paths.Count == 0 || !QTUtility2.PathExists(group.Paths[0]))
                {
                    continue;
                }
                QMenuItem item = new QMenuItem(group.Name, MenuGenre.Group);
                item.SetImageReservationKey(group.Paths[0], null);
                if (dropDown != null)
                {
                    dropDown.AddItem(item, key);
                }
                ret.Add(item);
                if (!group.Startup)
                {
                    continue;
                }
                if (StartUpTabFont == null)
                {
                    StartUpTabFont = new Font(item.Font, FontStyle.Underline);
                }
                item.Font = StartUpTabFont;
            }
            if (dropDownItem != null)
            {
                dropDownItem.Enabled = dropDown.Items.Count > 0;
            }
            return(ret);
        }