private void RunOnceFs() { dtxft = null; MyInvoke mi = new MyInvoke(UpdatePanfs); MyInvoke1 mi1 = new MyInvoke1(UpdateGridViewfs); MyInvoke2 mi2 = new MyInvoke2(UpdateLabelfs); MyInvoke3 mi3 = new MyInvoke3(UpdatePicturefs); this.BeginInvoke(mi3, new object[] { Properties.Resources.loading }); this.BeginInvoke(mi2, new object[] { "正在统计数据……" }); this.BeginInvoke(mi1, new object[] { dtfs }); this.BeginInvoke(mi, new object[] { true }); queryClass qc = new queryClass(); dtfs = qc.SelectFs(dtinput5.Value, dtinput6.Value, fsmchtid.Text.Trim(), fstermid.Text.Trim(), actnbr.Text.Trim()); this.BeginInvoke(mi3, new object[] { Properties.Resources.finishok }); this.BeginInvoke(mi1, new object[] { dtfs }); this.BeginInvoke(mi2, new object[] { "数据查询已完成" }); Thread.Sleep(1000); this.BeginInvoke(mi, new object[] { false }); }
private void RunOnce() { dt = null; MyInvoke mi = new MyInvoke(UpdatePan); MyInvoke1 mi1 = new MyInvoke1(UpdateGridView); MyInvoke2 mi2 = new MyInvoke2(UpdateLabel); MyInvoke3 mi3 = new MyInvoke3(UpdatePicture); this.BeginInvoke(mi3, new object[] { Properties.Resources.loading }); this.BeginInvoke(mi2, new object[] { "正在统计数据……" }); this.BeginInvoke(mi1, new object[] { dt }); this.BeginInvoke(mi, new object[] { true }); queryClass qc = new queryClass(); dt = qc.SelectDt(dtinput1.Value, dtinput2.Value, mchtid_text.Text, termid_text.Text); this.BeginInvoke(mi3, new object[] { Properties.Resources.finishok }); this.BeginInvoke(mi1, new object[] { dt }); this.BeginInvoke(mi2, new object[] { "数据查询已完成" }); Thread.Sleep(1000); this.BeginInvoke(mi, new object[] { false }); }
private void RunOnceXft() { dtxft = null; MyInvoke mi = new MyInvoke(UpdatePanxft); MyInvoke1 mi1 = new MyInvoke1(UpdateGridViewxft); MyInvoke2 mi2 = new MyInvoke2(UpdateLabelxft); MyInvoke3 mi3 = new MyInvoke3(UpdatePicturexft); this.BeginInvoke(mi3, new object[] { Properties.Resources.loading }); this.BeginInvoke(mi2, new object[] { "正在统计数据……" }); this.BeginInvoke(mi1, new object[] { dtxft }); this.BeginInvoke(mi, new object[] { true }); queryClass qc = new queryClass(); dtxft = qc.SelectXft(dtinput3.Value, dtinput4.Value, psam.Text, areatelno.Text); this.BeginInvoke(mi3, new object[] { Properties.Resources.finishok }); this.BeginInvoke(mi1, new object[] { dtxft }); this.BeginInvoke(mi2, new object[] { "数据查询已完成" }); Thread.Sleep(1000); this.BeginInvoke(mi, new object[] { false }); }
/// <summary> /// 从FC7002B接收数据,用tcp,包速过快导致粘包 /// </summary> /// <param name="s_command">发送的命令字符串</param> /// <returns>void</returns> private void OnDataReceived1(object sender, Communications.ChannelEventArgs e) { try { string retStr = HexBytesToString(e.Data, 0, e.Data.Length); MyInvoke mi = new MyInvoke(UpdateTextBox); MyInvoke1 mi1 = new MyInvoke1(UpdateDataGridView); pkt_num++; this.BeginInvoke(mi, new object[] { "报文" + pkt_num.ToString(), retStr, true }); //清空一部分缓存 if (dt.Rows.Count >= 40) { dt.Rows.Remove(dt.Rows[dt.Rows.Count - 1]); dataGridView1.DataSource = dt; } if (e.Data.Length < 3) { return; } int deal_len = 0; int pof = 0; while (deal_len < e.Data.Length) { int read_len = 0; if (e.Data[0 + pof] != 0x64 || e.Data[1 + pof] != 0x70 || e.Data[2 + pof] != 0x69) { return; } read_len += 3; UInt16 total_len = (UInt16)(((UInt16)e.Data[3 + pof] * 256) + (UInt16)(e.Data[4 + pof])); read_len += 2; DataRow dr = dt.NewRow(); while (total_len - read_len > 0) { if (checkBox_utf8.Checked) { parse_tlv_data(e.Data, pof, total_len, ref read_len, dr); } else { parse_tlv_data_gbk(e.Data, pof, total_len, ref read_len, dr); } } dr["序号"] = ++rlt_num; dt.Rows.InsertAt(dr, 0); this.BeginInvoke(mi1, new object[] { }); deal_len += total_len; } return; } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// ��FC7002B�������ݣ���tcp�����ٹ��쵼��ճ�� /// </summary> /// <param name="s_command">���͵������ַ���</param> /// <returns>void</returns> private void OnDataReceived1(object sender, Communications.ChannelEventArgs e) { try { string retStr = HexBytesToString(e.Data, 0, e.Data.Length); MyInvoke mi = new MyInvoke(UpdateTextBox); MyInvoke1 mi1 = new MyInvoke1(UpdateDataGridView); pkt_num++; this.BeginInvoke(mi, new object[] { "����" + pkt_num.ToString(), retStr, true }); //���һ���ֻ��� if (dt.Rows.Count >= 40) { dt.Rows.Remove(dt.Rows[dt.Rows.Count - 1]); dataGridView1.DataSource = dt; } if (e.Data.Length < 3) { return; } int deal_len = 0; int pof = 0; while (deal_len < e.Data.Length) { int read_len = 0; if (e.Data[0 + pof] != 0x64 || e.Data[1 + pof] != 0x70 || e.Data[2 + pof] != 0x69) { return; } read_len += 3; UInt16 total_len = (UInt16)(((UInt16)e.Data[3 + pof] * 256) + (UInt16)(e.Data[4 + pof])); read_len += 2; DataRow dr = dt.NewRow(); while (total_len - read_len > 0) { if (checkBox_utf8.Checked) { parse_tlv_data(e.Data, pof, total_len, ref read_len, dr); } else { parse_tlv_data_gbk(e.Data, pof, total_len, ref read_len, dr); } } dr["���"] = ++rlt_num; dt.Rows.InsertAt(dr, 0); this.BeginInvoke(mi1, new object[] { }); deal_len += total_len; } return; } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }