/// <summary> /// Событие тика таймера /// </summary> private void Timer_Tick(object sender, EventArgs e) { if (TotalSeconds - 1 >= 0) { TotalSeconds--; } if (TotalSeconds == 0) { timer.Stop(); TimerStop.Invoke(); } TimerTick.Invoke(); }
public void TimerStart() { MyEventArgs eventArgs = new MyEventArgs(); for (int i = 0; i < TimerTime; i++) { eventArgs.SetRemainigTime(TimerTime - i); RemainingTime?.Invoke(this, eventArgs); Thread.Sleep(1000); } TimerStop?.Invoke(this, null); }
public void EggBroken(Egg brokenEgg) { TimerStop?.Invoke(this, new EventArgs()); BrokenEggs++; foreach (Egg eg in _countOfEggs) { if (eg != brokenEgg) { eg.timer.Stop(); DeleteEgg?.Invoke(eg, new EventArgs()); } } LifeActivate?.Invoke(this, new EventArgs()); }
public void EggMove(object sender, EventArgs e) { if (_currentFrame == FallFrameIndex) { ReadyToCatch?.Invoke(this, new EventArgs()); } if (_currentFrame == EndOfWayIndex) { TimerStop?.Invoke(this, new EventArgs()); timer.Stop(); AnimationEnd?.Invoke(this, new EventArgs()); return; } EggsDeactivate(); EggWay[_currentFrame].Visibility = Visibility.Visible; _currentFrame++; }
private void SplashScreen_Shown(object sender, EventArgs e) { //creating the timer that will run for 3 seconds timer = new Timer { Interval = 1000 }; timer.Start(); //event that will run when the timer stops stopping = new TimerStop((object send, EventArgs args) => { timer.Stop(); LoadingScreen form = new LoadingScreen(); this.Hide(); form.ShowDialog(); this.Close(); }); //calling the stopping event timer.Tick += new EventHandler(stopping); }
// stops countdown public void StopTimer() { active = false; TimerStop.Invoke(); FindObjectOfType <AudioManager>().Play("Buzzer"); }
public void EndGame() { TimerStop?.Invoke(this, new EventArgs()); RemoveAllEggs(); }
private void FadeOut() { TimerStop.Start(); }