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

        OnTimerTick?.Invoke(currentTime);
    }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 8
0
    public void Tick(float deltaTime)
    {
        if (_paused || _elapsed)
        {
            return;
        }

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

        if (!_elapsed && _timeLeft < 0)
        {
            _elapsed = true;
            OnTimerElapsed?.Invoke();
        }
    }
Ejemplo n.º 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;
            }
        }
    }
Ejemplo n.º 10
0
        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();
        }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 12
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     timer.Stop();
     OnTimerTick.Invoke();
     timer.Start();
 }