private void UpdateLabel(string text) { if (this.label1.InvokeRequired) { UpdateLabelCallback cb = new UpdateLabelCallback(UpdateLabel); this.Invoke(cb, new object[] { text }); } else { this.label1.Text = text; } }
/// <summary> /// Update text of the label on the form /// </summary> /// <param name="label">Label</param> /// <param name="text">Text</param> private void UpdateLabel(Label label, string text) { if (label.InvokeRequired) { var d = new UpdateLabelCallback(UpdateLabel); Invoke(d, label, text); } else { label.Text = text; } }
private void UpdateLabels(int GamesWon, int GamesLost, string StatusText) { if (lblGamesWon.InvokeRequired || lblGamesLost.InvokeRequired || lblGameStatus.InvokeRequired) { var d = new UpdateLabelCallback(UpdateLabels); lblGamesWon.Invoke(d, new object[] { GamesWon, GamesLost, StatusText }); } else { lblGamesWon.Text = GamesWon.ToString(); lblGamesLost.Text = GamesLost.ToString(); lblGameStatus.Text = StatusText; } }
public void UpdateLabel(Label control, string value) { if (control.InvokeRequired) { while (!control.IsHandleCreated) { if (control.Disposing || control.IsDisposed) { return; } } UpdateLabelCallback updateLabelDelegate = new UpdateLabelCallback(UpdateLabel); control.Invoke(updateLabelDelegate, new object[] { control, value }); } else { control.Text = value; } }
private void UpdateLabel(string text) { if (label1.InvokeRequired) { var cb = new UpdateLabelCallback(UpdateLabel); Invoke(cb, new object[] { text }); } else label1.Text = text; }
/// <summary> /// Set the text of the specified results label (thread safe) /// </summary> /// <param name="labelID"></param> /// <param name="data"></param> private void SetLabelValue(Calculations labelID, object data) { if (this.InvokeRequired) { UpdateLabelCallback callback = new UpdateLabelCallback(SetLabelValue); object[] args = new object[2]; args[0] = labelID; args[1] = data; this.Invoke(callback, args); } else { Label label = _calcValueLabels[(int)labelID]; string labelText = ""; try { decimal value = (decimal)data; if (labelID == Calculations.SelectedValues) { labelText = value.ToString(); } else { labelText = new IskAmount(value).ToString(); } } catch { labelText = data.ToString(); } label.Text = labelText; } }
// Method to update a device status label, ensure cross-thread support, as Spokes events come in on a different thread private void UpdateDeviceStatusGUIItem(Control stateLbl, string statustext) { if (stateLbl.InvokeRequired) { UpdateLabelCallback d = new UpdateLabelCallback(UpdateDeviceStatusGUIItem); this.Invoke(d, new object[] { stateLbl, statustext }); } else { stateLbl.Text = statustext; } }
private void updateLabel(string text) { if (this.InvokeRequired) { UpdateLabelCallback callback = new UpdateLabelCallback(updateLabel); this.Invoke(callback, text); } else { this.CalcProgressLabel.Text = text; } }
private void UpdateCallIdGUI(Control mycontrol, string text) { if (mycontrol.InvokeRequired) { UpdateLabelCallback d = new UpdateLabelCallback(UpdateCallIdGUI); this.Invoke(d, new object[] { mycontrol, text }); } else { mycontrol.Text = text; } }