Esempio n. 1
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async System.Threading.Tasks.Task InitializeAsync(CommandsController aCommandsController,
                                                                        ErrorWindowController aErrorWindow, OutputWindowController aOutputWindow, AsyncPackage aPackage, Guid aGuid, int aId)
        {
            // Switch to the main thread - the call to AddCommand in StopClang's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(aPackage.DisposalToken);

            OleMenuCommandService commandService = await aPackage.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService;

            Instance = new StopClang(commandService, aCommandsController, aErrorWindow, aOutputWindow, aPackage, aGuid, aId);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TidyCommand"/> 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 TidyCommand(OleMenuCommandService aCommandService, CommandsController aCommandsController,
                            ErrorWindowController aErrorWindow, OutputWindowController aOutputWindow, AsyncPackage aPackage, Guid aGuid, int aId)
            : base(aCommandsController, aErrorWindow, aOutputWindow, aPackage, aGuid, aId)
        {
            if (null != aCommandService)
            {
                var menuCommandID = new CommandID(CommandSet, Id);
                var menuCommand   = new OleMenuCommand(mCommandsController.Execute, menuCommandID);
                menuCommand.BeforeQueryStatus += mCommandsController.OnBeforeClangCommand;
                menuCommand.Enabled            = true;
                aCommandService.AddCommand(menuCommand);
            }
        }