Esempio n. 1
0
 private void ClippingMonths()
 {
     for (int i = 0; i < Convert.ToInt32(DateTime.Now.ToString("MM")) - 1; i++)
     {
         Months.RemoveAt(Convert.ToInt32(DateTime.Now.ToString("MM")) - 2 - i);
     }
 }
        private void CachePreviousMonths()
        {
            var firstMonth = Months.First();

            for (int i = 1; i < CachedMonthCount; i++)
            {
                var monthToInsertDateTime = firstMonth.CurrentDate.AddMonths(-i);
                var monthToInsert         = new MonthViewModel(
                    monthToInsertDateTime,
                    SelectDayCommand,
                    _toDoCalendarViewModel.GetDaysWithToDoByDateAndStatus(monthToInsertDateTime, ConstantsHelper.Active),
                    _toDoCalendarViewModel.GetDaysWithToDoByDateAndStatus(monthToInsertDateTime, ConstantsHelper.Completed));
                Months.Insert(0, monthToInsert);
                Months.RemoveAt(Months.Count - 1);
            }
        }
        private void CacheNextMonths()
        {
            var monthsToAdd = new List <MonthViewModel>();
            var lastMonth   = Months.Last();

            for (int i = 1; i < CachedMonthCount; i++)
            {
                var monthToAddDateTime = lastMonth.CurrentDate.AddMonths(i);
                var monthToAdd         = new MonthViewModel(
                    monthToAddDateTime,
                    SelectDayCommand,
                    _toDoCalendarViewModel.GetDaysWithToDoByDateAndStatus(monthToAddDateTime, ConstantsHelper.Active),
                    _toDoCalendarViewModel.GetDaysWithToDoByDateAndStatus(monthToAddDateTime, ConstantsHelper.Completed));

                monthsToAdd.Add(monthToAdd);
                Months.RemoveAt(0);
            }
            Months.AddRange(monthsToAdd);
        }
Esempio n. 4
0
        private void month_MonthSelected(object sender, MonthSelectArgs e)
        {
            Month month = e.Month;

            if (lastMonth != null)
            {
                for (int i = 0; i < Months.Count; i++)
                {
                    if (lastMonth.SelectedDate.Month == Months[i].SelectedDate.Month)
                    {
                        if (lastMonth.SelectedDate.Day == Months[i].SelectedDate.Day)
                        {
                            lastMonth = Months[i];
                            Months.RemoveAt(i);
                            Months.Insert(i, lastMonth);
                        }
                    }
                }
            }
            lastMonth = month;
            DateTime dateTime = DateTime.Now;

            try
            {
                dateTime         = lastMonth.SelectedDate;
                SelectedDateTime = new DateTime(YearTitle, dateTime.Month, dateTime.Day);
            }
            catch (Exception)
            {
                SelectedDateTime = DateTime.Now;
            }
            finally
            {
                UpdateDays(SelectedDateTime);
                semanticzoomDate.ToggleActiveView();
            }

            this.header.MonthTitle = SelectedDateTime.Month.ToString();
            this.header.YearTitle  = SelectedDateTime.Year.ToString();
            this.MonthTitle        = SelectedDateTime.Month;
            this.YearTitle         = SelectedDateTime.Year;
        }