public void refresh() { foreach (KeyValuePair <string, object[]> keyValue in dicTcpIpAgentInfo) { PictureBox pic_conn = keyValue.Value[0] as PictureBox; PictureBox pic_comm = keyValue.Value[1] as PictureBox; Label lbl_conn_time = keyValue.Value[2] as Label; Label lbl_disConn_time = keyValue.Value[3] as Label; Label lbl_disConnTimes = keyValue.Value[4] as Label; Label lbl_lostPackets = keyValue.Value[5] as Label; CheckBox ck_check_box = keyValue.Value[6] as CheckBox; bool IsListening = false; bool IsCommunication = false; bool IsConnections = false; DateTime connTime; TimeSpan accConnTime; DateTime disConnTime; TimeSpan accDisConnTime; int disconnTimes = 0; int lostPackets = 0; //Equipment eq = form.BCApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID(keyValue.Key); AVEHICLE eq = form.BCApp.SCApplication.getEQObjCacheManager().getVehicletByVHID(keyValue.Key); eq.getAgentInfo(form.BCApp.SCApplication.getBCFApplication(), out IsListening, out IsCommunication, out IsConnections, out connTime, out accConnTime, out disConnTime, out accDisConnTime, out disconnTimes, out lostPackets); pic_comm.Image = IsCommunication ? Pic_Ball_Green : Pic_Ball_Rad; pic_conn.Image = IsConnections ? Pic_Ball_Green : Pic_Ball_Rad; string connInfo = string.Format("{0}\n({1})", accConnTime.ToString("d'd 'h'h 'm'm 's's'"), connTime.ToString(SCAppConstants.DateTimeFormat_11)); lbl_conn_time.Text = connInfo; string disConnInfo = string.Format("{0}\n({1})", accDisConnTime.ToString("d'd 'h'h 'm'm 's's'"), disConnTime.ToString(SCAppConstants.DateTimeFormat_11)); lbl_disConn_time.Text = disConnInfo; lbl_disConnTimes.Text = disconnTimes.ToString(); lbl_lostPackets.Text = lostPackets.ToString(); ck_check_box.Checked = IsListening; } }