public void updateTime(String displayTime) { if (start == 0) { return; } //Console.WriteLine("updating time"); if (this.clockDisplayedText.InvokeRequired) { clockDisplayedText.Invoke(new MethodInvoker(delegate { this.clockDisplayedText.Text = displayTime; })); } //this.clockDisplayedText.Text = displayTime; if (trainModelWindow != null) { Invoke(new MethodInvoker(delegate { trainModelWindow.updateTime(displayTime); })); } if (mainOffice != null) { Invoke(new MethodInvoker(delegate { mainOffice.updateTime(displayTime); })); } if (MBOWindow != null) { Invoke(new MethodInvoker(delegate { MBOWindow.updateTime(displayTime); })); } }
/* * called by trainSimulator * then updates other modules with time */ public void updateTime(String time) { updateTimeLabel.Text = time; for (int i = 1; i <= trainCounter; i++) { tm_window = trainModelArray[i]; if (tm_window != null) { Invoke(new MethodInvoker(delegate { tm_window.updateTime(time); })); } } }