Пример #1
0
 private void Generate(NewGroup group)
 {
     textWriter.Write("    ");
     Generate(group.Group);
     textWriter.Write(",");
     Generate(group.Parent);
     textWriter.Write(",");
     textWriter.Write(String.Format(CultureInfo.InvariantCulture, "0x{0:X3}", group.Priority));
     textWriter.WriteLine(";");
 }
Пример #2
0
        private void AddGroupPlacement(Button button, CommandID commandBar)
        {
            string key = button.Command.ToString() + commandBar.ToString();

            if (!placements.ContainsKey(key))
            {
                // Create or get the gruop associted with commandBar
                NewGroup     newGroup  = CreateNewGroup(commandBar.ToString(), button.Priority, commandBar);
                CMDPlacement placement = new CMDPlacement(button.Command, newGroup.Group, button.Priority);
                placements.Add(key, placement);
            }
        }
Пример #3
0
 private NewGroup CreateNewGroup(string groupName, int priority, CommandID parentCommand)
 {
     if (!newGroups.ContainsKey(groupName))
     {
         CommandID newGroupCommand = new CommandID(guidRecipeFrameworkPkgCmdSet, this.groupCounter++);
         NewGroup  myNewGroup      = new NewGroup(
             newGroupCommand,
             parentCommand,
             priority);
         newGroups.Add(groupName, myNewGroup);
     }
     return(newGroups[groupName]);
 }
Пример #4
0
        public CTCFile Create()
        {
            #region Standard group Init
            // Make sure to initialize the default groups
            this.packageGroup = this.PackageGroup;
            #endregion

            #region New Menu creation
            // Create the new menus first before creating any command
            BuildMenuGroups();
            #endregion

            #region Command creation
            // Templates commands must be created first than recipe commands
            // becuase a template can steal the command bars from the recipe it is related to
            BuildTemplateCommands();
            // Build recipes commands
            BuiltRecipeCommands();
            #endregion

            #region Build CTC Tree
            NewGroup[] newGroupsArray = new NewGroup[newGroups.Values.Count];
            newGroups.Values.CopyTo(newGroupsArray, 0);
            MenuGroup[] menuGroupsArray = new MenuGroup[menus.Values.Count];
            menus.Values.CopyTo(menuGroupsArray, 0);
            CMDPlacement[] placementsArray = new CMDPlacement[placements.Count];
            placements.Values.CopyTo(placementsArray, 0);
            Button[] buttonsArray = new Button[buttons.Count];
            buttons.CopyTo(buttonsArray);
            Visibility[] visibiltiesArray = new Visibility[visibilities.Count];
            visibilities.CopyTo(visibiltiesArray);
            CTCFile ctcFile = new CTCFile(
                new CMDSSection(guidRecipeFrameworkPkg,
                                new MenusSubSection(menuGroupsArray),
                                new NewGroupsSubSection(newGroupsArray),
                                new ButtonsSubSection(buttonsArray),
                                new BitmapsSubSection(new CTCBitmap[] { ctcBitmap })),
                new CMDUsedSection(),
                new CMDPlacementSection(placementsArray),
                new VisibilitySection(visibiltiesArray),
                new KeybindingsSection());
            return(ctcFile);

            #endregion
        }
Пример #5
0
 private MenuGroup AddMenuGroup(string menuName, string menuText, int priority, Configuration.CommandBar commandBar)
 {
     if (!menus.ContainsKey(menuName))
     {
         CommandID commandID      = GetCommandID(commandBar);
         NewGroup  newGroup       = CreateNewGroup(commandID.ToString(), priority, commandID);
         CommandID newMenuCommand = new CommandID(guidRecipeFrameworkPkgCmdSet, this.menuCounter++);
         MenuGroup myNewMenu      = new MenuGroup(
             newMenuCommand,
             newGroup.Group,
             priority,
             CommandType.MenuContext,
             menuName,
             menuText);
         menus.Add(menuName, myNewMenu);
     }
     return(menus[menuName]);
 }