public MainWindow() { InitializeComponent(); // 设置当前线程的名称 Thread.CurrentThread.Name = "MainWindow"; this.DataContext = this; // 初始化数据库连接 dbTool = new DatabaseTool("monitor", "sa", "sa", "localhost"); nowTextBlock.Text = DateTime.Now.ToShortDateString(); nowText = nowTextBlock.Text; // 初始化节点树 initTree(); // 异步接收 e = new IPEndPoint(IPAddress.Any, 5999); u = new UdpClient(e); s = new UdpState(); s.e = e; s.u = u; }