Exemplo n.º 1
0
 public MissionScriptNode(CommandID command, int timeStamp)
 {
     z_command = command;
     z_timeStamp = timeStamp;
     z_isDone = false;
     z_subNodes = new List<MissionScriptNode>();
 }
Exemplo n.º 2
0
 void CreateConfigCommand()
 {
     var configureCommandId = new CommandID(cmdSet, 1);
     configureCommand = new OleMenuCommand(delegate { configureMenuCallback.ConfigureCallback(); }, configureCommandId);
     configureCommand.BeforeQueryStatus += delegate { menuStatusChecker.ConfigureCommandStatusCheck(configureCommand); };
     menuCommandService.AddCommand(configureCommand);
 }
Exemplo n.º 3
0
 void CreateDisableCommand()
 {
     var disableCommandId = new CommandID(cmdSet, 2);
     disableCommand = new OleMenuCommand(delegate { disableMenuConfigure.DisableCallback(); }, disableCommandId)
                          {
                              Enabled = false
                          };
     disableCommand.BeforeQueryStatus += delegate { menuStatusChecker.DisableCommandStatusCheck(disableCommand); };
     menuCommandService.AddCommand(disableCommand);
 }
Exemplo n.º 4
0
    public void RegisterMenus()
    {
        var vsPackageCmdSet = new Guid("5ce0365b-947a-4dca-b016-ca823deaad0b");
        var configureCommandId = new CommandID(vsPackageCmdSet, 1);
        configureCommand = new OleMenuCommand(delegate { configureMenuCallback.ConfigureCallback(); }, configureCommandId);
        configureCommand.BeforeQueryStatus += delegate { CommandStatusCheck(); };
        menuCommandService.AddCommand(configureCommand);

        var disableCommandId = new CommandID(vsPackageCmdSet, 2);
        disableCommand = new OleMenuCommand(delegate { disableMenuConfigure.DisableCallback(); }, disableCommandId)
                             {
                                 Enabled = false
                             };
        disableCommand.BeforeQueryStatus += delegate { CommandStatusCheck(); };
        menuCommandService.AddCommand(disableCommand);
    }
Exemplo n.º 5
0
    public void RegisterMenus()
    {
        var cmdSet = new Guid("af0fbcae-2924-42bf-adb7-31202b59250a");
        var configureCommandId = new CommandID(cmdSet, 1);
        configureCommand = new OleMenuCommand(delegate { configureMenuCallback.ConfigureCallback(); }, configureCommandId);
        configureCommand.BeforeQueryStatus += delegate { CommandStatusCheck(); };
        menuCommandService.AddCommand(configureCommand);

        var disableCommandId = new CommandID(cmdSet, 2);
        disableCommand = new OleMenuCommand(delegate { disableMenuConfigure.DisableCallback(); }, disableCommandId)
                             {
                                 Enabled = false
                             };
        disableCommand.BeforeQueryStatus += delegate { CommandStatusCheck(); };
        menuCommandService.AddCommand(disableCommand);
    }
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this));
            base.Initialize();



            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the publish in crm.
                CommandID   publishInCrmCommandID = new CommandID(GuidList.guidPublishInCrmCmdSet, (int)PkgCmdIDList.cmdidPublishInCrm);
                MenuCommand publishInCrmMenuItem  = new MenuCommand(PublishInCrmCallback, publishInCrmCommandID);
                mcs.AddCommand(publishInCrmMenuItem);

                // Create the command for the publish in crm(solution explorer).
                CommandID   publishInCrmMultipleCommandID = new CommandID(GuidList.guidPublishInCrmCmdSet, (int)PkgCmdIDList.cmdidPublishInCrmMultiple);
                MenuCommand publishInCrmMultipleMenuItem  = new MenuCommand(PublishInCrmMultipleCallback, publishInCrmMultipleCommandID);
                mcs.AddCommand(publishInCrmMultipleMenuItem);
            }
        }
Exemplo n.º 7
0
        public bool QueryStatus(CommandID cmdId, CommandStatus status, CommandText text)
        {
            var des = base.GetSelectedDesigner();

            if (des != null)
            {
                return(des.QueryStatus(cmdId, status, text));
            }
            if (cmdId.Guid == CmdSets.GuidReko)
            {
                switch (cmdId.ID)
                {
                case CmdIds.CollapseAllNodes: status.Status = MenuStatus.Visible | MenuStatus.Enabled; return(true);

                case CmdIds.CreateUserSegment: status.Status =
                    IsSegmentSelected()
                            ? MenuStatus.Visible | MenuStatus.Enabled
                            : MenuStatus.Visible;
                    return(true);
                }
            }
            return(false);
        }
