private void UpdateValueWithInvoke(string text) { if (lblValue.InvokeRequired) { DelegateSetLabelText d = UpdateValueWithInvoke; Invoke(d, text); } else { try { var j = text.Split(' '); if (j.Length < 3) { return; } if (j[1] == "-") { j[1] = j[1] + j[2]; } Value = Convert.ToDouble(j[1]); } catch { // MessageBox.Show(@"Convert Error"); } } }
private void SetLabelText(Label label, string text) { if (label.InvokeRequired) { DelegateSetLabelText d = SetLabelText; Invoke(d, label, text); } else { label.Text = text; } }
private void UpdateValueWithInvoke(string text) { if (txtRead.InvokeRequired) { DelegateSetLabelText d = UpdateValueWithInvoke; Invoke(d, text); } else { try { BarcodeValue = text; } catch { // ignored } } }
public Form1() { InitializeComponent(); Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; m_DelegateSetLabelText = new DelegateSetLabelText(this.SetLabelCaption); m_DelegateSetProgressValue = new DelegateSetProgressValue(this.SetProgressValue); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); _cancomms = new ME7Communication(); _cancomms.onCanInfo += new ME7Communication.CanInfo(_comms_onCanInfo); _cancomms.onCanCount += new ME7Communication.CanCount(_cancomms_onCanCount); _cancomms.onWriteProgress += new ME7Communication.WriteProgress(_cancomms_onWriteProgress); _cancomms.onCanBusLoad += new ME7Communication.CanBusLoad(_cancomms_onCanBusLoad); _cancomms.setCANDevice("LAWICEL"); //TODO: Make this selectable _cancomms.onReadProgress += new ME7Communication.ReadProgress(_cancomms_onReadProgress); //_comms = new ME7KLineCommunication(); //_comms.LogFolder = Application.StartupPath; //_comms.EnableLogging = true; //_comms.onStatusChanged += new ICommunication.StatusChanged(_comms_onStatusChanged); //_comms.onECUInfo += new ICommunication.ECUInfo(_comms_onECUInfo); }
public void SetLabelText(string text,Label label) { DelegateSetLabelText method = new DelegateSetLabelText((x,l) => l.Text = x); this.Invoke(method, text, label); }