Esempio n. 1
0
 void Start()
 {
     if (pastDates == null)
     {
         pastDates = new List <Date>();
     }
     Today     = CreateStartDay();
     onDayEnd += ArchiveDay;
     SetDayStartTime();
     onDayStart += SetDayStartTime;
     canEndDay   = true;
 }
Esempio n. 2
0
        private static async Task TimerTask()
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                await Task.Delay(DaySpan, cancellationToken.Token);

                OnDayStart?.Invoke(null, new EventArgs());
                if (cancellationToken.IsCancellationRequested)
                {
                    return;
                }
                await Task.Delay(NightSpan, cancellationToken.Token);

                OnNightStart?.Invoke(null, new EventArgs());
                if (cancellationToken.IsCancellationRequested)
                {
                    return;
                }
            }
        }
Esempio n. 3
0
 void FireDayStart()
 {
     Debug.WriteLine($"Start of the day: {CurDate}");
     ProcessSheduledActions();
     OnDayStart.Invoke();
 }