//CancellationTokenSource fsToken; public IceQuartzScheduler() { InitializeComponent(); CastleWindsorService.Init(); LogsAppendersManager.Instance.Info(this.GetType(), MethodBase.GetCurrentMethod(), "Service inizilization"); _service = CastleWindsorService.Resolve <QuartzService>(); _service.Init(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); CastleWindsorService.Init(); var jobsInspector = new Jobs.JobsInspector() { Name = "Inspector", Group = "InspectorGroup", Description = "Jobs che si occupa di controllare se i job dai clienti stanno eseguendo correttamente", Triggers = new List <TasksEverywhere.Quartz.Context.Jobs.Abstract.ICustomTrigger> { new Quartz.Context.Jobs.Concrete.CustomTrigger { Name = "InspectorTrigger", Group = "InspectorTriggerGroup", Interval = 1, IntervalUnit = IntervalUnit.Minute, Life = 23, LifeUnit = IntervalUnit.Hour, Period = TasksEverywhere.Utilities.Enums.PeriodType.Settimanale, StartDate = DateTime.Parse("12/01/2019 00:00:00"), WeekDays = new List <DayOfWeek> { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday }, } } }; var quartzService = CastleWindsorService.Resolve <Quartz.Services.QuartzService>(); quartzService.Init(); quartzService.AddJob(jobsInspector); quartzService.Start(); using (var _context = new QuartzExecutionDataContext()) { var account = new Account { Username = "******", Password = "******", Roles = RoleType.AdminAndInspector }; if (_context.Accounts .Where(x => x.Username == account.Username) .FirstOrDefault() == null) { _context.Accounts.Add(account); } _context.SaveChanges(); } try { WebSocketClient.Init(ConfigurationManager.AppSettings["WebSocketUrl"]); } catch (Exception e) { LogsAppendersManager.Instance.Error(this.GetType(), MethodBase.GetCurrentMethod(), e.Message, e); } }