/// <summary>
        /// Register a client.
        /// </summary>
        /// <param name="name"></param>
        public void AddClient(string name)
        {
            if (name != null)
            {
                log.Info(string.Format("Adding client '{0}'", name));
                lock (clients)
                {
                    var ci = new ClientInfo();
                    ci.Name              = name;
                    ci.MsgQueue          = new List <Message>();
                    ci.lastActivityTicks = DateTime.UtcNow.Ticks;

                    clients[name] = ci;

                    // inform new clients about current shared state
                    ci.MsgQueue.Add(new PlanRepoMessage(PlanRepo));
                    if (!string.IsNullOrEmpty(CurrentPlanName))
                    {
                        ci.MsgQueue.Add(new CurrentPlanMessage(CurrentPlanName));
                    }

                    // send state of all plans as gathered by the local agent
                    {
                        var d = new Dictionary <string, PlanState>();
                        foreach (var p in PlanRepo)
                        {
                            d[p.Name] = localAgent.GetPlanState(p.Name);                            // invoke callbeck to get current plan
                        }

                        ci.MsgQueue.Add(new PlansStateMessage(d));
                    }
                }
            }
        }
Esempio n. 2
0
 public PlanState GetPlanState(string planName)
 {
     return(impl.GetPlanState(planName));
 }
Esempio n. 3
0
 public PlanState GetPlanState(string planName)
 {
     return(localOps.GetPlanState(planName));
 }