private void Awake() { insolence = true; timerA.OnTick += forceQuack; timerB.OnTick += forceUnQuack; timerA.Start(); timerB.Start(); }
async void OnSpeedChanged(object sender, IShakeServiceEventArgs e) { if (isReady) { OnActive(true); idleWatch.Reset(); idleWatch.Stop(); if (isNotBusy) { isNotBusy = false; idleTimer.Stop(); timer.Stop(); if (e.speed * 3.3 > speed) { speed = e.speed * 3.3; int lvl = 0; if (speed <= 2000) { scoreBad++; lvl = 1; labelRemark.Text = "Push Harder"; goodDepths = 0; } else { scoreGood++; switch (goodDepths) { case 2: lvl = 3; labelRemark.Text = "Good Depth"; break; default: lvl = 2; labelRemark.Text = "Push Faster"; goodDepths++; break; } } labelScoreBad.Text = scoreBad.ToString(); labelScoreGood.Text = scoreGood.ToString(); progressBarSpeed.CurrentSpeedUpdate.Invoke(this, lvl); labelDisplay.Text = (Math.Round((speed / 1000), 2)).ToString(); await progressBarSpeed.ProgressTo((speed / 3000), 500, Easing.Linear); DependencyService.Get <IAudioService>().PlayMP3(++lvl); } labelIdle.Text = "00:00"; await timer.Start(); isNotBusy = true; } } }
public void Start() { _timer.Start(); NotifyOfPropertyChange(() => CanStart); NotifyOfPropertyChange(() => CanStop); NotifyOfPropertyChange(() => CanReset); }
private void ExecuteStartCommand() { if (_timer != null) { Time = _timeLeft.ToString(); _timer.Start(); } }
protected override void OnStartRunning() { base.OnStartRunning(); _watch.Start(); SetSingleton(new Clock { Value = 0 }); }
static void Main() { int i = 0; Console.WriteLine("Start timer result: " + i); CustomTimer t = new CustomTimer(delegate() { i++; Console.WriteLine(i); }, 500); t.Start(); // do some work for 2seconds Thread.Sleep((int)2000); t.Stop(); Console.WriteLine("Stop timer result: " + i); }
private async void ExecuteMainButtonCommand() { if (!_hasStarted) { _hasStarted = true; MainButtonText = "DONE"; _timer.Start(); } else { _timer.Stop(); await _navigationService.NavigateAsync("GamePage"); } }
protected void SetTimer(string strTimerID, float fInterval, FunctionPointer fnTimer) { CustomTimer ct = new CustomTimer(); ct.SetInterval(fInterval); ct.SetTimerFunction(fnTimer); ct.Start(); if (gs_TimerDictionary.ContainsKey(strTimerID)) { gs_TimerDictionary[strTimerID].SetInterval(fInterval); } else { gs_TimerDictionary.Add(strTimerID, ct); } }
public void setActive(bool state) { isActive = state; if (turboMode) { if (state) { timer.Start(); } else { timer.Stop(); } } if (state && !turboMode) { PlaySound(); } }
async void CPRIdle(object sender, EventArgs e) { timer.Stop(); speed = 0; await idleTimer.Start(); }
private void MnuStart_Click(object sender, System.Windows.RoutedEventArgs e) { CustomTimer.Start(); }
static void Main(string[] args) { Random random = new Random(); CustomTimer timer = new CustomTimer(); Console.WriteLine("ICacheManager<int, int>"); for (int j = 0; j < 10; ++j) { ICacheManager<int, int> cacheManager = new CacheManager<int, int>(); timer.Start(); // No concurrency insertions for (int i = 0; i < 1000000; ++i) { cacheManager.AddEntry(random.Next(int.MaxValue), i); } timer.StopAndReport(); GC.Collect(2); GC.WaitForFullGCComplete(); } Console.WriteLine(""); Console.WriteLine("ICacheManager<int, string>"); for (int j = 0; j < 10; ++j) { ICacheManager<int, string> cacheManager = new CacheManager<int, string>(); timer.Start(); // No concurrency insertions for (int i = 0; i < 1000000; ++i) { cacheManager.AddEntry(random.Next(int.MaxValue), "dummy string " + i); } timer.StopAndReport(); GC.Collect(2); GC.WaitForFullGCComplete(); } Console.WriteLine(""); Console.WriteLine("ICacheManager<int, string, int>"); for (int j = 0; j < 10; ++j) { ICacheManager<int, string, int> cacheManager = new CacheManager<int, string, int>(); timer.Start(); // No concurrency insertions for (int i = 0; i < 1000000; ++i) { cacheManager.AddEntry(random.Next(int.MaxValue), "dummy string " + i); } timer.StopAndReport(); GC.Collect(2); GC.WaitForFullGCComplete(); } Console.WriteLine(""); Console.ReadLine(); }
private void MnuStart_Click(object sender, RoutedEventArgs e) { CustomTimer.Start(); }
private void mnuBegin_Click(object sender, RoutedEventArgs e) { CustomTimer.Start(); }