#pragma warning restore IDE0052 // Remove unread private members

        private IntegrationTestServiceCommands(Package package)
        {
            _package = package ?? throw new ArgumentNullException(nameof(package));

            if (ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService menuCommandService)
            {
                var startMenuCmdId = new CommandID(guidTestWindowCmdSet, cmdidStartIntegrationTestService);
                _startMenuCmd = new MenuCommand(StartServiceCallback, startMenuCmdId)
                {
                    Enabled = true,
                    Visible = true
                };
                menuCommandService.AddCommand(_startMenuCmd);

                var stopMenuCmdId = new CommandID(guidTestWindowCmdSet, cmdidStopIntegrationTestService);
                _stopMenuCmd = new MenuCommand(StopServiceCallback, stopMenuCmdId)
                {
                    Enabled = false,
                    Visible = false
                };
                menuCommandService.AddCommand(_stopMenuCmd);
            }
        }
Exemplo n.º 9
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate()
            {
                CommandID menuItemCmd = new CommandID(AnkhId.CommandSetGuid, (int)AnkhCommand.Checkout);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "AnkhSvn", "AnkhSvn.AnkhSvn.AnkhSvnPackage");
                DialogBoxPurger purger       = new DialogBoxPurger(NativeMethods.IDCANCEL, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
        private GoToViewCmd(Package package, DTE dte)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(
                    this.MenuItemCallback,
                    null,
                    this.BeforeQueryStatus,
                    menuCommandID);
                commandService.AddCommand(menuItem);
                this.dte = dte;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
        /// <param name="progress">A provider for progress updates.</param>
        /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // When initialized asynchronously, the current thread may be a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            if (await GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
            {
                try
                {
                    CommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

                    _dte = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2;

                    CommandID   menuCommandID = new CommandID(GuidList.guidAntDeployCmdSet, (int)PkgCmdIDList.AntDeployCommand);
                    MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandID);
                    mcs.AddCommand(menuItem);
                }
                catch (Exception e)
                {
                }
            }
        }
Exemplo n.º 12
0
        internal void RegisterCommands(IEnumerable <Command> commands, Guid cmdSet)
        {
            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                lock (_commandsLock)
                {
                    foreach (var command in commands)
                    {
                        var beforeQueryStatus = command.BeforeQueryStatus;
                        var toolwndCommandID  = new CommandID(cmdSet, command.CommandId);
                        var menuToolWin       = new OleMenuCommand(command.DoCommand, toolwndCommandID);
                        if (beforeQueryStatus != null)
                        {
                            menuToolWin.BeforeQueryStatus += beforeQueryStatus;
                        }
                        mcs.AddCommand(menuToolWin);
                        _commands[command] = menuToolWin;
                    }
                }
            }
        }
        public static async Task InitializeAsync(AsyncPackage package)
        {
            var dte = await package.GetServiceAsync(typeof(DTE));

            if (dte == null)
            {
                return;
            }
            _dte2 = (DTE2)dte;

            if (await package.GetServiceAsync(typeof(IMenuCommandService)) is IMenuCommandService commandService)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(MenuItemCallback, menuCommandID)
                {
                    // this does not work, found here https://github.com/Microsoft/VSSDK-Extensibility-Samples/blob/master/SingleFileGenerator/src/Commands/ApplyCustomTool.cs
                    // This will defer visibility control to the VisibilityConstraints section in the .vsct file
                    Supported = false
                };

                commandService.AddCommand(menuItem);
            }
        }
