private void OnReceiveMessage(Agent agent, string msg) { if (!this.keepAliveCheckBox.Checked && ("6031" == Value.Parse(msg, "CN"))) { return; } this.SafeInvoke(() => { string line = string.Format("{0}: {1}", agent.ToString(false), msg); this.listBox1.Items.Add(line); }); }
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); } }); }