コード例 #1
0
        public void Remove(ICommandBar commandBar)
        {
//			CommandBar cb = commandBar as CommandBar;
//			if (cb == null) return;
//			owner.toolManager.RemoveToolbar(cb.decoratedItem);
//			owner.toolContainer.Controls.Remove(cb.decoratedItem);
        }
コード例 #2
0
        public static void CreateDebugMenu(ICommandBar menuBar, IServices services)
        {
            if (!DebugCommands.IsDebugMenuEnabled())
            {
                return;
            }
            ICommandBarMenu commandBarMenu1 = menuBar.Items.AddMenu("Debug", "Debug");

            commandBarMenu1.Items.AddButton("Debug_FocusTracker", "Focus Tracker");
            commandBarMenu1.Items.AddButton("Debug_DisplayTimingInformation", "Display Timing");
            commandBarMenu1.Items.AddButton("Debug_GarbageCollect", "Force GC");
            commandBarMenu1.Items.AddButton("Debug_UndoManager_Dump", "Dump UndoService");
            commandBarMenu1.Items.AddButton("Debug_UndoManager_Clear", "Clear UndoService");
            ICommandBarMenu commandBarMenu2 = commandBarMenu1.Items.AddMenu("Scene", "Scene");

            commandBarMenu2.Items.AddButton("Debug_CreateDocumentNodeView", "Create DocumentNode View");
            commandBarMenu2.Items.AddButton("Debug_DumpInstanceDictionary", "Dump InstanceDictionary");
            commandBarMenu2.Items.AddButton("Debug_DumpViewNodeTree", "Dump View Node Tree");
            commandBarMenu1.Items.AddMenu("Tree", "Tree");
            if (!(services.GetService <ISourceControlService>() is SourceControlService))
            {
                return;
            }
            commandBarMenu1.Items.AddMenu("TFS", "TFS");
        }
コード例 #3
0
 public static void RemoveLastSeparatorIfNeeded(ICommandBar contextMenu)
 {
     while (contextMenu.Items.Count > 0 && contextMenu.Items[contextMenu.Items.Count - 1] is ICommandBarSeparator)
     {
         contextMenu.Items.RemoveAt(contextMenu.Items.Count - 1);
     }
 }
コード例 #4
0
 private void DumpCommandBar(ICommandBar commandBar, int indent)
 {
     for (int i = 0; i < indent; ++i)
     {
         System.Diagnostics.Debug.Write("\t");
     }
     System.Diagnostics.Debug.WriteLine(commandBar.Identifier);
     ++indent;
     foreach (ICommandBarItem childItem in commandBar.Items)
     {
         ICommandBarControl control;
         ICommandBarMenu    menu;
         if (null != (control = childItem as ICommandBarControl))
         {
             for (int i = 0; i < indent; ++i)
             {
                 System.Diagnostics.Debug.Write("\t");
             }
             System.Diagnostics.Debug.WriteLine(control.Value);
         }
         else if (null != (menu = childItem as ICommandBarMenu))
         {
             DumpCommandBar(menu, indent);
         }
     }
 }
コード例 #5
0
        public bool Contains(ICommandBar commandBar)
        {
//			CommandBar cb = commandBar as CommandBar;
//			if (cb != null)
//				return owner.toolManager.FindToolbar(cb.decoratedItem.Guid) != null;
            return(false);
        }
