private void ShowMsg(String msgstring,int showui) { if (InvokeRequired) { EventArgs e = new MyProgressEvents(msgstring,showui); MyProgressEventsHandler mh = UpdateUI; object[] pList = { e }; BeginInvoke(mh, pList);//异步执行了,不用加同步锁 } else { UpdateUI(new MyProgressEvents(msgstring,showui)); } }
private void UpdateUI(MyProgressEvents e) { if (e.showUi==0) { text_info.Text = e.msgString + "\n"; } if (e.showUi == 1) { label_cilentnum.Text = e.msgString; } if (e.showUi == 2) { label_serverinfo.Text = e.msgString; } }
private void UpdateUI(object sender, MyProgressEvents e) { try { if (e.Status != "") { frm.WaitingLabel = e.Status; } else { frm.Close(); this.Close(); } } catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void UpdateUI(object sender, MyProgressEvents e) { //this.label1.Text = e.Msg; //this.progressBar1.Value = e.PercentDone; try { if (e.Status != "") { frm.WaitingLabel = e.Status; // frm.Show(); } else { frm.Close(); this.Close(); } } catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void UIWaiting(string status) { System.EventArgs e = new MyProgressEvents(status); object[] pList = { this, e }; BeginInvoke(new MyProgressEventsHandler(UpdateUI), pList); }
private void UpdateUI(MyProgressEvents e) { if (e.showUi == MyConfig.INT_UPDATE_UI_LOG) { txt_info.Text = e.msgString + System.Environment.NewLine + txt_info.Text; if(txt_info.TextLength>=50000) { txt_info.Text = ""; } } if (e.showUi == MyConfig.INT_UPDATE_UI_CLIENT_NUM) { label_cilentnum.Text = e.msgString; } if (e.showUi == MyConfig.INT_UPDATE_UI_SERVER_INFO) { label_serverinfo.Text = e.msgString; } if (e.showUi == MyConfig.INT_UPDATE_UI_ADD_CLIENT) { clients.Items.Add(e.msgString); } if (e.showUi == MyConfig.INT_UPDATE_UI_REMOVE_CLIENT) { clients.Items.Remove(e.msgString); } }