Esempio n. 1
0
 /// <summary>
 /// Entry point after having processed startup arguments
 /// </summary>
 private void OnExecute()
 {
     if (this.manageServiceInstall)
     {
         // Install service
         (new IPublicClientService()).Install("--install");
     }
     else if (this.manageServiceUninstall)
     {
         // Uninstall service
         (new IPublicClientService()).Uninstall("--uninstall");
     }
     else if (this.manageServiceStart)
     {
         // Start installed service
         (new IPublicClientService()).Start();
     }
     else if (this.manageServiceStop)
     {
         // Stop installed service
         (new IPublicClientService()).Stop();
     }
     else if (this.manageServiceConfigure)
     {
         // Configure IPublic client
         this.ExecuteConfiguration();
     }
     else
     {
         // Run service functionality as process
         StandaloneService.Run(new IPublicClientService(), new string[] { });
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Defines main console entry point
 /// </summary>
 /// <param name="args">Startup arguments</param>
 static void Main(string[] args)
 {
     if (args.Contains("--install"))
     {
         // Install service
         (new TestStandaloneService()).Install("--install");
     }
     else if (args.Contains("--uninstall"))
     {
         // Uninstall service
         (new TestStandaloneService()).Uninstall("--uninstall");
     }
     else if (args.Contains("--start"))
     {
         // Start installed service
         (new TestStandaloneService()).Start();
     }
     else if (args.Contains("--stop"))
     {
         // Stop installed service
         (new TestStandaloneService()).Stop();
     }
     else
     {
         // Run service functionality as process
         StandaloneService.Run(new TestStandaloneService(), args);
     }
 }