コード例 #6
0
 public override ICommandBar GetContextMenu(ICommandBarCollection commandBarCollection)
 {
     if (this.IsUIBlockingFolder)
     {
         return(null);
     }
     if (base.Services.ProjectManager().CurrentSolution != null && base.Services.ProjectManager().CurrentSolution.IsSourceControlActive)
     {
         FolderProjectItem.DestroyContextMenu();
     }
     if (FolderProjectItem.contextMenu == null)
     {
         FolderProjectItem.contextMenu = commandBarCollection.AddContextMenu("Project_FolderProjectItemContextMenu");
         FolderProjectItem.contextMenu.Items.AddButton("Application_AddNewItem", StringTable.ProjectItemContextMenuAddNewItem);
         FolderProjectItem.contextMenu.Items.AddButton("Project_AddExistingItem", StringTable.ProjectItemContextMenuAddExistingItem);
         FolderProjectItem.contextMenu.Items.AddButton("Project_LinkToExistingItem", StringTable.ProjectItemContextMenuLinkToExistingItem);
         FolderProjectItem.contextMenu.Items.AddSeparator();
         ProjectManager.AddSourceControlMenuItems(FolderProjectItem.contextMenu.Items);
         FolderProjectItem.contextMenu.Items.AddSeparator();
         FolderProjectItem.contextMenu.Items.AddButton("Project_NewFolder", StringTable.ProjectItemContextMenuNewFolder);
         FolderProjectItem.contextMenu.Items.AddButton("Project_Refresh", StringTable.ProjectItemContextMenuRefresh);
         FolderProjectItem.contextMenu.Items.AddSeparator();
         FolderProjectItem.contextMenu.Items.AddButton("Project_Cut", StringTable.ProjectItemContextMenuCut);
         FolderProjectItem.contextMenu.Items.AddButton("Project_Copy", StringTable.ProjectItemContextMenuCopy);
         FolderProjectItem.contextMenu.Items.AddButton("Project_Paste", StringTable.ProjectItemContextMenuPaste);
         FolderProjectItem.contextMenu.Items.AddButton("Project_RenameProjectItem", StringTable.ProjectItemContextMenuRename);
         FolderProjectItem.contextMenu.Items.AddSeparator();
         FolderProjectItem.contextMenu.Items.AddButton("Project_DeleteProjectItem", StringTable.ProjectItemContextMenuDelete);
         FolderProjectItem.contextMenu.Items.AddSeparator();
         FolderProjectItem.contextMenu.Items.AddButton("Project_ExploreProject", StringTable.ProjectItemContextMenuExplore);
     }
     return(FolderProjectItem.contextMenu);
 }
コード例 #7
0
        private void AddMenu()
        {
            ICommandBar mainMenuBar = GetMainBar();

            if (mainMenuBar == null)
            {
                return;
            }

            string       menuID  = "BathymetryTools";
            ICommandItem cmdItem = mainMenuBar.Find(menuID, false);

            if (cmdItem != null)
            {
                return;
            }

            UID uid = new UID();

            uid.Value = menuID;
            Object       index          = mainMenuBar.Count - 1;
            ICommandBar  menuBathymetry = mainMenuBar.Add(uid, index) as ICommandBar;
            ICommandItem main           = mainMenuBar as ICommandItem;

            main.Refresh();
        }
コード例 #8
0
ファイル: ProjectItemBase.cs プロジェクト: radtek/Shopdrawing
 public virtual ICommandBar GetContextMenu(ICommandBarCollection commandBarCollection)
 {
     if (ProjectItemBase.contextMenu == null)
     {
         ProjectItemBase.contextMenu = commandBarCollection.AddContextMenu("Project_ProjectItemContextMenu");
         ProjectItemBase.contextMenu.Items.AddCheckBox("Project_SetStartupScene", StringTable.ProjectItemContextMenuStartupScene);
         ProjectItemBase.contextMenu.Items.AddButton("Project_OpenView", StringTable.ProjectItemContextMenuOpen);
         ProjectItemBase.contextMenu.Items.AddButton("Project_InsertIntoActiveDocument", StringTable.ProjectItemContextMenuInsert);
         ProjectItemBase.contextMenu.Items.AddButton("Project_EditExternally", StringTable.ProjectItemContextMenuEditExternally);
         ProjectItemBase.contextMenu.Items.AddButton("Project_EditVisualStudio", StringTable.ProjectItemContextMenuEditVisualStudio);
         ProjectItemBase.contextMenu.Items.AddSeparator();
         ProjectManager.AddSourceControlMenuItems(ProjectItemBase.contextMenu.Items);
         ProjectItemBase.contextMenu.Items.AddSeparator();
         ProjectItemBase.contextMenu.Items.AddButton("Project_Cut", StringTable.ProjectItemContextMenuCut);
         ProjectItemBase.contextMenu.Items.AddButton("Project_Copy", StringTable.ProjectItemContextMenuCopy);
         ProjectItemBase.contextMenu.Items.AddButton("Project_RenameProjectItem", StringTable.ProjectItemContextMenuRename);
         ProjectItemBase.contextMenu.Items.AddSeparator();
         ProjectItemBase.contextMenu.Items.AddButton("Project_DeleteProjectItem", StringTable.ProjectItemContextMenuDelete);
         ProjectItemBase.contextMenu.Items.AddButton("Project_RemoveProjectItem", StringTable.ProjectItemContextMenuRemove);
         ProjectItemBase.contextMenu.Items.AddSeparator();
         ProjectItemBase.contextMenu.Items.AddButton("Project_ExploreProject", StringTable.ProjectItemContextMenuExplore);
         if (this.serviceProvider.CommandService().Commands.Contains("SketchFlow_MakeIntoNavigationScreen"))
         {
             ProjectItemBase.contextMenu.Items.AddSeparator();
             ProjectItemBase.contextMenu.Items.AddButton("SketchFlow_MakeIntoNavigationScreen");
             ProjectItemBase.contextMenu.Items.AddButton("SketchFlow_MakeIntoCompositionScreen");
         }
     }
     return(ProjectItemBase.contextMenu);
 }
