Example #1
0
        private void Install()
        {
            System.Console.Out.WriteLine("Installing service {0}", _serviceName);
            string location = Assembly.GetExecutingAssembly().Location;

            _log.Debug(String.Format("ServiceConsoleCommand:RunCommand {0}", location));
            ServiceInstaller.InstallAndStart(_serviceName, null, String.Format(@"{0} {1}", location, AsServiceArgument));
            System.Console.Out.WriteLine("Service {0} is now installed.", _serviceName);
        }
Example #2
0
        private void IsInstalled()
        {
            bool serviceIsInstalled = ServiceInstaller.ServiceIsInstalled(_serviceName);

            System.Console.Out.WriteLine("Service {1} is installed : {0}.", serviceIsInstalled, _serviceName);
        }
Example #3
0
 private void Status()
 {
     System.Console.Out.WriteLine("Service status of {0}.", _serviceName);
     ServiceInstaller.GetServiceStatus(_serviceName);
 }
Example #4
0
 private void RemoveService()
 {
     System.Console.Out.WriteLine("Remove service {0}.", _serviceName);
     ServiceInstaller.Uninstall(_serviceName);
 }
Example #5
0
 private void Start()
 {
     System.Console.Out.WriteLine("Start service {0}.", _serviceName);
     ServiceInstaller.StartService(_serviceName);
 }