Exemplo n.º 14
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            IVsUIShell uiShell = GetService <IVsUIShell, SVsUIShell>();

            uiShell.EnableModeless(Convert.ToInt32(true));

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID   menuCommandId = new CommandID(GuidList.GuidResxPackageCmdSet, (int)PkgCmdIdList.ResxPackage);
                MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandId);

                mcs.AddCommand(menuItem);
            }

            CreateOutputWindow();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
        /// <param name="progress">A provider for progress updates.</param>
        /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // When initialized asynchronously, the current thread may be a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            OleMenuCommandService menuCommandService;

            // Add our command handlers for menu (commands must exist in the .vsct file)
            menuCommandService = await this.GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(false) as OleMenuCommandService;

            if (menuCommandService != null)
            {
                // Create the command for the menu item.
                CommandID   menuCommandId;
                MenuCommand menuItem;

                menuCommandId = new CommandID(GuidList.guidCyotek_AddProjectsCmdSet, (int)PkgCmdIDList.cmdidCyotekAddProjects);
                menuItem      = new MenuCommand(this.MenuItemCallback, menuCommandId);

                menuCommandService.AddCommand(menuItem);
            }
        }
        public static async Task InitializeAsync(AsyncPackage package)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync <IMenuCommandService, OleMenuCommandService>();

            Assumes.Present(commandService);

            IVsUIShell shell = await package.GetServiceAsync <SVsUIShell, IVsUIShell>();

            Assumes.Present(shell);

            DTE2 dte = await package.GetServiceAsync <DTE, DTE2>();

            Assumes.Present(dte);

            var cmdId    = new CommandID(PackageGuids.guidCommands, PackageIds.LanguageSetting);
            var menuItem = new OleMenuCommand((s, e) => Execute(shell, dte), cmdId);

            menuItem.BeforeQueryStatus += (s, e) => OnBeforeQueryStatus(menuItem, dte);

            commandService.AddCommand(menuItem);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FindGroupByFunction"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private FindGroupByFunction(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new MenuCommand(this.MenuItemCallback, menuCommandID);
                commandService.AddCommand(menuItem);
            }

            DTE2       dte = ServiceProvider.GetService(typeof(EnvDTE.DTE)) as DTE2;
            FindEvents e   = dte.Events.FindEvents;

            e.FindDone += Fe_FindDone;
        }
        protected override void Initialize()
        {
            base.Initialize();

            _dte = GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
            {
                return;
            }

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (mcs != null)
            {
                // Create the command for the menu item.
                CommandID      sdkSearchCommandId = new CommandID(GuidList.GuidSdkSearchCmdSet, (int)PkgCmdIdList.CmdidCrmSdkSearch);
                OleMenuCommand sdkSearchMenuItem  = new OleMenuCommand(SearchMenuItemCallback, sdkSearchCommandId);
                sdkSearchMenuItem.BeforeQueryStatus += SdkSearch_BeforeQueryStatus;
                sdkSearchMenuItem.Visible            = false;
                mcs.AddCommand(sdkSearchMenuItem);
            }
        }
Exemplo n.º 19
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                CommandID      commandId;
                OleMenuCommand menuItem;

                // Create the command for button Button1
                commandId = new CommandID(GuidList.guidRubikToolsAddinCmdSet, (int)PkgCmdIDList.Button1);
                menuItem  = new OleMenuCommand(Button1ExecuteHandler, Button1ChangeHandler, Button1QueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);
                // Create the command for button Button3
                commandId = new CommandID(GuidList.guidRubikToolsAddinCmdSet, (int)PkgCmdIDList.Button3);
                menuItem  = new OleMenuCommand(Button3ExecuteHandler, Button3ChangeHandler, Button3QueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);
            }
        }
Exemplo n.º 20
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            this._serviceProvider = this;
            _dte = this.GetService(typeof(DTE)) as DTE2;

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID menuCommandID = new CommandID(GuidList.guidTransformTemplatesToolCmdSet, (int)PkgCmdIDList.cmdidTransformProjectsTemplates);
                //MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
                //mcs.AddCommand( menuItem );
                CommandID      menuItemID = new CommandID(GuidList.guidTransformTemplatesToolCmdSet, (int)PkgCmdIDList.cmdidTransformProjectsTemplates);
                OleMenuCommand menuItem   = new OleMenuCommand(this.OnTransformSelectedExec, menuItemID);
                menuItem.BeforeQueryStatus += new EventHandler(OnTransformSelectedStatus);
                mcs.AddCommand(menuItem);
            }
        }
