private void StartMultiThread() { textBoxDelegate = new UpdateTextBoxDelegate(UpdateCurrentMeasure); vwapDelegate = new UpdateVWAPDelegate(UpdateVWAP); botsList[0].Strategy.MainCurve.OnCurrentMeasuresUpdate += UpdateMainRSIandPlot; botsList[0].Strategy.UpperCurve.OnCurrentMeasuresUpdate += UpdateUpperRSIandPlot; updateTableDelegate = new UpdateTableDelegate(UpdateTableItems); }
private void UpdateTextBox(string Tex) { if (this.InvokeRequired) { UpdateTextBoxDelegate del = new UpdateTextBoxDelegate(UpdateTextBox); object[] args = { Tex }; this.Invoke(del, args); } else { //tb.Text &= Tex & Environment.NewLine idetect.Text += Tex; idetect.Text = idetect.Text.Replace(" ", ""); } }
private void UpdateTextBox(String Text, Label Control) { if (Control.InvokeRequired) { try { UpdateTextBoxDelegate UT = new UpdateTextBoxDelegate(UpdateTextBox); this.BeginInvoke(UT, new object[] { Text, Control }); } catch (Exception ex) { } } else { Control.Text = Text; this.Refresh(); } }
public void UpdateTextBox5(String str) { UpdateTextBoxDelegate d = new UpdateTextBoxDelegate(UpdataTextBox5); this.BeginInvoke(d, str); }
private void UpdateTextBox(string Tex) { if (this.InvokeRequired) { UpdateTextBoxDelegate del = new UpdateTextBoxDelegate(UpdateTextBox); object[] args = { Tex }; this.Invoke(del, args); } else { //tb.Text &= Tex & Environment.NewLine getenvbox.Text += Tex; getenvbox.Text = getenvbox.Text.Replace(" ", ""); CurrentAddr = ""; CurrentAddr = getenvbox.Text; //MsgBox(CurrentAddr) } }
private void UpdateTextBox_shsh(string Tex) { if (this.InvokeRequired) { UpdateTextBoxDelegate del_shsh = new UpdateTextBoxDelegate(UpdateTextBox_shsh); object[] args = { Tex }; this.Invoke(del_shsh, args); } else { shshblob.Text += Tex; shshblob.Text = shshblob.Text.Replace(" ", ""); } }
public static void UpdateTextBox(Object form, string message) { try { //目前读码器读出的数据格式一般分为两种,一种时读出的量具编号,另一种时接箍编号、炉号、批号的拼接(空格拼接) //如果当前读码器读出的是量具编号 if (ThreadingForm.isMeasuringToolTabSelected) { //判断是否是跨线程访问控件 if (AlphabetKeyboardForm.getForm().Textbox_display.InvokeRequired) { UpdateTextBoxDelegate md = new UpdateTextBoxDelegate(UpdateTextBox); // AlphabetKeyboardForm.getForm().Textbox_display.Invoke(md, new object[] { (object)AlphabetKeyboardForm.getForm(), message }); AlphabetKeyboardForm.getForm().Textbox_display.BeginInvoke(new Action(() => { AlphabetKeyboardForm.getForm().Textbox_display.Text = message; })); } else { //设置英文输入法中输入的内容为读码器读出的内容 AlphabetKeyboardForm.getForm().Textbox_display.Text = message; } } else { //将读码器读出的数据以空格分隔 string[] strArr = Regex.Split(message, "\\s+"); string argHeatNo = string.Empty, argBatchNo = string.Empty, argCoupingNo = string.Empty; //如果读码器读接箍内容则读出的数据格式目前如:"12323 43434 5454 5454" if (strArr.Length >= 1) { if (strArr.Length > 3) { argHeatNo = strArr[1]; //炉号 argBatchNo = strArr[2]; //批号 argCoupingNo = strArr[3]; //接箍编号 //判断是否是跨线程访问控件 if (ThreadingForm.getMyForm().txtCoupingNo.InvokeRequired) { UpdateTextBoxDelegate md = new UpdateTextBoxDelegate(UpdateTextBox); //设置表单上接箍编号、炉号、批号控件内容 if (!string.IsNullOrWhiteSpace(argCoupingNo)) { ThreadingForm.getMyForm().txtCoupingNo.BeginInvoke(new Action(() => { ThreadingForm.getMyForm().txtCoupingNo.Text = argCoupingNo; })); } //ThreadingForm.getMyForm().txtCoupingNo.Invoke(md, new object[] { ThreadingForm.getMyForm(), argCoupingNo }); if (!string.IsNullOrWhiteSpace(argHeatNo)) { ThreadingForm.getMyForm().txtHeatNo.BeginInvoke(new Action(() => { ThreadingForm.getMyForm().txtHeatNo.Text = argHeatNo; })); } //ThreadingForm.getMyForm().txtHeatNo.Invoke(md, new object[] { ThreadingForm.getMyForm(), argHeatNo }); if (!string.IsNullOrWhiteSpace(argBatchNo)) { ThreadingForm.getMyForm().txtBatchNo.BeginInvoke(new Action(() => { ThreadingForm.getMyForm().txtBatchNo.Text = argBatchNo; })); } //ThreadingForm.getMyForm().txtBatchNo.Invoke(md, new object[] { ThreadingForm.getMyForm(), argBatchNo }); } else { //设置表单上接箍编号、炉号、批号控件内容 if (!string.IsNullOrWhiteSpace(argCoupingNo)) { ThreadingForm.getMyForm().txtCoupingNo.Text = argCoupingNo; } if (!string.IsNullOrWhiteSpace(argHeatNo)) { ThreadingForm.getMyForm().txtHeatNo.Text = argHeatNo; } if (!string.IsNullOrWhiteSpace(argBatchNo)) { ThreadingForm.getMyForm().txtBatchNo.Text = argBatchNo; } } } } else//数字键盘 { //判断是否是跨线程访问控件 if (NumberKeyboardForm.getForm().Textbox_display.InvokeRequired) { UpdateTextBoxDelegate md = new UpdateTextBoxDelegate(UpdateTextBox); NumberKeyboardForm.getForm().Textbox_display.BeginInvoke(new Action(() => { NumberKeyboardForm.getForm().Textbox_display.Text = message; })); //NumberKeyboardForm.getForm().Textbox_display.Invoke(md, new object[] { (object)NumberKeyboardForm.getForm(), message }); } else { //设置数值输入法中输入的内容为读码器读出的内容 NumberKeyboardForm.getForm().Textbox_display.Text = message; } //设置当前焦点所在文本框内容 if (ThreadingForm.fpcusTxt != null) { if (ThreadingForm.fpcusTxt.InvokeRequired) { UpdateTextBoxDelegate md = new UpdateTextBoxDelegate(UpdateTextBox); ThreadingForm.fpcusTxt.BeginInvoke(new Action(() => { ThreadingForm.fpcusTxt.Text = message; })); //ThreadingForm.fpcusTxt.Invoke(md, new object[] { (object)ThreadingForm.getMyForm(), message }); } else { //设置英文输入法中输入的内容为读码器读出的内容 ThreadingForm.fpcusTxt.Text = message; } } } } } catch (Exception ex) { } }