コード例 #9
0
        private void FindGUIDOfCommandItem(IApplication TheApplication, string ParentMenuGUID)
        {
            if (ParentMenuGUID.Trim() == "")
            {
                return;
            }

            //Assign the UID for the menu we want to add the custom button to
            UID MenuUID = new UIDClass();

            MenuUID.Value = ParentMenuGUID;
            //Get the target menu as a ICommandBar
            ICommandBar pCmdBar = TheApplication.Document.CommandBars.Find(MenuUID) as ICommandBar;

            IToolBarDef pToolBarDef = pCmdBar as IToolBarDef;

            int iCnt = pCmdBar.Count;

            for (int i = 0; i < iCnt; i++)
            {
                //ScrapClass itemdef = new ScrapClass();
                //try{pToolBarDef.GetItemInfo(i, itemdef);} catch { continue; }
                ////print the UID of commandItem
                //Debug.Print(itemdef.ID.ToString());
                //UID uid = new UIDClass();
                //uid.Value = itemdef.ID.ToString();
                ICommandItem commandItem = pCmdBar.Find("GxCadastralFabricContextMenu");
                Debug.Print(": " + commandItem.Name);
            }
        }
コード例 #10
0
        protected override ContextMenu BuildContextMenu()
        {
            SceneViewModel viewModel  = this.ActionNode.ViewModel;
            ICommandBar    commandBar = viewModel.DesignerContext.CommandBarService.CommandBars.AddContextMenu("Designer_SceneContextMenu");

            commandBar.Items.AddButton("Edit_Cut", StringTable.ElementContextMenuCut);
            commandBar.Items.AddButton("Edit_Copy", StringTable.ElementContextMenuCopy);
            commandBar.Items.AddButton("Edit_Paste", StringTable.ElementContextMenuPaste);
            commandBar.Items.AddButton("Edit_Delete", StringTable.ElementContextMenuDelete);
            MenuItem menuItem = new MenuItem();

            menuItem.Command = this.RenameCommand;
            if (menuItem.Command == null)
            {
                menuItem.IsEnabled = false;
            }
            menuItem.Header = (object)StringTable.TimelineRenameMenuItemTitle;
            menuItem.Name   = "Edit_Rename";
            menuItem.SetValue(AutomationElement.IdProperty, (object)"Edit_Rename");
            ((ItemsControl)commandBar).Items.Add((object)menuItem);
            if (viewModel.DefaultView.ViewMode == ViewMode.Design)
            {
                commandBar.Items.AddSeparator();
                commandBar.Items.AddButton("View_GoToXaml", StringTable.ViewXamlCommandName);
            }
            return((ContextMenu)commandBar);
        }