Exemplo n.º 21
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID      menuCommandID = new CommandID(GuidList.guidminecraftpkgCmdSet, (int)PkgCmdIDList.cmdidProvisionMinecraftProject);
                OleMenuCommand menuItem      = new OleMenuCommand(ProvisionMinecraftProject, menuCommandID);
                menuItem.ParametersDescription = "$";
                mcs.AddCommand(menuItem);

                // Create the command for the menu item.
                CommandID      menuCommandID2 = new CommandID(GuidList.guidminecraftpkgCmdSet, (int)PkgCmdIDList.cmdidBuildAndProvisionMinecraftProject);
                OleMenuCommand menuItem2      = new OleMenuCommand(BuildAndProvisionMinecraftProject, menuCommandID2);
                menuItem2.ParametersDescription = "$";
                mcs.AddCommand(menuItem2);
            }
        }
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            //Create Editor Factory. Note that the base Package class will call Dispose on it.
            base.RegisterEditorFactory(new EditorFactory(this));

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID   menuCommandID = new CommandID(GuidList.guidVSThrowawayPackageCmdSet, (int)PkgCmdIDList.startJamSession);
                MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandID);
                mcs.AddCommand(menuItem);
                // Create the command for the tool window
                CommandID   toolwndCommandID = new CommandID(GuidList.guidVSThrowawayPackageCmdSet, (int)PkgCmdIDList.cmdidMyTool);
                MenuCommand menuToolWin      = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand(menuToolWin);
            }
        }
Exemplo n.º 23
0
        bool IsMenuCommandEnabled(CommandID commandID)
        {
            if (designSurface == null)
            {
                return(false);
            }

            IMenuCommandService menuCommandService = (IMenuCommandService)designSurface.GetService(typeof(IMenuCommandService));

            if (menuCommandService == null)
            {
                return(false);
            }

            System.ComponentModel.Design.MenuCommand menuCommand = menuCommandService.FindCommand(commandID);
            if (menuCommand == null)
            {
                return(false);
            }

            //int status = menuCommand.OleStatus;
            return(menuCommand.Enabled);
        }
Exemplo n.º 24
0
        private void InstallMenu(OleMenuCommandService mcs)
        {
            if (mcs != null)
            {
                var debugLocally = new CommandID(PackageGuids.guidMonoDebugger_VS2013CmdSet, (int)PackageIds.cmdLocalDebugCode);
                var localCmd     = new OleMenuCommand(DebugLocalClicked, debugLocally);
                localCmd.BeforeQueryStatus += cmd_BeforeQueryStatus;
                mcs.AddCommand(localCmd);


                var menuCommandID = new CommandID(PackageGuids.guidMonoDebugger_VS2013CmdSet,
                                                  (int)PackageIds.cmdRemodeDebugCode);
                var cmd = new OleMenuCommand(DebugRemoteClicked, menuCommandID);
                cmd.BeforeQueryStatus += cmd_BeforeQueryStatus;
                mcs.AddCommand(cmd);

                var cmdOpenLogFileId = new CommandID(PackageGuids.guidMonoDebugger_VS2013CmdSet,
                                                     (int)PackageIds.cmdOpenLogFile);
                var openCmd = new OleMenuCommand(OpenLogFile, cmdOpenLogFileId);
                openCmd.BeforeQueryStatus += (o, e) => openCmd.Enabled = File.Exists(MonoLogger.LoggerPath);
                mcs.AddCommand(openCmd);
            }
        }
Exemplo n.º 25
0
        public void Initialize()
        {
            CommandID      menuCommandID = new CommandID(GuidList.guidExtensionUpdaterCmdSet, (int)PkgCmdIDList.cmdEnableAutoUpdate);
            OleMenuCommand command       = new OleMenuCommand(MasterSwitch, menuCommandID);

            command.BeforeQueryStatus += (s, e) => { SetVisibility(command); };
            _mcs.AddCommand(command);

            CommandID      checkAllCommandID = new CommandID(GuidList.guidExtensionUpdaterCmdSet, (int)PkgCmdIDList.cmdCheckAll);
            OleMenuCommand checkAll          = new OleMenuCommand(CheckAll, checkAllCommandID);

            _mcs.AddCommand(checkAll);

            CommandID      importCommandID = new CommandID(GuidList.guidImportExportCmdSet, (int)PkgCmdIDList.cmdImport);
            OleMenuCommand import          = new OleMenuCommand(Import, importCommandID);

            _mcs.AddCommand(import);

            CommandID      exportCommandID = new CommandID(GuidList.guidImportExportCmdSet, (int)PkgCmdIDList.cmdExport);
            OleMenuCommand export          = new OleMenuCommand(Export, exportCommandID);

            _mcs.AddCommand(export);
        }
