private void Timer_Tick(object sender, EventArgs e) { TimeSpan = DateTime.Now - StartTime; string text = ""; switch (ShowType) { case TimeShowType.mmss: text = TimeSpan.Minutes.ToString("D2") + ":" + TimeSpan.Seconds.ToString("D2"); break; case TimeShowType.mmssfff: text = TimeSpan.Minutes.ToString("D2") + ":" + TimeSpan.Seconds.ToString("D2") + "." + TimeSpan.Milliseconds.ToString("D3"); break; case TimeShowType.hhmmss: text = TimeSpan.Hours.ToString("D2") + ":" + TimeSpan.Minutes.ToString("D2") + ":" + TimeSpan.Seconds.ToString("D2"); break; } if (text != Text) { Text = text; TimerTick?.Invoke(this, null); } }
public void CheckTimer(GameTime i_GameTime) { currentTime += (float)i_GameTime.ElapsedGameTime.TotalSeconds; if (currentTime >= m_TimeToTick) { TimerTick?.Invoke(this, null); Restart(); } }
public void Invoke(string EventName, Game CurrentGame, EventArguments Args) { if (EventName == "Closing") { Closing.Invoke(CurrentGame, Args); } if (EventName == "KeyDown") { KeyDown.Invoke(CurrentGame, Args); } if (EventName == "KeyUp") { KeyUp.Invoke(CurrentGame, Args); } if (EventName == "KeyPress") { KeyPress.Invoke(CurrentGame, Args); } if (EventName == "Load") { Load.Invoke(CurrentGame, Args); } if (EventName == "MouseDown") { MouseDown.Invoke(CurrentGame, Args); } if (EventName == "MouseUp") { MouseUp.Invoke(CurrentGame, Args); } if (EventName == "MouseClick") { MouseClick.Invoke(CurrentGame, Args); } if (EventName == "MouseMove") { MouseMove.Invoke(CurrentGame, Args); } if (EventName == "MouseWheel") { MouseWheel.Invoke(CurrentGame, Args); } if (EventName == "RenderFrame") { RenderFrame.Invoke(CurrentGame, Args); } if (EventName == "Resize") { Resize.Invoke(CurrentGame, Args); } if (EventName == "TimerTick") { TimerTick.Invoke(CurrentGame, Args); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
/// <summary> /// Counts down in increments of 25 ms if invoked /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { RemainingTime -= 0.025; TimerTick?.Invoke(this, EventArgs.Empty); if (RemainingTime <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed TimeRemaining -= 1; // Error: 1000 changed to 1 TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should TimeRemaining -= 1; //Tid skal være seconds konsekvent over det hele. TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { //Her er fejlen timeRemaining er angivet i sekunder //Der stod -= 1000 TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should TimeRemaining -= 1; //fejl rettet her. Rettet fra 1000 til 1, timeremaining er angivet i sekunder og ikke msek. TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void timer1_Tick(object sender, EventArgs e) { if (Time == 0) { TimeOver?.Invoke(); timer1.Enabled = false; } else { TimerTick?.Invoke(); } }
private void _gameLoopTimer_Tick(object sender, EventArgs e) { _zoo.Update(); for (int i = _animals.Count - 1; i >= 0; i--) { if (!_animals[i].IsAlive) { _animals.RemoveAt(i); } } _animalsCountToolTip.SetToolTip(_createAnimalsBouton, "Animals count : " + _animals.Count.ToString()); TimerTick?.Invoke(this, _animals); }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //den skal ikke minus med -1000 den skal kun trækkes 1 fra per sekund TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
/// <summary> /// Событие тика таймера /// </summary> private void Timer_Tick(object sender, EventArgs e) { if (TotalSeconds - 1 >= 0) { TotalSeconds--; } if (TotalSeconds == 0) { timer.Stop(); TimerStop.Invoke(); } TimerTick.Invoke(); }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //TimeRemaining -= 1000; Denne linje har vi fjernet TimeRemaining -= 1; //Denne linje har vi tilføjet TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //TimeRemaining -= 1000; //Sikkert her fejlen er: TimeRemaining -= 1; //Dette er løsningen. TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should // Changed from 1000 to 1 as we're working with seconds, not milliseconds TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //TimeRemaining -= 1000; // The interval might be in milliseconds, but our time is in seconds TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //TimeRemaining -= 1000; TimeRemaining -= 1; // ændret sådan at der kun tælles 1 sekund ned ad gangen TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //Rettet fra 1000 til 1, således hver tick svarer til 1 sekund TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should // TimeRemaining -= 1000; TimeRemaining -= 1; // Ændret fra at være 1000 sekunder (ikke 1000 ms) til 1s) TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //TimeRemaining er i sekunder og ikke milisekunder, da den tid der gives med som paramater i Start-metoden er i sekundert //Derfor skal der trækkes 1 sekund fra og ikke 1000 sekunder, som var tilfældet før TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should // TimeRemaining -= 1000; would do that one tick is almost 17 min // 1000/60=16,667 wich equals 16 min and 40 sec //TimeRemaining -= 1000; TimeRemaining -= 1; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void OnTimerEvent(object sender, System.Timers.ElapsedEventArgs args) { // One tick has passed // Do what I should //Was originally 1000 but changed to 1 as it was a fail TimeRemaining -= 1; //TimeRemaining -= 1000; TimerTick?.Invoke(this, EventArgs.Empty); if (TimeRemaining <= 0) { Expire(); } }
private void _gameLoopTimer_Tick(object sender, EventArgs e) { _zoo.Update(); if (_zoo.CollectFindMethod) { for (int i = _animals.Count - 1; i >= 0; i--) { bool isAlive = _zoo.Find(_animals[i]); if (!isAlive) { _animals.RemoveAt(i); } } } _animalsCountToolTip.SetToolTip(_createAnimalsBouton, "Animals count : " + _animals.Count.ToString()); TimerTick?.Invoke(this, _animals); }
private void DispatcherTimer_Tick(object sender, EventArgs e) { bool finished = false; if (_currentTime < TIMING_INF[CurrentWindow]) { _currentTime += 1; } else { finished = true; ChangeWindow(); } if (TIMING_INF.ContainsKey(CurrentWindow)) { TimerTick?.Invoke(_currentTime / TIMING_INF[CurrentWindow], finished); } }
/// <summary> /// Start the <see langword="timer" /> /// </summary> public void Start() { if (IsBusy) { throw new InvalidOperationException("Unable to start timer: it is already running"); } IsBusy = true; RemainingSeconds = Seconds; TimerStarted?.Invoke(this); for (var i = 0; i < Seconds; i++) { RemainingSeconds = Seconds - i - 1; Thread.Sleep(1000); TimerTick?.Invoke(this); } TimerFinished?.Invoke(this); IsBusy = false; }
void Update() { if (_running) { _elapsedSeconds += Time.deltaTime; if (EventTickSeconds > 0f) { _eventTickAcc += Time.deltaTime; if (_eventTickAcc >= EventTickSeconds) { _eventTickAcc -= EventTickSeconds; TimerTick?.Invoke(TimedModifier); } } if (_elapsedSeconds >= _totalSeconds) { _running = false; TimerFinished?.Invoke(TimedModifier, this); } } }
void Metronome_Tick(object sender, EventArgs e) { TimerTick?.Invoke(this, e); }
/// <summary> /// One-time data initialization, since we only ever create one <see cref="App"/> instance! /// </summary> public App() { timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Send, (s, e) => TimerTick?.Invoke(startTime), Dispatcher); timer.Stop(); }
private void OnTimedEvent(object source, ElapsedEventArgs e) { TimerTick?.Invoke(); }