コード例 #11
0
        void IPackage.Load(IServiceProvider serviceProvider)
        {
            // Set this early so it is easily referenced
            myServiceProvider = serviceProvider;

            IAssemblyBrowser assemblyBrowser = (IAssemblyBrowser)serviceProvider.GetService(typeof(IAssemblyBrowser));

            assemblyBrowser.ActiveItemChanged += new EventHandler(OnActiveItemChanged);
            myLastActiveItem  = assemblyBrowser.ActiveItem;
            myAssemblyBrowser = assemblyBrowser;
            ILanguageManager languageManager = (ILanguageManager)serviceProvider.GetService(typeof(ILanguageManager));

            myLanguageManager = languageManager;
            myConfiguration   = new PLiXConfiguration(this);
            languageManager.ActiveLanguageChanged += new EventHandler(OnActiveLanguageChanged);
            ILanguage language = new PLiXLanguage((ITranslatorManager)serviceProvider.GetService(typeof(ITranslatorManager)), myConfiguration);

            languageManager.RegisterLanguage(language);
            myLanguage = language;

            // Add our PLiX menu item, activated when the plix language is active
            ICommandBarManager commandBarManager = (ICommandBarManager)serviceProvider.GetService(typeof(ICommandBarManager));
            ICommandBar        menuBar           = commandBarManager.CommandBars["MenuBar"];
            ICommandBarMenu    topMenu           = menuBar.Items.InsertMenu(menuBar.Items.Count - 1, "PLiXLanguageOptions", "PLi&X");

            topMenu.Visible   = false;
            topMenu.DropDown += new EventHandler(OnOpenTopMenu);

            ICommandBarItemCollection menuItems = topMenu.Items;

            myExampleLanguageMenu = menuItems.AddMenu("PLiXExampleLanguage", "&Example Language");
            menuItems.AddSeparator();
            myExpandCurrentNamespaceDeclarationButton = menuItems.AddButton("E&xpand Current Namespace Declaration", new EventHandler(OnExpandCurrentNamespaceDeclaration));
            myExpandCurrentTypeDeclarationButton      = menuItems.AddButton("E&xpand Current Type Declaration", new EventHandler(OnExpandCurrentTypeDeclaration));
            (myFullyExpandTypeDeclarationsCheckBox = menuItems.AddCheckBox("Ex&pand All Type Declarations")).Click += new EventHandler(OnFullyExpandTypeDeclarationsChanged);
            menuItems.AddSeparator();
            (myDisplayContextDataTypeQualifierCheckBox = menuItems.AddCheckBox("Display Context Type &Qualifier")).Click += new EventHandler(OnDisplayContextDataTypeQualifierChanged);
            ICommandBarMenu callStaticOptionsMenu = menuItems.AddMenu("PLiXStaticCallOptions", "&Static Call Options");

            menuItems = callStaticOptionsMenu.Items;
            (myExplicitStaticCallCheckBox = menuItems.AddCheckBox("&Explicit")).Click += new EventHandler(OnExplicitStaticCallCheckBoxChanged);
            (myImplicitCurrentTypeStaticCallCheckBox = menuItems.AddCheckBox("Implicit (&Current Type)")).Click += new EventHandler(OnImplicitCurrentTypeStaticCallCheckBoxChanged);
            (myImplicitBaseTypesStaticCallCheckBox = menuItems.AddCheckBox("Implicit (&Base Types)")).Click     += new EventHandler(OnImplicitBaseTypesStaticCallCheckBoxChanged);
            myTopMenu = topMenu;

            ICommandBarControl appRefresh1 = GetCommandbarControl(commandBarManager, "ToolBar", "Application.Refresh");

            if (appRefresh1 != null)
            {
                appRefresh1.Click += new EventHandler(OnApplicationRefresh);
            }
            ICommandBarControl appRefresh2 = GetCommandbarControl(commandBarManager, "View", "Application.Refresh");

            if (appRefresh2 != null && appRefresh2 != appRefresh1)
            {
                appRefresh2.Click += new EventHandler(OnApplicationRefresh);
            }
            //DumpMenus(commandBarManager);
        }
コード例 #12
0
 public static void AddSeparator(ICommandBar contextMenu)
 {
     if (contextMenu.Items.Count == 0 || contextMenu.Items[contextMenu.Items.Count - 1] is ICommandBarSeparator)
     {
         return;
     }
     contextMenu.Items.AddSeparator();
 }
コード例 #13
0
 public void RemoveCommandBar()
 {
     Logger.Debug("Removing commandbar.");
     RemoveChildren();
     Item?.Delete();
     Item   = null;
     Parent = null;
 }
