Example #1
0
        public TunnelInspectorCommand(AsyncPackage package, IMenuCommandService commandService, IProcessManagerService processManager, ITunnelManagerService tunnelManager)
        {
            processManagerService = processManager;
            tunnelManagerService  = tunnelManager;

            var menuCommandID = new CommandID(CommandSet, CommandId);

            var menuItem = new OleMenuCommand((s, e) => Execute(package), menuCommandID);

            //menuItem.BeforeQueryStatus += MenuItem_BeforeQueryStatus;
            commandService.AddCommand(menuItem);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StartTunnelCommand"/> 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 StartTunnelCommand(AsyncPackage package, OleMenuCommandService commandService, ILoggerService logger, IProcessManagerService processManager, IWebApplicationsManagerService webApplicationsManager, ITunnelManagerService tunnelManager)
        {
            loggerService                 = logger;
            processManagerService         = processManager;
            webApplicationsManagerService = webApplicationsManager;
            tunnelManagerService          = tunnelManager;

            this.package   = package ?? throw new ArgumentNullException(nameof(package));
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommandID = new CommandID(CommandSet, CommandId);

            OleMenuCommand startTunnelToggleButtonMenuCommand = new OleMenuCommand(this.Execute, menuCommandID);

            startTunnelToggleButtonMenuCommand.BeforeQueryStatus += StartTunnelToggleButtonMenuCommand_BeforeQueryStatus;
            commandService.AddCommand(startTunnelToggleButtonMenuCommand);
        }
Example #3
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(AsyncPackage package)
        {
            // Switch to the main thread - the call to AddCommand in StartTunnelCommand's constructor requires
            // the UI thread.
            //await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            ILoggerService loggerService = await package.GetServiceAsync(typeof(SLoggerService), false) as ILoggerService;

            IProcessManagerService processMangerService = await package.GetServiceAsync(typeof(SProcessManagerService), false) as IProcessManagerService;

            IWebApplicationsManagerService webApplicationsMangerService = await package.GetServiceAsync(typeof(SWebApplicationsManagerService), false) as IWebApplicationsManagerService;

            ITunnelManagerService tunnelManagerService = await package.GetServiceAsync(typeof(STunnelManagerService), false) as ITunnelManagerService;

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

            new StartTunnelCommand(package, commandService, loggerService, processMangerService, webApplicationsMangerService, tunnelManagerService);
        }
        protected async override Task <object> InitializeToolWindowAsync(Type toolWindowType, int id, CancellationToken cancellationToken)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync();

            var dte = await GetServiceAsync(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2;

            IRepositoryService repositoryService = await GetServiceAsync(typeof(SRepositoryService), false) as IRepositoryService;

            ILoggerService loggerService = await GetServiceAsync(typeof(SLoggerService), false) as ILoggerService;

            ITunnelManagerService tunnelManagerService = await GetServiceAsync(typeof(STunnelManagerService), false) as ITunnelManagerService;

            return(new TunnelInspectorPaneState
            {
                DTE = dte,
                TunnelManager = tunnelManagerService,
                Logger = loggerService
            });
        }
Example #5
0
        /// <summary>
        /// Initializes the instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(AsyncPackage package)
        {
            // Switch to the main thread - the call to AddCommand in TunnelInspectorCommand's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            IProcessManagerService processManagerService = await package.GetServiceAsync(typeof(SProcessManagerService)) as IProcessManagerService;

            ITunnelManagerService tunnelManagerService = await package.GetServiceAsync(typeof(STunnelManagerService)) as ITunnelManagerService;

            if (processManagerService.StartedPriorToExtensionInit)
            {
                await tunnelManagerService.InitializeTunnelsAsync();
            }

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

            new TunnelInspectorCommand(package, commandService, processManagerService, tunnelManagerService);
        }