private void UpdateGUI(object sender, TickEventArgs e) { if (InvokeRequired) { Invoke(new Action<object, TickEventArgs>(UpdateGUI), sender, e); return; } _logOutput.Text = _currentTrainController.Log; }
private void _environment_Tick(object sender, TickEventArgs e) { timer++; if (timer % 10 == 0) { timer = 0; UpdateGUI(sender, e); } }
private void ETick(object sender, TickEventArgs e) { _routes = Tc.Routes; var newTrains = Tc.Trains; var newBlocks = Tc.Blocks; if (newTrains.Count != _trains.Count) { _trains = Tc.Trains; _blocks = Tc.Blocks; Draw(); } else { for (var i = 0; i < _trains.Count; i++) { if (_trains[i].TrainID != newTrains[i].TrainID) { _trains = Tc.Trains; _blocks = Tc.Blocks; Draw(); } } } if (newBlocks.Count != _blocks.Count) { _trains = Tc.Trains; _blocks = Tc.Blocks; Draw(); } else { for (var i = 0; i < _blocks.Count; i++) { if (_blocks[i].State != newBlocks[i].State) { _trains = Tc.Trains; _blocks = Tc.Blocks; Draw(); } } } if (_tickCount % 4 == 0) { if (!_disableDraw) Draw(); } _tickCount++; }
/// <summary> /// Updates the GUI. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Tick event args</param> private void _environment_Tick(object sender, TickEventArgs e) { _timer++; if (_timer % _GUIUpdate == 0) { _timer = 0; if (!_dropDownOpen && !_GUIPaused) { UpdateGUI(); } } }
private void EnvTick(object sender, TickEventArgs e) { _trains.Clear(); // Find all the trains within the TrackCircuits area foreach (var t in _env.AllTrains) { if (!_trains.ContainsKey(t.TrainID) && _blocks.ContainsKey(t.CurrentBlock.BlockID) && String.Compare(t.CurrentBlock.Line, _line, StringComparison.Ordinal) == 0) _trains.Add(t.TrainID, t); } }
/// <summary> /// Function to handle Environment Tick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _environment_Tick(object sender, TickEventArgs e) { _tickCount++; RefreshStatus(); if ((_tickCount >= _rate)) { UpdateMetrics(); _tickCount = 0; } }
//Handle environment tick private void _environment_Tick(object sender, TickEventArgs e) { //handle tick here }
void _env_Tick(object sender, TickEventArgs e) { // }
// A tick has elasped so we need to do work private void EnvTick(object sender, TickEventArgs e) { if (_next == null) { var trains = _circuit.Trains; var differences = trains.Where(x => _circuit.Trains.All(x1 => x1.Key != x.Key)) .Union(_circuit.Trains.Where(x => trains.All(x1 => x1.Key != x.Key))); foreach (var k in differences) { _env.AllTrains.Remove(k.Value); } } _trains = _circuit.Trains; _blocks = _circuit.Blocks; // Randomly create broken blocks //if (Random.Next(Max) > Max * 0.999) //{ // IBlock broken; // if (_blocks.TryGetValue(Random.Next(_blocks.Count - 1), out broken)) // { // broken.State = StateEnum.BrokenTrackFailure; // _updateBlocks.Add(broken.BlockID, broken); // } //} PlcDoWork(); }
private static void e_Tick(object sender, TickEventArgs e) { counter++; }
/// <summary> /// Do Processing on Tick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _env_Tick(object sender, TickEventArgs e) { //check for track if both tracks are not up.. if tracks are up.. dont check if (!(_redLoaded && _greenLoaded)) { IsTrackUp(); } if (_primaryTrackControllerRed == null) { _primaryTrackControllerRed = _env.PrimaryTrackControllerRed; } if (_primaryTrackControllerGreen == null) { _primaryTrackControllerGreen = _env.PrimaryTrackControllerGreen; } _tickCount++; if (_tickCount >= _rate) { //AddAutomaticUpdate();//no longer need this information as of Track Model Update _tickCount = 0; PopulateTrack();//add trains to track } }
/// <summary> /// The on tick event. Fires every time a clock interval elapses. /// </summary> /// <param name="e"></param> protected virtual void OnTick(TickEventArgs e) { if (Tick != null) { Stop(); Tick(this, e); Start(); } }
/// <summary> /// Occurs on every tick. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Tick event args</param> private void _environment_Tick(object sender, TickEventArgs e) { updateMovement(); }