コード例 #14
0
 public override ICommandBar GetContextMenu(ICommandBarCollection commandBarCollection)
 {
     if (AssemblyReferenceProjectItem.contextMenu == null)
     {
         AssemblyReferenceProjectItem.contextMenu = commandBarCollection.AddContextMenu("Project_FolderStandinContextMenu");
         AssemblyReferenceProjectItem.contextMenu.Items.AddButton("Project_RemoveProjectItem", StringTable.ProjectItemContextMenuRemove);
     }
     return(AssemblyReferenceProjectItem.contextMenu);
 }
コード例 #15
0
ファイル: CommandBarExtensions.cs プロジェクト: wey12138/Wave
        /// <summary>
        ///     Replaces the <paramref name="oldCommandUid" /> on the toolbar with the <paramref name="newCommandUid" />
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="toolbarUid">The toolbar uid.</param>
        /// <param name="newCommandUid">The new command uid.</param>
        /// <param name="oldCommandUid">The old command uid.</param>
        public static void Replace(this ICommandBars source, UID toolbarUid, UID newCommandUid, UID oldCommandUid)
        {
            ICommandBar toolbar = source.Find(toolbarUid) as ICommandBar;

            if (toolbar != null)
            {
                toolbar.Replace(newCommandUid, oldCommandUid);
            }
        }
コード例 #16
0
ファイル: CommandBarExtensions.cs プロジェクト: wey12138/Wave
        /// <summary>
        ///     Adds the command to the <paramref name="toolbarUid" />
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="toolbarUid">The toolbar uid.</param>
        /// <param name="commandUid">The command uid.</param>
        public static void Add(this ICommandBars source, UID toolbarUid, UID commandUid)
        {
            ICommandBar toolbar = source.Find(toolbarUid) as ICommandBar;

            if (toolbar != null)
            {
                toolbar.Add(commandUid);
            }
        }
コード例 #17
0
ファイル: FolderStandIn.cs プロジェクト: radtek/Shopdrawing
 public override ICommandBar GetContextMenu(ICommandBarCollection commandBarCollection)
 {
     if (FolderStandIn.contextMenu == null)
     {
         FolderStandIn.contextMenu = commandBarCollection.AddContextMenu("Project_FolderStandinContextMenu");
         FolderStandIn.contextMenu.Items.AddButton("Project_AddReference", StringTable.ProjectItemContextMenuAddReference);
         FolderStandIn.contextMenu.Items.AddDynamicMenu("Project_AddProjectReference", StringTable.ProjectItemContextMenuAddProjectReference);
     }
     return(FolderStandIn.contextMenu);
 }
コード例 #18
0
        /// <summary>
        /// Registers our commands with Reflector.
        /// </summary>
        private void RegisterCommands()
        {
            ICommandBarManager commandBarMgr = ServiceProvider.GetService(typeof(ICommandBarManager)) as ICommandBarManager;

            if (commandBarMgr != null)
            {
                ICommandBar defaultBrowserContextMenu = commandBarMgr.CommandBars["Browser.Assembly"];
                MainCommand = defaultBrowserContextMenu.Items.AddButton(Resources.ShowBizTalkArtifacts, new EventHandler(ShowBizTalkArtifacts_ButtonClick));
            }
        }
        private void lstPendingMessage_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && lstPendingMessage.ContextMenuStrip == null)
            {
                //Before showing the context menu, set ContextItem to be the actual dockable window
                //which represents this definition class in the framework
                IDocument doc = m_application.Document;
                IDockableWindowManager windowManager = m_application as IDockableWindowManager;
                UID dockwinID = new UIDClass();
                dockwinID.Value = this.GetType().GUID.ToString("B");
                IDockableWindow frameworkWindow = windowManager.GetDockableWindow(dockwinID);
                if (doc is IBasicDocument) //ArcMap, ArcScene and ArcGlobe
                {
                    ((IBasicDocument)doc).ContextItem = frameworkWindow;
                }

                //Get the context menu to show
                ICommandBars documentBars = m_application.Document.CommandBars;
                ICommandBar  ctxMenu      = null;
                if (radDynamic.Checked) //Create context menu dynamically
                {
                    //Disadvantage(s):
                    //1. ICommandBars.Create will set document to dirty
                    //2. Cannot insert separator
                    ctxMenu = documentBars.Create("DockableWindowCtxTemp", esriCmdBarType.esriCmdBarTypeShortcutMenu); //This sets document flag to dirty :(

                    //Add commands to context menu
                    UID    cmdID = new UIDClass();
                    object idx   = Type.Missing;

                    cmdID.Value = "{b5820a63-e3d4-42a1-91c5-d90eacc3985b}"; //ClearLoggingCommand
                    ctxMenu.Add(cmdID, ref idx);

                    cmdID.Value = "{21532172-bc21-43eb-a2ad-bb6c333eff5e}"; //LogLineMultiItemCmd
                    ctxMenu.Add(cmdID, ref idx);
                }
                else    //Use predefined context menu
                {
                    UID menuID = new UIDClass();
                    menuID.Value = "{c6238198-5a2a-4fe8-bff0-e2f574f6a6cf}"; //LoggingWindowCtxMnu
                    ICommandItem locateMenu = documentBars.Find(menuID, false, false);
                    if (locateMenu != null)
                    {
                        ctxMenu = locateMenu as ICommandBar;
                    }
                }

                //Pop up context menu at screen location
                Point scrnPoint = lstPendingMessage.PointToScreen(e.Location);
                if (ctxMenu != null)
                {
                    ctxMenu.Popup(scrnPoint.X, scrnPoint.Y);
                }
            }
        }
