Exemple #1
0
 protected void Application_Start()
 {
     //跨域支持
     GlobalConfiguration.Configuration.EnableCors(new EnableCorsAttribute("*", "*", "*")
     {
         SupportsCredentials = true
     });
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     scheduleTask = new ScheduleTask(this.Context);
     scheduleTask.Start();
 }
Exemple #2
0
 public bool ScheduleAndStart(ScheduleTask task)
 {
     if (_root.Children.Contains(task))
     {
         return(false);
     }
     _idToTask.TryAdd(task.ObjectId, task);
     _root.Children.Add(task);
     task.Parent   = _root;
     task.Updated += TaskOnUpdated;
     task.Start();
     return(true);
 }