private async void DteEvents_OnBeginShutdown()
        {
            IProcessManagerService processManagerService = await this.GetServiceAsync(typeof(SProcessManagerService)) as IProcessManagerService;

            if (!processManagerService.StartedPriorToExtensionInit)
            {
                await processManagerService.StopAsync();
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 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);
        }
Esempio n. 6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IProcessManagerService processManagerService, IScheduledJobSerivce scheduledJobSerivce)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                app.UseStaticFiles(new StaticFileOptions()
                {
                    FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), @"node_modules")),
                    RequestPath  = new PathString("/npm")
                });

                app.UseStaticFiles(new StaticFileOptions()
                {
                    FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), @"Scripts")),
                    RequestPath  = new PathString("/tssources")
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            List <ManagedProcess> processes = new List <ManagedProcess>();

            Configuration.Bind("Processes", processes);

            processManagerService.Initialize(processes);
            scheduledJobSerivce.Initialize(processes);

            app.UseQuartz();
        }
        /// <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()
        //{
        //    //StartTunnel.Initialize(this);
        //    base.Initialize();
        //}

        /// <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 System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

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

            processManagerService.StartedPriorToExtensionInit = processManagerService.IsRunning;

            DTE2 applicationObject = await this.GetServiceAsync(typeof(DTE)) as EnvDTE80.DTE2;

            DTEEvents dteEvents = applicationObject.Events.DTEEvents;

            dteEvents.OnBeginShutdown += DteEvents_OnBeginShutdown;

            // 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);

            await NgrokExtensions.TrafficInspector.TrafficInspectorCommand.InitializeAsync(this);

            await NgrokExtensions.Tunnels.StartTunnelCommand.InitializeAsync(this);

            await NgrokExtensions.TunnelInspector.TunnelInspectorCommand.InitializeAsync(this);
        }
Esempio n. 8
0
 public TortoiseGitLauncherServiceShould()
 {
     _processManagerService = Substitute.For <IProcessManagerService>();
 }
 public TortoiseGitLauncherService(IProcessManagerService processManagerService, Solution2 solution)
 {
     _processManagerService = processManagerService;
     _solution = solution;
 }
Esempio n. 10
0
 public ProcessAPIController(IProcessManagerService processManagerService)
 {
     this.processManagerService = processManagerService;
 }
 public void Setup()
 {
     _processManagerService = Substitute.For<IProcessManagerService>();
 }
 public TortoiseGitLauncherService(IProcessManagerService processManagerService, Solution solution)
 {
     _processManagerService = processManagerService;
     _solution = solution;
 }
 public RestartProcessScheduledJob(IProcessManagerService processManagerService, IProcessOutputService processOutputService)
 {
     this.processOutputService  = processOutputService;
     this.processManagerService = processManagerService;
 }
Esempio n. 14
0
 public ProcessController(IProcessManagerService processManagerService, IProcessOutputService processOutputService)
 {
     this.processOutputService  = processOutputService;
     this.processManagerService = processManagerService;
 }