コード例 #20
0
ファイル: CommandBarExtensions.cs プロジェクト: wey12138/Wave
 /// <summary>
 ///     Adds the command to the source.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="commandUid">The command uid.</param>
 public static void Add(this ICommandBar source, UID commandUid)
 {
     if (source != null)
     {
         ICommandItem command = source.Find(commandUid);
         if (command == null)
         {
             source.Add(commandUid);
         }
     }
 }
コード例 #21
0
 public bool RequestMove(ICommandBar sender, Size offset)
 {
     if (_site != null)
     {
         return(_site.RequestMove(sender, offset));
     }
     else
     {
         return(false);
     }
 }
コード例 #22
0
 public bool RequestSize(ICommandBar sender, Size difference)
 {
     if (_site != null)
     {
         return(_site.RequestSize(sender, difference));
     }
     else
     {
         return(false);
     }
 }
コード例 #23
0
        protected UIContext(ICommandBar bar, Func <ICommandBarItem> itembuilder, Image image = null)
        {
            Item = itembuilder();
            if (image != null)
            {
                Item.Image = image;
            }

            Bar = bar;

            InstanceCount++;
        }
コード例 #24
0
 public AppTaskbarIconHandler(
     IFilesetService filesetService,
     IFileReplicationService replicationService,
     IEventAggregator eventAggregator)
 {
     _filesetService = filesetService;
     _replicationService = replicationService;
     _eventAggregator = eventAggregator;
     _commandBar = new CommandBar();
     _lastActiveFilesets = new ObservableCollection<Fileset>();
     _taskbarIcon = Application.Current.TryFindResource("App_TaskbarIcon") as TaskbarIcon;
 }
