Example #1
0
 private void TimerCallback(object state)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         OnTimerTick?.Invoke();
     });
 }
Example #2
0
 private void CheckTimerTick()
 {
     if (!enableTick || !(CurrentTime > _timeLastTick + tickTime))
     {
         return;
     }
     OnTimerTick?.Invoke();
     _timeLastTick = CurrentTime;
 }
Example #3
0
 private IEnumerator Counter()
 {
     while (true)
     {
         currentTime += timeOfTick;
         OnTimerTick?.Invoke(currentTime);
         text.text = currentTime.ToString();
         yield return new WaitForSeconds(timeOfTick);
     }
 }
Example #4
0
    private void Tick()
    {
        currentTime -= Time.deltaTime;
        if (currentTime <= 0)
        {
            currentTime = 0;
            OnTimerEnd?.Invoke();
        }

        OnTimerTick?.Invoke(currentTime);
    }
Example #5
0
 private async void GatherData()
 {
     //var r = await GetData();
     //if (r.Success)
     //{
     //OnTimerTick?.Invoke(r.Temperature,r.Humidity);
     //}
     while (CollectData)
     {
         CreateRandomData(out var temp, out var hum);
         OnTimerTick?.Invoke(temp, hum);
         await Task.Delay(TimerInSeconds * 1000);
     }
 }
Example #6
0
        protected override void Update()
        {
            if (IsRunning)
            {
                RemainingTime = System.Math.Max(0, RemainingTime - Application.Time.DeltaTime);

                OnTimerTick?.Invoke(this);

                if (RemainingTime == 0)
                {
                    IsRunning = false;
                    OnTimerComplete?.Invoke(this);
                }
            }
        }
Example #7
0
        public override void Update(float deltaTime)
        {
            if (IsRunning)
            {
                RemainingTime = Math.Max(0, RemainingTime - deltaTime);

                OnTimerTick?.Invoke(this);

                if (RemainingTime == 0)
                {
                    IsRunning = false;
                    OnTimerComplete?.Invoke(this);
                }
            }
        }
Example #8
0
    public void Tick(float deltaTime)
    {
        if (_paused || _elapsed)
        {
            return;
        }

        _timeLeft -= deltaTime;
        OnTimerTick?.Invoke(_timeLeft);

        if (!_elapsed && _timeLeft < 0)
        {
            _elapsed = true;
            OnTimerElapsed?.Invoke();
        }
    }
Example #9
0
    private IEnumerator TimerCoroutine(float time)
    {
        TimeLeft = 0.0f;
        while (true)
        {
            yield return(new WaitForSeconds(0.2f));

            TimeLeft += 0.2f;
            OnTimerTick?.Invoke(time - TimeLeft);
            if (TimeLeft >= time)
            {
                SendStatistics(false, "Время истекло");
                break;
            }
        }
    }
        private void m_timer1_Tick(object sender, EventArgs e)
        {
            //Debug.WriteLine("Timer: " + DateTime.Now.ToString("s"));
            if (m_Options == null)
            {
                return;
            }

            m_timer1.Stop();
            //if (Loop && m_Mp3Player.GetStatusMode() == NETSoundPlayer.PlayingState.stopped && m_trackBarPosition.Value == m_trackBarPosition.Maximum)
            //	Play(m_playLists.PL.NextIdx());

            OnTimerTick?.Invoke(sender, e);

            UpdateInfo();
            m_timer1.Start();
        }
Example #11
0
 void Tick(object sender, EventArgs e)
 {
     if (StaticOnTimerTick != null)
     {
         StaticOnTimerTick.Invoke(this, new EventArgs());
     }
     if (OnTimerTick != null)
     {
         OnTimerTick.Invoke(this, new EventArgs());
     }
     if (Value >= Maximum)
     {
         if (cof && this.ParentForm != null)
         {
             this.ParentForm.Close();
         }
     }
 }
Example #12
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     timer.Stop();
     OnTimerTick.Invoke();
     timer.Start();
 }