Пример #1
0
 public static void SetDisplayMonth(DateTime value, bool preserveForever = false)
 {
     _displayMonth = DateTools.GetMonth(value);
     if (_viewDatesSetOn != DateTime.MaxValue)
     {
         _viewDatesSetOn = preserveForever ? DateTime.MaxValue : DateTime.Now;
     }
 }
Пример #2
0
            public CalendarAdapter(DateTime month, DayOfWeek firstDayOfWeek)
            {
                FirstDayOfWeek = firstDayOfWeek;
                month          = DateTools.GetMonth(month);

                CenterMonth = month;
                FirstMonth  = DateTools.GetMonth(month.AddMonths(-1000));
            }
Пример #3
0
        private DateTime GetCurrentDisplayMonth()
        {
            if (ContentGenerator == null)
            {
                return(DateTools.GetMonth(DateTime.Today));
            }

            return((ContentGenerator as CalendarGenerator).GetDisplayMonth());
        }
        public Task EnsureLoadedForCalendarAsync(DateTime displayMonth)
        {
            displayMonth = DateTools.GetMonth(displayMonth);

            DateTime neededStart = displayMonth.AddMonths(-1);
            DateTime neededEnd   = displayMonth.AddMonths(2).AddDays(-1); // Need the full next month

            return(EnsureLoadedAsync(neededStart, neededEnd, neededStart.AddMonths(-3), displayMonth.AddMonths(4).AddDays(-1)));
        }
Пример #5
0
        public static DateTime GetDisplayMonth()
        {
            if (_viewDatesSetOn < DateTime.Now.AddMinutes(-5))
            {
                _displayMonth = null;
            }

            return(_displayMonth.GetValueOrDefault(DateTools.GetMonth(DateTime.Today)));
        }
        private DateTime?GetDateForAdd(DateTime?dueDate, bool useSelectedDate)
        {
            if (dueDate == null)
            {
                if (useSelectedDate)
                {
                    dueDate = SelectedDate.Date;
                }
                else
                {
                    // If we're in the current month, we'll use the default adding behavior
                    if (DateTools.SameMonth(DisplayMonth, Today))
                    {
                        dueDate = null;
                    }

                    else
                    {
                        var prevAddDate = NavigationManager.GetPreviousAddItemDate();

                        // If in same month we've previously added to
                        if (prevAddDate != null && DateTools.SameMonth(DisplayMonth, prevAddDate.Value))
                        {
                            // Preserve that date
                            dueDate = prevAddDate;
                        }

                        // Otherwise
                        else
                        {
                            // Use first day of the month
                            dueDate = DateTools.GetMonth(DisplayMonth);
                        }
                    }
                }
            }

            return(dueDate);
        }
Пример #7
0
 public DateTime GetDisplayMonth()
 {
     return(DateTools.GetMonth(_displayMonth)); //just in case, use the GetMonth method
 }
Пример #8
0
 public DateTime GetMonth(int position)
 {
     return(DateTools.GetMonth(FirstMonth.AddMonths(position)));
 }