Ejemplo n.º 1
0
        void DaySelected(object sender, EventArgs args)
        {
            var calendarBarDay = sender as CalendarBarDayView;

            if (calendarBarDay == null)
            {
                System.Diagnostics.Debug.WriteLine("[CalendarBar] Day selected event can't be executed");
                return;
            }

            if (_selectedCalendarBarDay != null && calendarBarDay.Date == _selectedCalendarBarDay.Date)
            {
                return;
            }

            calendarBarDay.IsSelected = true;
            _selectedDate             = calendarBarDay.Date;
            if (_selectedCalendarBarDay != null)
            {
                _selectedCalendarBarDay.IsSelected = false;
            }
            _selectedCalendarBarDay = calendarBarDay;

            DayChanged?.Invoke(this, new CalendarBarEventArgs()
            {
                Date = calendarBarDay.Date, Source = DateSelectionSource.Bar
            });
        }
Ejemplo n.º 2
0
        public void OnDateSet(DatePicker view, int year, int month, int dayOfMonth)
        {
            //var selectedDateYear = _selectedDate.Year;
            _selectedDate = DateTimeExtensions.CreateValidDate(year, month + 1, dayOfMonth);
            //if (selectedDateYear != year)
            //{
            //	return;
            //}

            var dayCount = (int)(_endDate - _selectedDate).TotalDays + 1;

            if (dayCount > _maxDaysOnBar)
            {
                _startDate = _selectedDate;
            }
            else
            {
                _startDate = _endDate.AddDaysSafe(-_maxDaysOnBar + 1);
            }

            DayChanged?.Invoke(this, new CalendarBarEventArgs()
            {
                Date = _selectedDate, Source = DateSelectionSource.Calendar
            });

            RequestLayout();
        }
Ejemplo n.º 3
0
    /*Private methods*/

    private IEnumerator UpdateGameTime()
    {
        while (true)
        {
            yield return(new WaitForSeconds(TIME_UPDATE_FREQUENCY));

            //Next days occurs when time specified by
            //TIME_UPDATE_FREQUENCY passes
            DateTime newTime = CurrentTime.AddDays(1);

            ++DaysSinceStart;
            DayChanged?.Invoke();

            if (newTime.Month != CurrentTime.Month)
            {
                MonthChanged?.Invoke();
            }

            if (newTime.Year != CurrentTime.Year)
            {
                YearChanged?.Invoke();
            }

            CurrentTime = newTime;
        }
    }
Ejemplo n.º 4
0
        private DateTimeService()
        {
            lastNow     = Now;
            tPeriodical = new AsyncTimerAction(TimeSpan.FromSeconds(1), () =>
            {
                now = Now;
                if (now.Minute != lastNow.Minute)
                {
                    tPeriodical.Interval = TimeSpan.FromMinutes(1);

                    MinuteChanged?.Invoke(this, now);

                    if (now.Hour != lastNow.Hour)
                    {
                        HourChanged?.Invoke(this, now);
                    }
                    if (now.Day != lastNow.Day)
                    {
                        DayChanged?.Invoke(this, now);
                    }
                    if (now.Month != lastNow.Month)
                    {
                        MonthChanged?.Invoke(this, now);
                    }
                    if (now.Year != lastNow.Year)
                    {
                        YearChanged?.Invoke(this, now);
                    }
                }

                lastNow = now;
            });
            tPeriodical.Start();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Reaction for DayButton click
        /// </summary>
        private void SelectDay_Click(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;

            selectedDay = new DateTime(selectedDay.Year, selectedDay.Month, int.Parse(btn.Name.Substring(6)));
            HighlightButton();
            DayChanged?.Invoke(this, e);
        }
Ejemplo n.º 6
0
 private void SetTimeRPC(int day, int month, int year)
 {
     CurrentTime = new DateTime(year, month, day);
     //Inform all subscribers right after receiving new date from master client
     if (false == IsDataReceived)
     {
         IsDataReceived = true;
         DataReceived?.Invoke();
     }
     DayChanged?.Invoke();
 }
        private void GameDateComponent_TimeChanged(GameDateComponent sender)
        {
            if (prevMinute != Minute)
            {
                prevMinute = Minute;
                if (MinuteChanged != null)
                {
                    MinuteChanged.Invoke(this);
                }
            }

            if (prevHour != Hour)
            {
                prevHour = Hour;
                if (HourChanged != null)
                {
                    HourChanged.Invoke(this);
                }
            }

            if (prevDay != Day)
            {
                prevDay = Day;
                if (DayChanged != null)
                {
                    DayChanged.Invoke(this);
                }
            }

            if (prevMonth != Month)
            {
                prevMonth = Month;
                if (MonthChanged != null)
                {
                    MonthChanged.Invoke(this);
                }
            }

            if (prevYear != Year)
            {
                prevYear = Year;
                if (YearChanged != null)
                {
                    YearChanged.Invoke(this);
                }
            }
        }
Ejemplo n.º 8
0
 private static void OnDayChanged()
 {
     DayChanged?.Invoke(null, null);
 }
Ejemplo n.º 9
0
 private void OnDayChanged(int value) => DayChanged?.Invoke(this, new IntEventArgs(value));
Ejemplo n.º 10
0
 private void OnDayChanged()
 {
     DayChanged?.Invoke(this, EventArgs.Empty);
     NewReportFileRequested?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 11
0
 private static void OnDayChanged()
 {
     DayChanged?.Invoke(null, new EventArgs());
 }
Ejemplo n.º 12
0
 static void OnDayChanged()
 {
     DayChanged?.Invoke();
 }
Ejemplo n.º 13
0
 public void TriggerDayChangeEvent()
 {
     Debug.Log($"new day {CurrentDay}!");
     DayChanged.Invoke();
 }