private void OnNotifyEvent(Agent agent, NotifyEvent ne, string msg) { this.SafeInvoke(() => { if (NotifyEvent.Connected == ne) { string logger = agent.ToString() + " 已连接"; this.statusStrip1.Items[1].Text = logger; Log.GetLogFile(Program.System).Log(logger); } else if (NotifyEvent.ConnectError == ne) { this.statusStrip1.Items[1].Text = msg; Log.GetLogFile(Program.System).Log(msg); } else if (NotifyEvent.ConnectToCountryCenter == ne) { // this.StartConnectCountryCenter(); this.listBox1.Items.Add(msg); Log.GetLogFile(Program.System).Log(msg); } else if (NotifyEvent.DisconnectToCountryCenter == ne) { // this.StopConnectCountryCenter(); this.listBox1.Items.Add(msg); Log.GetLogFile(Program.System).Log(msg); } }); }
private void OnReceiveMessage(Agent agent, string msg) { this.SafeInvoke(() => { string line = string.Format("{0}: {1}", "Agent.ToString()", msg); this.listBox1.Items.Add(line); }); }
private Agent CreateAgent(Settings.DataCenter2 dataCenter) { Agent agent = new Agent(dataCenter.Ip, dataCenter.Port); return agent; }