コード例 #25
0
 public bool PerformLayout(ICommandBar sender)
 {
     if ((_site != null) && (_site.PerformLayout(sender)))
     {
         PerformLayout();                 // Call the base function
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #26
0
 public AppTaskbarIconHandler(
     IFilesetService filesetService,
     IFileReplicationService replicationService,
     IEventAggregator eventAggregator)
 {
     _filesetService     = filesetService;
     _replicationService = replicationService;
     _eventAggregator    = eventAggregator;
     _commandBar         = new CommandBar();
     _lastActiveFilesets = new ObservableCollection <Fileset>();
     _taskbarIcon        = Application.Current.TryFindResource("App_TaskbarIcon") as TaskbarIcon;
 }
コード例 #27
0
        private void AddCommandToApplicationMenu(IApplication TheApplication, string AddThisCommandGUID,
                                                 string ToThisMenuGUID, bool StartGroup, string PositionAfterThisCommandGUID, string PositionBeforeThisCommandGUID, bool EndGroup)
        {
            if (AddThisCommandGUID.Trim() == "")
            {
                return;
            }

            if (ToThisMenuGUID.Trim() == "")
            {
                return;
            }

            //Then add items to the command bar:
            UID pCommandUID = new UIDClass();       // this references an ICommand from my extension

            pCommandUID.Value = AddThisCommandGUID; // the ICommand to add

            //Assign the UID for the menu we want to add the custom button to
            UID MenuUID = new UIDClass();

            MenuUID.Value = ToThisMenuGUID;
            //Get the target menu as a ICommandBar
            ICommandBar pCmdBar = TheApplication.Document.CommandBars.Find(MenuUID) as ICommandBar;

            int iPos = pCmdBar.Count;

            //for the position string, if it's an empty string then default to end of menu.
            if (PositionAfterThisCommandGUID.Trim() != "")
            {
                UID pPositionCommandUID = new UIDClass();
                pPositionCommandUID.Value = PositionAfterThisCommandGUID;
                iPos = pCmdBar.Find(pPositionCommandUID).Index + 1;
            }

            if (iPos == pCmdBar.Count && PositionBeforeThisCommandGUID.Trim() != "") //prioritize the "after" case
            {
                UID pPositionCommandUID = new UIDClass();
                pPositionCommandUID.Value = PositionBeforeThisCommandGUID;
                iPos = pCmdBar.Find(pPositionCommandUID).Index;
            }

            ICommandItem pCmdItem = pCmdBar.Find(pCommandUID);

            //Check if it is already present on the context menu...
            if (pCmdItem == null)
            {
                pCmdItem       = pCmdBar.Add(pCommandUID, iPos);
                pCmdItem.Group = StartGroup;
                pCmdItem.Refresh();
            }
        }
コード例 #28
0
        public override void AddCustomContextMenuCommands(ICommandBar contextMenu)
        {
            base.AddCustomContextMenuCommands(contextMenu);
            contextMenu.Items.AddButton("Edit_BindToData");
            IType itemType = this.ItemType;

            this.ProjectContext.ResolveType(PlatformTypes.FrameworkElement);
            if (itemType == null || PlatformTypes.FrameworkElement.Equals((object)itemType))
            {
                return;
            }
            contextMenu.Items.AddButton("Edit_AddItem");
        }
コード例 #29
0
        public UIContext(ICommandBar bar, Func <ICommandBarItem> itembuilder, Image image)
        {
            this.Item = itembuilder();
            if (image != null)
            {
                Item.Image = image;
            }
            this.Bar = bar;

#if DEBUG
            InstanceCount++;
#endif
        }
コード例 #30
0
 public override void AddCustomContextMenuCommands(ICommandBar contextMenu)
 {
     base.AddCustomContextMenuCommands(contextMenu);
     if (ProjectNeutralTypes.DataGridBoundColumn.IsAssignableFrom((ITypeId)this.Type))
     {
         contextMenu.Items.AddButton("Edit_BindToData");
     }
     contextMenu.Items.AddDynamicMenu("Edit_EditStyles", StringTable.DataGridColumnContextMenuEditStyles);
     if (!ProjectNeutralTypes.DataGridTemplateColumn.IsAssignableFrom((ITypeId)this.Type))
     {
         return;
     }
     contextMenu.Items.AddDynamicMenu("Edit_EditTemplates", StringTable.DataGridColumnContextMenuEditTemplates);
 }
コード例 #31
0
        /// <summary>
        /// Un registers our commands with reflector.
        /// </summary>
        private void UnRegisterCommands()
        {
            ICommandBarManager commandBarMgr = ServiceProvider.GetService(typeof(ICommandBarManager)) as ICommandBarManager;

            if (commandBarMgr != null)
            {
                ICommandBar defaultBrowserContextMenu = commandBarMgr.CommandBars["Browser.Assembly"];
                if (defaultBrowserContextMenu.Items.Contains(MainCommand))
                {
                    defaultBrowserContextMenu.Items.Remove(MainCommand);
                }

                MainCommand = null;
            }
        }
コード例 #32
0
ファイル: UIContext.cs プロジェクト: XQuantumForceX/Reflexil
		public ButtonUIContext(ICommandBar bar)
			: base(bar, () => bar.Items.AddSeparator())
		{
		}
コード例 #33
0
ファイル: UIContext.cs プロジェクト: XQuantumForceX/Reflexil
		public ButtonUIContext(ICommandBar bar, string caption, EventHandler clickHandler, Image image)
			: base(bar, () => bar.Items.AddButton(caption, clickHandler), image)
		{
			ClickHandler = clickHandler;
		}
コード例 #34
0
ファイル: UIContext.cs プロジェクト: XQuantumForceX/Reflexil
		protected ButtonUIContext(ICommandBar bar, Func<ICommandBarItem> itembuilder, EventHandler clickHandler, Image image)
			: base(bar, itembuilder, image)
		{
			ClickHandler = clickHandler;
		}
コード例 #35
0
ファイル: UIContext.cs プロジェクト: XQuantumForceX/Reflexil
		public MenuUIContext(ICommandBar bar, string identifier, string caption, Image image)
			: base(bar, () => bar.Items.AddMenu(identifier, caption, image))
		{
		}
コード例 #36
0
ファイル: CommandManager.cs プロジェクト: aBothe/monodevelop
		public void RegisterCommandBar (ICommandBar commandBar)
		{
			if (toolbars.Contains (commandBar))
				return;
			
			toolbars.Add (commandBar);
			StartStatusUpdater ();
			
			commandBar.SetEnabled (guiLock == 0);
			
			object activeWidget = GetActiveWidget (rootWidget);
			commandBar.Update (activeWidget);
		}
コード例 #37
0
        public UIContext(ICommandBar bar, Func<ICommandBarItem> itembuilder, Image image)
        {
            Item = itembuilder();
            if (image != null)
                Item.Image = image;

			Bar = bar;

#if DEBUG
            InstanceCount++;
#endif
        }
コード例 #38
0
 public UIContext(ICommandBar bar, Func<ICommandBarItem> itembuilder) : this(bar, itembuilder, null)
 {
 }
コード例 #39
0
ファイル: ShellService.cs プロジェクト: adymitruk/storyteller
 public ShellService(IScreenObjectRegistry registry, ICommandBar commands, IOptionsMenu options)
 {
     _registry = registry;
     _commands = commands;
     _options = options;
 }
コード例 #40
0
		public void UnregisterCommandBar (ICommandBar commandBar)
		{
			toolbars.Remove (commandBar);

			StopStatusUpdaterIfNeeded ();
		}
コード例 #41
0
ファイル: ScreenAction.cs プロジェクト: Antares007/InRetail
 public void BuildButton(ICommandBar bar)
 {
     bar.AddCommand(Name, Command);
 }
コード例 #42
0
		public void RegisterCommandBar (ICommandBar commandBar)
		{
			if (toolbars.Contains (commandBar))
				return;
			
			toolbars.Add (commandBar);
			if (enableToolbarUpdate && !toolbarUpdaterRunning) {
				GLib.Timeout.Add (500, new GLib.TimeoutHandler (UpdateStatus));
				toolbarUpdaterRunning = true;
			}
			commandBar.SetEnabled (guiLock == 0);
			
			object activeWidget = GetActiveWidget (rootWidget);
			commandBar.Update (activeWidget);
		}
コード例 #43
0
ファイル: UIContext.cs プロジェクト: XQuantumForceX/Reflexil
		protected UIContext(ICommandBar bar, Func<ICommandBarItem> itembuilder, Image image = null)
		{
			Item = itembuilder();
			if (image != null)
				Item.Image = image;

			// Reflector is hiding separators in SubMenuItem ! Workaround that
			if (Item is ICommandBarSeparator)
			{
				Item.PropertyChanged += (sender, args) => {
					if (!Item.Visible)
						Item.Visible = true;
				};
			}

			Bar = bar;

			InstanceCount++;
		}
コード例 #44
0
ファイル: CommandManager.cs プロジェクト: aBothe/monodevelop
		public void UnregisterCommandBar (ICommandBar commandBar)
		{
			toolbars.Remove (commandBar);
		}
コード例 #45
0
 public void SetUp()
 {
     _commands = MockRepository.GenerateMock<ICommandBar>();
 }