示例#1
0
        public void AddRibbonBarButtons(RibbonBarBuilder builder)
        {
            RibbonBarController = builder.Controller;

            var addVPButton = builder.CreateButton()
                              .SetText("Add Virtual Property")
                              .SetIsEnabledHandler(CanAddNewVirtualProperty)
                              .SetToolTip("Add New Virtual Property to Type")
                              .AddClickEventHandler(AddNewVirtualProperty_Clicked);

            var removeVPButton = builder.CreateButton()
                                 .SetText("Remove Virtual Property")
                                 .SetIsEnabledHandler(CanRemoveVirtualProperty)
                                 .SetToolTip("Deletes the Virtual Property from the Project")
                                 .AddClickEventHandler(RemoveVirtualProperty_Clicked);

            var vpBar = builder.CreateBar()
                        .SetName("Virtual Properties")
                        .SetOrientation(Orientation.Horizontal)
                        .AddButton(addVPButton)
                        .AddButton(removeVPButton);

            builder.AddRibbonBar(vpBar);

            var bar = builder.CreateBar()
                      .SetName("Extension Actions");

            var addLoadFunctionButton = builder.CreateButton()
                                        .SetText("Add OnLoad Action")
                                        .AddClickEventHandler(buttonAddLoadFunction_Click)
                                        .SetIsEnabledHandler(CanAddLoadFunction);

            var addNewProjectScreensFunctionButton = builder.CreateButton()
                                                     .SetText("Add New Project Screens Action")
                                                     .AddClickEventHandler(buttonAddProjectScreensFunction_Click)
                                                     .SetIsEnabledHandler(CanAddProjectScreensFunction);

            var addPreGenerationFunctionButton = builder.CreateButton()
                                                 .SetText("Add Pre Generation Action")
                                                 .AddClickEventHandler(buttonAddPreGenerationFunction_Click)
                                                 .SetIsEnabledHandler(CanAddPreGenerationFunction);

            bar.AddButton(addLoadFunctionButton);
            bar.AddButton(addNewProjectScreensFunctionButton);
            bar.AddButton(addPreGenerationFunctionButton);
            builder.AddRibbonBar(bar);
        }
示例#2
0
        public void ProcessRibbonBarButtons(RibbonBarContentItem item, RibbonPanel panel)
        {
            if (item == null)
            {
                return;
            }

            RibbonBarBuilder builder = new RibbonBarBuilder(this);

            item.AddRibbonBarButtons(builder);

            Builders.Add(item, builder);

            foreach (RibbonBar obj in builder.RibbonBars)
            {
                var group = ProcessGroup(obj);
                panel.Controls.Add(group);
            }
        }