public static void SetLabel(Form f, Control c, string val) { if (c.InvokeRequired) { SetLabelText d = new SetLabelText(SetLabel); f.Invoke(d, new object[] { f, c, val }); } else { c.Text = val; } }
/// <summary> /// Allows another thread to change the text of a label in this form. /// </summary> /// <param name="Label"></param> /// <param name="NewText"></param> public void threadSafeLabelChanging(System.Windows.Forms.Label Label, string NewText) { if (DialogClosed) { return; } if (this.InvokeRequired) { SetLabelText i = new SetLabelText(setLabelText); this.Invoke(i, new object[] { Label, NewText }); } else { setLabelText(Label, NewText); } }
public DataChecksForm() { #region Init Deligate functions /**************************************************************************/ _updateProgressBar = new UpdateProgressBar(updateProgressBarState); _updateResults = new UpdateResults(updateResults); _updateLogBox = new UpdateLogBox(writeLog); _clearBeforeRun = new ClearBeforeRun(clearOnStart); _setButton = new SetButtonVisibility(setButtonVisibility); _incCounter = new IncCounter(IncreaseCounter); _setLabelText = new SetLabelText(SetLabel); /**************************************************************************/ #endregion DataChecksModelView = new DataChecksModelView(); EventsHandlers = new Dictionary <string, Object>(); //Adding Service Events Handler functions #region Attaching Services Events EventsHandlers.Add(Const.EventsTypes.ParentOutcomeReportedEvent, new EventHandler(instance_OutcomeReported)); //EventsHandlers.Add(Const.EventsTypes.ChildOutcomeReportedEvent, new EventHandler(instance_OutcomeReported)); EventsHandlers.Add(Const.EventsTypes.ParentStateChangedEvent, new EventHandler <Edge.Core.Services.ServiceStateChangedEventArgs>(instance_StateChanged)); EventsHandlers.Add(Const.EventsTypes.ChildStateChangedEvent, new EventHandler <ServiceStateChangedEventArgs>(child_instance_StateChanged)); EventsHandlers.Add(Const.EventsTypes.ChildServiceRequested, new EventHandler <ServiceRequestedEventArgs>(instance_ChildServiceRequested)); #endregion InitializeComponent(); //Load Validation Types from configuration DataChecksModelView.LoadValidationTypesItems(this.ValidationTypes.Nodes); //Load Metrics Validations from configuration DataChecksModelView.LoadMetricsValidationsItems(this.MerticsValidations.Nodes); this.LogBox.Multiline = true; }
public Form1() { InitializeComponent(); crawler.WriteMessageToLabel += new Crawler.MessageWrite(this.LabelMessageRefresh); set += setText; }