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 }); }
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 }); }
//用于定时回收(回收耗费性能) //public static int ClearTimeCount = 0; private void ProfilerThread(Object state) { MyInvoke mi = new MyInvoke(UpdateForm); MyInvoke2 mi2 = new MyInvoke2(AfterStepExec); try { while (!m_NeedStop && m_Rdr.TraceIsActive) { ProfilerEvent evt = m_Rdr.Next(); if (evt != null) { //lbSPID.Text=evt.SPID.ToString(); this.BeginInvoke(mi, new Object[] { evt.SPID.ToString(), "test" }); lock (this) { m_events.Enqueue(evt); } //回收耗费性能,不建议使用。 //定时清理回收 //ClearTimeCount++; //if (ClearTimeCount > 100) //{ // ClearMemory(); // ClearTimeCount = 0; //} if (BIsStepExec) { StepLoop++; if (StepLoop > StepCounts) { //置为初始 BIsStepExec = false; StepCounts = 0; StepLoop = 0; this.BeginInvoke(mi2, new Object[] { "param1", "param2" }); return; } } } } } catch (Exception e) { lock (this) { if (!m_NeedStop && m_Rdr.TraceIsActive) { m_profilerexception = e; } } } mi = null; //ClearMemory(); }