public override void sendPacket() { System.Random r = new Random(); ushort packet_size = 0; ushort samples = 0; for (int index = 1; index < simVersions.Length; ++index) { samples += (ushort)(simVersions[index] ? 1 : 0); } ShowStatusDelegate showStatus = new ShowStatusDelegate(ShowStatus); if (statusLine != null) { msg.AppendFormat("Sending packet - sFlow {0} sample", samples); if (!statusLine.InvokeRequired) { statusLine.Text = msg.ToString(); } else { statusLine.Invoke(showStatus, new object[] { msg.ToString() }); } msg.Remove(0, msg.Length); } packet_size = createPacket(samples); udpServer.sendPacket(ref packet, packet_size); ++sequence; }
/// <summary> /// Updates status. Possibly async /// </summary> internal void ShowStatus(string message) { if (!statusBar.InvokeRequired) { statusBar.Panels[1].Text = message; } else { // Show status asynchronously ShowStatusDelegate showStatus = new ShowStatusDelegate(ShowStatus); BeginInvoke(showStatus, new object[] { message }); } }
protected void ShowStatus(string status) { if (statusLine.InvokeRequired == false) { statusLine.Text = status; } else { // Show progress asynchronously ShowStatusDelegate showStatus = new ShowStatusDelegate(ShowStatus); statusLine.Invoke(showStatus, new object[] { status }); } }
public MainForm() { InitializeComponent(); FormLog = new LogForm(); CurrentFilter = new DocumentFilter(); AddDocumentToGridDelegate = new AddDocumentGridDelegate(AddDocumentGrid); delShowStatusDelegate = new ShowStatusDelegate(ShowStatusMessage); if (File.Exists("config.xml")) { LoadFromConfig("config.xml"); //UpdateDocList(); } StopSearch = true; }
private void ShowStatus(string strText) { // // check if we are running on the UI thread // if (this.InvokeRequired == false) { pnlGView.lblStatus.Text = strText; pnlGView.lblStatus.Refresh(); } else { // // we aren't on the UI thread so we call ourselves on the UI thread // ShowStatusDelegate showStatus = new ShowStatusDelegate(ShowStatus); this.Invoke(showStatus, new object[] { strText }); } }
/// <summary> /// 写状态日志信息 /// </summary> /// <param name="msg"></param> private void logStatus(string msg) { if (chkRichBox.Checked) { if (brwStatus.InvokeRequired) { ShowStatusDelegate d = new ShowStatusDelegate(logStatus); brwStatus.Invoke(d, msg); } else { string info = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + msg; statusLogBuf.Append(info); brwStatus.DocumentText = searchKeyWord(txtKeyword.Text).ToString(); // 滚动至底 //brwStatus.Document.Window.ScrollTo(0, brwStatus.Document.Body.ScrollRectangle.Height); } } else { if (txtStatus.InvokeRequired) { ShowStatusDelegate d = new ShowStatusDelegate(logStatus); txtStatus.Invoke(d, msg); } else { string info = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + msg; statusLogBuf.Append(info); txtStatus.Clear(); txtStatus.AppendText(searchKeyWord(txtKeyword.Text).ToString()); } } }
/// <summary> /// Updates status. Possibly async /// </summary> internal void ShowStatus(string message) { if (!statusBar.InvokeRequired) statusBar.Panels[1].Text = message; else { // Show status asynchronously ShowStatusDelegate showStatus = new ShowStatusDelegate(ShowStatus); BeginInvoke(showStatus, new object[] { message }); } }