/// <summary> /// Safely update the label on this form /// Update the label with the current temperature that is fetched from the subject by the observer /// </summary> public void Update() { if (this.InvokeRequired) { SetLabelSub Del = new SetLabelSub(Update); this.Invoke(Del, new object[] { }); } else { label2.Text = Convert.ToString(oven.getTemp()); } }
/// <summary> /// Receives all the parameters defined to the observer from the subject /// </summary> /// <param name="temp"></param> /// <param name="maxTemp"></param> public void Update(int temp, int maxTemp) { if (this.InvokeRequired) { SetLabelSub Del = new SetLabelSub(Update); this.Invoke(Del, new object[] { temp, maxTemp }); } else { label2.Text = "" + temp; this.desiredTemp = maxTemp; label4.Text = "" + desiredTemp; this.progressBar1.Value = temp; this.progressBar1.Maximum = this.desiredTemp; } }