static void Main(string[] args) { var svc = new Service1(); svc.OnStart(args); while (true) { Thread.Sleep(1000); } }
/// <summary> /// Punto de entrada principal para la aplicaciĆ³n. /// </summary> static void Main() { #if DEBUG Service1 service = new Service1(); service.onDebug(); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #endif }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { #if DEBUG Service1 myService = new Service1(); myService.OnDebug(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite) #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #endif }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { Service1 myService = new Service1(); myService.onDebug(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); //ServiceBase[] ServicesToRun; //ServicesToRun = new ServiceBase[] //{ // new Service1() //}; //ServiceBase.Run(ServicesToRun); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { #if DEBUG Service1 myService = new Service1(); myService.OnDebug(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #endif }
static void Main() { #if DEBUG var svc = new Service1(); svc.OnNewExecution(); Thread.Sleep(Timeout.Infinite); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #endif }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { #if DEBUG Service1 s = new Service1(); s.OnDebug(); Thread.Sleep(Timeout.Infinite); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #endif }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { #if DEBUG ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #else Service1 debug = new Service1(); debug.onDebug(); #endif }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { #if DEBUG //While debugging this section is used. Service1 myService = new Service1(); myService.OnDebug(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); #else //In Release this section is used. This is the "normal" way. ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #endif }
/// <summary> /// The main entry point for the application. /// </summary> //static void Main() //{ // ServiceBase[] ServicesToRun; // ServicesToRun = new ServiceBase[] // { // new Service1() // }; // ServiceBase.Run(ServicesToRun); //} static void Main() { #if (!DEBUG) ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); #else Service1 myServ = new Service1(); myServ.Process(); // here Process is my Service function // that will run when my service onstart is call // you need to call your own method or function name here instead of Process(); #endif }
/// <summary> /// Punto de entrada principal para la aplicaciĆ³n. /// </summary> static void Main() { if (Environment.UserInteractive) { Service1 serv = new Service1(); serv.TestStartupAndStop(); } else { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); } }
static void Main(string[] args) { var service = new Service1(); ServiceBase [] servicesToRun = { service }; if (Environment.UserInteractive) { Console.CancelKeyPress += (x, y) => service.Stop(); service.Start(); Console.WriteLine("Service is running"); Console.ReadKey(); service.Stop(); Console.WriteLine("Service is stopped"); } else { ServiceBase.Run(servicesToRun); } }
static void Main(string[] args) { var service = new Service1(); if (Debugger.IsAttached) { service.OnStart(args); Console.WriteLine("Find the any key!"); Console.Read(); service.OnStop(); } else { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { service }; ServiceBase.Run(ServicesToRun); } }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (!Environment.UserInteractive) { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); } else { string parameter = string.Concat(args); switch (parameter) { case "-install": ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location }); break; case "-uninstall": ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location }); break; default: Debug.Listeners.Add(new TextWriterTraceListener(Console.Out, "Console")); Service1 service = new Service1(); service.Start(); Console.WriteLine("Started"); Console.WriteLine("Press enter to exit"); Console.ReadLine(); service.Stop(); break; } } }
public string GetString(string message) { Service1.CreateJobAsync(); return(string.Concat(message, " Hello world")); }
public void CreateJob() { Service1.CreateJobAsync(); }