static void Main(string[] args) { if (System.Environment.UserInteractive) { string parameter = string.Concat(args); if (args == null || args.Length == 0) { Console.WriteLine("请输入操作指令(-i、-u、-start、-stop):"); parameter = Console.ReadLine(); } switch (parameter) { case "-i": ServiceHelper.InstallWindowsService(); break; case "-u": ServiceHelper.UninstallWindowsService(); break; case "-start": ServiceHelper.StartService(); break; case "-stop": ServiceHelper.StopService(); break; case "-debug": MarketingManageCenter.InitStoreMarketing(); Console.WriteLine("促销启动!"); ProductCacheManager.Subscribe(); Console.WriteLine("产品缓存变更订阅已启动!"); //RechargeGiftsManager.Start(); //Console.WriteLine("充值赠送已启动!"); QuanChengTaoIntegralRuleService.Run(); Console.WriteLine("积分规则运算已启动!"); Console.ReadLine(); break; } } else { ServiceBase[] servicesToRun; servicesToRun = new ServiceBase[] { new ERPService() }; ServiceBase.Run(servicesToRun); } }
protected override void OnStart(string[] args) { MarketingManageCenter.InitStoreMarketing(); ProductCacheManager.Subscribe(); QuanChengTaoIntegralRuleService.Run(); }