Open() public static method

public static Open ( ) : NativeServiceManager
return NativeServiceManager
Exemplo n.º 1
0
 public void Install()
 {
     using (var servicemanager = NativeServiceManager.Open())
     {
         using (var service = servicemanager.CreateService(this.ServiceName, this.ServiceName, "\"" + Assembly.GetExecutingAssembly().Location + "\" -service", ServiceRights.AllAccess))
         {
             service.Start(new string[] { });
         }
     }
 }
Exemplo n.º 2
0
 public void Uninstall()
 {
     using (var servicemanager = NativeServiceManager.Open())
     {
         using (var service = servicemanager.OpenService(this.ServiceName, ServiceRights.AllAccess))
         {
             service.Stop();
             service.Delete();
         }
     }
 }