static void Main(string[] args) { SetupConstants(); Initializer(); GlobalClock.GetInstance().Start(1, noOfStations); Console.Read(); }
private void btnStartSimulator_Click(object sender, EventArgs e) { try { if (btnSaveSetting.Enabled) { btnSaveSetting.Enabled = false; StartSimulator(); } GlobalClock.GetInstance().Start(_timer, _noOfStations); btnStartSimulator.Enabled = false; } catch (Exception exp) { MessageBox.Show(exp.Message); } }
private void CleanUp() { try { StationShipmentHandler.ShipmentQueuedAtStation -= UpdateShipmentQueuingAtStation; TrainSystemSimulator.TrainProgressEvent -= UpdateTrackIdWithTrainProgress; TrainSystemSimulator.TrainShipmentLoadEvent -= UpdateShipmentLoadedIntoTrainProgress; TrainSystemSimulator.TrainShipmentUnloadEvent -= UpdateShipmentUnloadedFromTrainProgress; TrainSystemSimulator.TrainArrivedAtStationEvent -= UpdateTrainArrivalAtUI; TrainSystemSimulator.TrainOtherEvent -= UpdateTrainOtherEventsAtUI; Station.ShipmentDequeuedFromStation -= UpdateShipmentDequeueFromStation; TrainSystemSimulator.GetInstance().CleanUp(); StationShipmentHandler.GetInstance().CleanUp(); GlobalClock.GetInstance().Cleanup(); } catch (Exception exp) { MessageBox.Show(exp.Message); } }