//4.编写事件处理程序 void HostHandleAlarm(object sender, bool isLink, EventArgs e) { string link = "已连接"; if (!isLink) { link = "未连接"; } Console.WriteLine($"Push{sender}" + link); Console.WriteLine("主人: 抓住了小偷!" + sender); foreach (var item in push1.GetLink()) { Console.WriteLine("列表" + JsonHelper.SerializeObject(item.Key) + "_____" + JsonHelper.SerializeObject(item.Value.ToString())); } listBox1_links.Invoke(new SetListCallback(SetList), push1.GetLink()); }