示例#1
0
        private void showYear()
        {
            CalendarGUIData.HeaderText = _currentYear.ToString(CultureInfo.InvariantCulture);
            DaysInfo.Clear();

            CalendarGUIData.UniformGridColumns = 3;
            CalendarGUIData.UniformGridRows    = 4;

            for (var i = 0; i < 12; i++)
            {
                DaysInfo.Add(new DayInfo
                {
                    Number          = Names.MonthNames[i],
                    FontWeight      = FontWeights.Bold,
                    BackgroundBrush = CustomBrushes.HeaderBackground(),
                    BorderBrush     = CustomBrushes.HeaderBorderBrush(),
                    Foreground      = CustomBrushes.HeaderForeground(),
                    CellWidth       = 60,
                    CellHeight      = 40
                });
            }

            calendarMode = CalendarMode.Year;
            if (StartAnimation != null)
            {
                StartAnimation();
            }
        }
示例#2
0
        private void showDecade()
        {
            DaysInfo.Clear();

            CalendarGUIData.UniformGridColumns = 3;
            CalendarGUIData.UniformGridRows    = 4;

            for (var i = 0; i < 12; i++)
            {
                DaysInfo.Add(new DayInfo
                {
                    Number          = (_currentYear - i).ToString(CultureInfo.InvariantCulture),
                    FontWeight      = FontWeights.Bold,
                    BackgroundBrush = CustomBrushes.HighlightBackground(),
                    BorderBrush     = CustomBrushes.HightlightBorderBrush(),
                    Foreground      = CustomBrushes.HightlightForeground(),
                    CellWidth       = 60,
                    CellHeight      = 40
                });
            }

            calendarMode = CalendarMode.Decade;
            if (StartAnimation != null)
            {
                StartAnimation();
            }
        }
示例#3
0
        private void initHeader()
        {
            CalendarGUIData.UniformGridRows    = 5;
            CalendarGUIData.UniformGridColumns = 7;

            foreach (var day in Names.DaysOfWeek)
            {
                DaysInfo.Add(new DayInfo
                {
                    Number             = day,
                    FontWeight         = FontWeights.Bold,
                    BackgroundBrush    = CustomBrushes.HeaderBackground(),
                    BorderBrush        = CustomBrushes.HeaderBorderBrush(),
                    Foreground         = CustomBrushes.HeaderForeground(),
                    CellWidth          = 30,
                    HyperlinkIsEnabled = true
                });
            }

            for (var i = 0; i <= 41; i++)
            {
                DaysInfo.Add(new DayInfo {
                    CellWidth = 30
                });
            }
        }
示例#4
0
        private void dayClick(string day)
        {
            if (string.IsNullOrWhiteSpace(day))
            {
                return;
            }

            //click on the header
            if (Names.DaysOfWeek.Contains(day))
            {
                return;
            }

            switch (calendarMode)
            {
            case CalendarMode.Month:
            {
                var dd    = int.Parse(day, CultureInfo.InvariantCulture);
                var month = _currentMonth + 1;
                var year  = _currentYear;

                setTodayData(year, month, dd);
                highlightThisday(year, month, dd);
            }
            break;

            case CalendarMode.Year:
            {
                var monthIdx = 0;
                for (var i = 0; i < 12; i++)
                {
                    if (Names.MonthNames[i] != day)
                    {
                        continue;
                    }
                    monthIdx = i;
                    break;
                }
                DaysInfo.Clear();
                initHeader();
                getInfoSetCalendar(monthIdx + 1, _currentYear);
            }
            break;

            case CalendarMode.Decade:
            {
                _currentYear = int.Parse(day, CultureInfo.InvariantCulture);
                showYear();
            }
            break;
            }
        }
示例#5
0
 private void showMonth()
 {
     DaysInfo.Clear();
     initHeader();
     if (_currentMonth < 1)
     {
         _currentMonth = 1;
     }
     else
     {
         _currentMonth++;
     }
     getInfoSetCalendar(_currentMonth, _currentYear);
     calendarMode = CalendarMode.Month;
 }
示例#6
0
        private void showTodayClick(string obj)
        {
            resetTheCache();

            int outYear, outMonth, outDay;

            PDateHelper.GregorianToHijri(
                DateTime.Now.Year,
                DateTime.Now.Month,
                DateTime.Now.Day,
                out outYear, out outMonth, out outDay);
            DaysInfo.Clear();
            initHeader();
            getInfoSetCalendar(outMonth, outYear);
            if (StartAnimation != null)
            {
                StartAnimation();
            }
        }