Esempio n. 1
0
        static void Main()
        {
            Config.Load();
            var args = Environment.GetCommandLineArgs().ToList();

            // If "-interactive" switch present, run service as an interactive console app.
            if (args.Exists(str => str.ToLower() == "-interactive"))
            {
                AditService.Connect();
            }
            else if (args.Exists(str => str.ToLower() == "-install"))
            {
                InstallService(args);
            }
            else if (args.Exists(str => str.ToLower() == "-uninstall"))
            {
                UninstallService();
            }
            else
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new WindowsService()
                };
                ServiceBase.Run(ServicesToRun);
            }
            while (true)
            {
                System.Threading.Thread.Sleep(60000);
            }
        }
Esempio n. 2
0
 protected override void OnStart(string[] args)
 {
     base.OnStart(args);
     AditService.Connect();
 }