Beispiel #1
0
 public static void RemovePlan(ZeroPlan plan)
 {
     if (Plans.TryGetValue(plan.plan_id, out var old))
     {
         Plans.Remove(plan.plan_id);
         plan.plan_state = plan_message_state.remove;
         WebSocketNotify.Publish("plan_notify", "remove", JsonConvert.SerializeObject(plan));
     }
 }
Beispiel #2
0
        public static void SyncPlan(ZeroPlan plan)
        {
            if (Plans.ContainsKey(plan.plan_id))
            {
                Plans[plan.plan_id] = plan;
            }
            else
            {
                Plans.Add(plan.plan_id, plan);
            }

            WebSocketNotify.Publish("plan_notify", "add", JsonConvert.SerializeObject(plan));
        }
Beispiel #3
0
 public static void UpdatePlan(ZeroPlan plan)
 {
     if (Plans.TryGetValue(plan.plan_id, out var old))
     {
         old.exec_time  = plan.exec_time;
         old.exec_state = plan.exec_state;
         old.plan_state = plan.plan_state;
         old.plan_time  = plan.plan_time;
         old.real_repet = plan.real_repet;
         old.skip_set   = plan.skip_set;
         old.skip_num   = plan.skip_num;
         WebSocketNotify.Publish("plan_notify", "update", JsonConvert.SerializeObject(plan));
     }
 }
Beispiel #4
0
        public static void OnPlanEvent(ZeroNetEventType eventType, ZeroPlan plan)
        {
            switch (eventType)
            {
            case ZeroNetEventType.PlanAdd:
                SyncPlan(plan);
                break;

            case ZeroNetEventType.PlanRemove:
                RemovePlan(plan);
                break;

            default:
                UpdatePlan(plan);
                break;
            }
        }