Inheritance: System.ServiceProcess.ServiceBase
Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var svc = new Service1();

            svc.OnStart(args);

            while (true)
            {
                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 2
0
        /// <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
        }
Ejemplo n.º 3
0
        /// <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
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
 /// <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
 }
Ejemplo n.º 6
0
        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
        }
Ejemplo n.º 7
0
        /// <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
        }
Ejemplo n.º 8
0
        /// <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
        }
Ejemplo n.º 9
0
        /// <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
        }
Ejemplo n.º 10
0
 /// <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
 }
Ejemplo n.º 11
0
 /// <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);
     }
 }
Ejemplo n.º 12
0
 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);
     }
 }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
        /// <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;
                }
            }
        }
Ejemplo n.º 15
0
 public string GetString(string message)
 {
     Service1.CreateJobAsync();
     return(string.Concat(message, " Hello world"));
 }
Ejemplo n.º 16
0
 public void CreateJob()
 {
     Service1.CreateJobAsync();
 }