Exemplo n.º 26
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate()
            {
                CommandID menuItemCmd = new CommandID(EgorBo.Xamaridea_VisualStudioPlugin.GuidList.guidXamaridea_VisualStudioPluginCmdSet, (int)EgorBo.Xamaridea_VisualStudioPlugin.PkgCmdIDList.cmdidOpenInIdeaCommand);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "Xamaridea.VisualStudioPlugin", "EgorBo.Xamaridea_VisualStudioPlugin.Xamaridea_VisualStudioPluginPackage");
                DialogBoxPurger purger       = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Exemplo n.º 27
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        void InitializePackage()
        {
            debuggerEvents = Utils.GetDTE().Events.DebuggerEvents;
            debuggerEvents.OnEnterBreakMode += DebuggerEvents_OnEnterBreakMode;

            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the tool window
                CommandID   toolwndCommandID = new CommandID(GuidList.guidCSScriptCmdSet, (int)PkgCmdIDList.cmdidMyTool);
                MenuCommand menuToolWin      = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand(menuToolWin);

                // Create the command for the menu item.
                CommandID   menuCommandID = new CommandID(GuidList.guidCSScriptCmdSet, (int)PkgCmdIDList.cmdidMyCommand);
                MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandID);
                mcs.AddCommand(menuItem);
            }
        }
