public void Initialize() { // Get server infos var serverInfos = this.Repository.GetServerInfos(); // Resolve instances foreach (var info in serverInfos) { var server = Resolver.Resolve<IServer2>(info.Id); ServerPair pair = new ServerPair(info, server); servers.TryAdd(info.Id, pair); } }
public void ProcessMessage(object message) { if (message is ReportLookUpInfoMessage) { ReportLookUpInfoMessage reportLookUpInfoMessage = message as ReportLookUpInfoMessage; if (this.parent.OnWaiting) { if (this.parent.CurrentNodeTier == 1) { this.parent.Invoke(new Action(delegate { this.parent.ReadyInsertion(); })); ServerPair[] serverlist = reportLookUpInfoMessage.serverlist; for (int i = 0; i < serverlist.Length; i++) { ServerPair v = serverlist[i]; this.parent.Invoke(new Action(delegate { this.parent.Insertion(string.Format("[{0}]{1}", v.code, v.category)); })); } this.parent.Invoke(new Action(delegate { this.parent.FinishInsertion(); })); } else { StringBuilder buffer = new StringBuilder(); foreach (ServerPair serverPair in reportLookUpInfoMessage.serverlist) { } buffer.AppendLine(); buffer.AppendLine(string.Format("{0} entites under this service.", reportLookUpInfoMessage.EntityCount)); this.parent.Invoke(new Action(delegate { this.parent.InvokeMessageBox(buffer.ToString()); })); } } } if (message is ReportUnderingListMessage) { ReportUnderingListMessage reportUnderingListMessage = message as ReportUnderingListMessage; this.parent.Invoke(new Action(delegate { this.parent.ReadyInsertion(); })); EntityGraphIdentifier[] serverlist3 = reportUnderingListMessage.serverlist; for (int k = 0; k < serverlist3.Length; k++) { EntityGraphIdentifier entityGraphIdentifier = serverlist3[k]; string output = ""; string arg; if (entityGraphIdentifier.entityID == (long)EntityGraphNode.ServiceEntityID) { arg = string.Format("{0},{1}", 0, EntityGraphNode.ServiceEntityID); } else { arg = string.Format("{0},{1}", entityGraphIdentifier.entityID >> 32, entityGraphIdentifier.entityID & (long)0xffffffffL); } if (entityGraphIdentifier.isCategoric) { output = string.Format("[{0}/{1}] {2}", entityGraphIdentifier.category, arg, entityGraphIdentifier.states); } if (entityGraphIdentifier.isNumeric) { output = string.Format("[{0}/{1}] {2}", entityGraphIdentifier.serviceID, arg, entityGraphIdentifier.states); } this.parent.Invoke(new Action(delegate { this.parent.Insertion(output, ""); })); } this.parent.Invoke(new Action(delegate { this.parent.FinishInsertion(); })); } if (message is ReportSelectMessage) { ReportSelectMessage m = message as ReportSelectMessage; if (m.serviceID == EntityGraphNode.BadServiceID) { this.parent.Invoke(new Action(delegate { this.parent.SelectException(); })); } this.parent.Invoke(new Action(delegate { this.parent.AdjustCurrentNode(m.serviceID, m.entityID); })); } if (message is ReportOperationTimeReportMessage) { ReportOperationTimeReportMessage m = message as ReportOperationTimeReportMessage; this.parent.Invoke(new Action(delegate { this.parent.InvokeGridBox(m.ReportString); })); } }