Exemplo n.º 28
0
        /// <include file='doc\OleMenuCommandService.uex' path='docs/doc[@for="OleMenuCommandService.GlobalInvoke"]/*' />
        /// <devdoc>
        ///     Invokes a command on the local form or in the global environment.
        ///     The local form is first searched for the given command ID.  If it is
        ///     found, it is invoked.  Otherwise the the command ID is passed to the
        ///     global environment command handler, if one is available.
        /// </devdoc>
        public override bool GlobalInvoke(CommandID commandID)
        {
            // is it local?
            if (base.GlobalInvoke(commandID))
            {
                return(true);
            }

            // pass it to the global handler
            IVsUIShell uiShellSvc = GetService(typeof(SVsUIShell)) as IVsUIShell;

            if (uiShellSvc != null)
            {
                Object dummy   = null;
                Guid   tmpGuid = commandID.Guid;
                if (NativeMethods.Failed(uiShellSvc.PostExecCommand(ref tmpGuid, (uint)commandID.ID, 0, ref dummy)))
                {
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 29
0
        private void OleMenuCommandBeforeQueryStatus(object sender, EventArgs e)
        {
            try
            {
                if (sender is OleMenuCommand oleMenuCommand)
                {
                    CommandID commandId = oleMenuCommand.CommandID;

                    if (commandId != null && mCommandsById.ContainsKey(commandId.ID))
                    {
                        var bc = mCommandsById[commandId.ID];

                        oleMenuCommand.Supported = true;
                        oleMenuCommand.Enabled   = bc.IsEnabled();
                        oleMenuCommand.Visible   = true;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 30
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate()
            {
                CommandID menuItemCmd = new CommandID(Company.WomanOfParis.GuidList.guidWomanOfParisCmdSet, (int)Company.WomanOfParis.PkgCmdIDList.cmdidWomanOfParisCommand);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "WomanOfParis", "Company.WomanOfParis.WomanOfParisPackage");
                DialogBoxPurger purger       = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Exemplo n.º 31
0
        protected override void Initialize()
        {
            base.Initialize();

            _logger = new Logger();

            _dte = GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
            {
                return;
            }

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (mcs != null)
            {
                CommandID      publishCommandId = new CommandID(GuidList.GuidProjectMenuCommandsCmdSet, (int)PkgCmdIdList.CmdidPluginDeployerPublish);
                OleMenuCommand publishMenuItem  = new OleMenuCommand(PublishItemCallback, publishCommandId);
                publishMenuItem.BeforeQueryStatus += PublishItem_BeforeQueryStatus;
                publishMenuItem.Visible            = false;
                mcs.AddCommand(publishMenuItem);
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CapstoneDisassemblyCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="commandService">Command service to add command to, not null.</param>
        private CapstoneDisassemblyCommand(Package package, OleMenuCommandService commandService)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }
            if (commandService == null)
            {
                throw new ArgumentNullException(nameof(commandService));
            }

            _package = package;

            CommandID   menuCommandID = new CommandID(GuidList.guidCapstoneDisassemblyPackageCmdSet, (int)PkgCmdIDList.CapstoneDisassemblyCommandId);
            MenuCommand menuToolWin   = new MenuCommand(Execute, menuCommandID);

            commandService.AddCommand(menuToolWin);

            var componentModel = package.GetService <SComponentModel, IComponentModel>();
            var export         = componentModel.DefaultExportProvider;

            _serviceProvider = export.GetExportedValue <SVsServiceProvider>();
        }
        private CommandDoxygenBrowsePage(Package package, App.CommandManager cmdManager, int commandId, bool useSourcebrowser, bool useLocal, string htmlDest)
            : base(package, cmdManager)
        {
            this.CommandId        = commandId;
            this.UseSourcebrowser = useSourcebrowser;
            this.UseLocalDox      = useLocal;
            this.htmlDest_        = htmlDest;

            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
                menuItem.BeforeQueryStatus += MenuItem_BeforeQueryStatus;
                commandService.AddCommand(menuItem);
            }
        }
Exemplo n.º 34
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID   menuCommandID = new CommandID(GuidList.guidVSpniff_VSPackageCmdSet, (int)PkgCmdIDList.cmdidFindMissingFiles);
                MenuCommand menuItem      = new MenuCommand(FindForProjectCallback, menuCommandID);
                mcs.AddCommand(menuItem);

                menuCommandID = new CommandID(GuidList.guidVSpniff_VSPackageCmdSet, (int)PkgCmdIDList.cmdidFindMissingFilesAll);
                menuItem      = new MenuCommand(FindAllCallback, menuCommandID);
                mcs.AddCommand(menuItem);
            }
            owp = null;
            dte = (DTE)GetService(typeof(DTE));
            CreateVSpniffOutputPane();
        }
Exemplo n.º 35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GoToDnSpy"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private GoToDnSpy(Package package)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            try
            {
                _package = package ?? throw new ArgumentNullException(nameof(package));

                if (ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService)
                {
                    // Add tools menu command
                    var menuCommandId = new CommandID(PackageGuids.guidGoToDnSpyPackageCmdSetMenu, PackageIds.GoToDnSpyId);
                    var menuItem      = new MenuCommand(this.MenuItemCallback, menuCommandId);
                    commandService.AddCommand(menuItem);
                    // Add editor context menu command (right click)
                    var ctxMenuCommand = new CommandID(PackageGuids.guidGoToDnSpyPackageCmdSetContextMenu, PackageIds.GoToDnSpyContextMenuId);
                    var ctxMenuItem    = new MenuCommand(this.MenuItemCallback, ctxMenuCommand);
                    commandService.AddCommand(ctxMenuItem);
                }

                _statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar));
                Assumes.Present(_statusBar);

                _componentModel = (IComponentModel)ServiceProvider.GetService(typeof(SComponentModel));
                Assumes.Present(_componentModel);

                _editorAdaptersFactory = _componentModel.GetService <IVsEditorAdaptersFactoryService>();
                Assumes.Present(_editorAdaptersFactory);

                _dte = (DTE)ServiceProvider.GetService(typeof(DTE));
                Assumes.Present(_dte);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Some error in GoToDnSpy extensiton.\n Please take screenshot and create issue on github with this error\n{ex.ToString()}", "[GoToDnSpy] Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
	// Constructors
	public MenuCommand(System.EventHandler handler, CommandID command) {}
	public DesignerVerb(string text, System.EventHandler handler, CommandID startCommandID) {}
 public void ShowContextMenu(CommandID menuID, int x, int y)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 39
0
 /// <summary>
 /// Send data to the comm device
 /// </summary>
 /// <param name="address">The address of the device eg. 000001</param>
 /// <param name="command">The command id of the message</param>
 /// <returns>The result of the transmission</returns>
 public override Boolean SendData(CommandID Command)
 {
     //Send blank array with defined command byte
     return SendData(Command, new byte[] { });
 }
	public virtual bool GlobalInvoke(CommandID commandId, object arg) {}
		static StandardCommands()
		{
			// It seems that all static commands use this Guid values in MS impl
			Guid guidA = new Guid("5efc7975-14bc-11cf-9b2b-00aa00573819");
			Guid guidB = new Guid("74d21313-2aee-11d1-8bfb-00a0c90f26f7");

			// got command IDs by looking at StandardCommands.AlignBottom.ToString in MS impl
			AlignBottom = new CommandID (guidA, 1);
			AlignHorizontalCenters = new CommandID (guidA, 2);
			AlignLeft = new CommandID (guidA, 3);
			AlignRight = new CommandID (guidA, 4);
			AlignToGrid = new CommandID (guidA, 5);
			AlignTop = new CommandID (guidA, 6);
			AlignVerticalCenters = new CommandID (guidA, 7);
			ArrangeBottom = new CommandID (guidA, 8);

			ArrangeIcons = new CommandID (guidB, 12298);

			ArrangeRight = new CommandID (guidA, 9);
			BringForward = new CommandID (guidA, 10);
			BringToFront = new CommandID (guidA, 11);
			CenterHorizontally = new CommandID (guidA, 12);
			CenterVertically = new CommandID (guidA, 13);

			Copy = new CommandID (guidA, 15);
			Cut = new CommandID (guidA, 16);
			Delete = new CommandID (guidA, 17);

			F1Help = new CommandID (guidA, 377);

			Group = new CommandID (guidA, 20);
			HorizSpaceConcatenate = new CommandID (guidA, 21);
			HorizSpaceDecrease = new CommandID (guidA, 22);
			HorizSpaceIncrease = new CommandID (guidA, 23);
			HorizSpaceMakeEqual = new CommandID (guidA, 24);

			LineupIcons = new CommandID (guidB, 12299);

			LockControls = new CommandID (guidA, 369);

			MultiLevelRedo = new CommandID (guidA, 30);

			MultiLevelUndo = new CommandID (guidA, 44);

			Paste = new CommandID (guidA, 26);
			Properties = new CommandID (guidA, 28);

			PropertiesWindow = new CommandID (guidA, 235);

			Redo = new CommandID (guidA, 29);

			Replace = new CommandID (guidA, 230);

			SelectAll = new CommandID (guidA, 31);
			SendBackward = new CommandID (guidA, 32);
			SendToBack = new CommandID (guidA, 33);

			ShowGrid = new CommandID (guidA, 103);

			ShowLargeIcons = new CommandID (guidB, 12300);

			SizeToControl = new CommandID (guidA, 35);
			SizeToControlHeight = new CommandID (guidA, 36);
			SizeToControlWidth = new CommandID (guidA, 37);
			SizeToFit = new CommandID (guidA, 38);
			SizeToGrid = new CommandID (guidA, 39);
			SnapToGrid = new CommandID (guidA, 40);
			TabOrder = new CommandID (guidA, 41);

			Undo = new CommandID (guidA, 43);

			Ungroup = new CommandID (guidA, 45);

			VerbFirst = new CommandID (guidB, 8192);
			VerbLast = new CommandID (guidB, 8448);

			VertSpaceConcatenate = new CommandID (guidA, 46);
			VertSpaceDecrease = new CommandID (guidA, 47);
			VertSpaceIncrease = new CommandID (guidA, 48);
			VertSpaceMakeEqual = new CommandID (guidA, 49);

			ViewGrid = new CommandID (guidA, 125);

#if NET_2_0
			DocumentOutline = new CommandID (guidA, 239);
			ViewCode = new CommandID (guidA, 333);
#endif
		}
	public virtual MenuCommand FindCommand(CommandID commandID) {}
Exemplo n.º 43
0
 public abstract Boolean SendData(CommandID command, Array data);
	public virtual bool GlobalInvoke(CommandID commandID) {}
Exemplo n.º 45
0
 public abstract Boolean SendData(CommandID Command);
	public virtual void ShowContextMenu(CommandID menuID, int x, int y) {}
 public MenuCommand FindCommand(CommandID commandID)
 {
     throw new NotImplementedException();
 }
	// Initialize the command identifiers.
	static StandardCommands()
			{
				Guid guid1;
				Guid guid2;

				guid1 = new Guid("{5efc7975-14bc-11cf-9b2b-00aa00573819}");
				guid2 = new Guid("{74d21313-2aee-11d1-8bfb-00a0c90f26f7}");

				AlignBottom					= new CommandID(guid1, 1);
				AlignHorizontalCenters		= new CommandID(guid1, 2);
				AlignLeft					= new CommandID(guid1, 3);
				AlignRight					= new CommandID(guid1, 4);
				AlignToGrid					= new CommandID(guid1, 5);
				AlignTop					= new CommandID(guid1, 6);
				AlignVerticalCenters		= new CommandID(guid1, 7);
				ArrangeBottom				= new CommandID(guid1, 8);
				ArrangeRight				= new CommandID(guid1, 9);
				BringForward				= new CommandID(guid1, 10);
				BringToFront				= new CommandID(guid1, 11);
				CenterHorizontally			= new CommandID(guid1, 12);
				CenterVertically			= new CommandID(guid1, 13);
				Copy						= new CommandID(guid1, 15);
				Cut							= new CommandID(guid1, 16);
				Delete						= new CommandID(guid1, 17);
				Group						= new CommandID(guid1, 20);
				HorizSpaceConcatenate		= new CommandID(guid1, 21);
				HorizSpaceDecrease			= new CommandID(guid1, 22);
				HorizSpaceIncrease			= new CommandID(guid1, 23);
				HorizSpaceMakeEqual			= new CommandID(guid1, 24);
				Paste						= new CommandID(guid1, 26);
				Properties					= new CommandID(guid1, 28);
				Redo						= new CommandID(guid1, 29);
				MultiLevelRedo				= new CommandID(guid1, 30);
				SelectAll					= new CommandID(guid1, 31);
				SendBackward				= new CommandID(guid1, 32);
				SendToBack					= new CommandID(guid1, 33);
				SizeToControl				= new CommandID(guid1, 35);
				SizeToControlHeight			= new CommandID(guid1, 36);
				SizeToControlWidth			= new CommandID(guid1, 37);
				SizeToFit					= new CommandID(guid1, 38);
				SizeToGrid					= new CommandID(guid1, 39);
				SnapToGrid					= new CommandID(guid1, 40);
				TabOrder					= new CommandID(guid1, 41);
				Undo						= new CommandID(guid1, 43);
				MultiLevelUndo				= new CommandID(guid1, 44);
				Ungroup						= new CommandID(guid1, 45);
				VertSpaceConcatenate		= new CommandID(guid1, 46);
				VertSpaceDecrease			= new CommandID(guid1, 47);
				VertSpaceIncrease			= new CommandID(guid1, 48);
				VertSpaceMakeEqual			= new CommandID(guid1, 49);
				ShowGrid					= new CommandID(guid1, 103);
				ViewGrid					= new CommandID(guid1, 125);
				Replace						= new CommandID(guid1, 230);
				PropertiesWindow			= new CommandID(guid1, 235);
				LockControls				= new CommandID(guid1, 369);
				F1Help						= new CommandID(guid1, 377);
				VerbFirst					= new CommandID(guid2, 0x2000);
				VerbLast					= new CommandID(guid2, 0x2100);
				ArrangeIcons				= new CommandID(guid2, 0x300A);
				LineupIcons					= new CommandID(guid2, 0x300B);
				ShowLargeIcons				= new CommandID(guid2, 0x300C);
			}
 public bool GlobalInvoke(CommandID commandID)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 50
0
        /// <summary>
        /// Send data to the comm device
        /// </summary>
        /// <param name="address">The address of the device eg. 000001</param>
        /// <param name="command">The command id of the message</param>
        /// <param name="data">The message payload</param>
        /// <returns>The result of the transmission</returns>
        public override Boolean SendData(CommandID command, Array data)
        {
            //Attempt to send data to the sepecified server
            try
            {
                //Create a new and local network stream for communication
                NetworkStream serverStream = theClient.GetStream();

                //make a new array based on the amount of data to be sent + necessary command bytes
                byte[] message = new byte[data.Length + 3];

                //Set value of necessary bytes
                //0xff packet header
                message.SetValue((byte)255, 0);
                //Number of remaining bytes in packet
                message.SetValue((byte)(data.Length + 1), 1);
                //command byte
                message.SetValue((byte)command, 2);

                //Copy all data into message array previously defined
                for (int idx = 0; idx < data.Length; idx++)
                {
                    message.SetValue(data.GetValue(idx), idx + 3);
                }

                //Write array to server stream
                serverStream.Write(message, 0, message.Length);
                serverStream.Flush();

                //return A-OK
                return true;
            }
            catch
            {
                //If there were any errors return false
                return false;
            }
        }
Exemplo n.º 51
0
 public MissionScriptNode(CommandID command, BinaryReader br)
     : this(command, br.ReadInt32())
 {
 }