Exemple #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();
            }
        }
Exemple #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();
            }
        }
Exemple #3
0
        private void persianCalendar(int startDay, int nDays)
        {
            int i, j;

            reset();

            for (i = startDay; i <= 6; i++)
            {
                var curDay = i - startDay + 1;
                DaysInfo[i + 7].Number          = curDay.ToString(CultureInfo.InvariantCulture);
                DaysInfo[i + 7].BackgroundBrush = CustomBrushes.BorderBlueBackground();
                DaysInfo[i + 7].BorderBrush     = CustomBrushes.CellsBorederBrush();
                DaysInfo[i + 7].Foreground      = CustomBrushes.CellsForeground();
            }

            var k = 7;

            for (j = 6 - startDay + 1; j <= nDays - 1; j++)
            {
                var curDay = j + 1;
                DaysInfo[k + 7].Number          = curDay.ToString(CultureInfo.InvariantCulture);
                DaysInfo[k + 7].BackgroundBrush = CustomBrushes.BorderBlueBackground();
                DaysInfo[k + 7].BorderBrush     = CustomBrushes.CellsBorederBrush();
                DaysInfo[k + 7].Foreground      = CustomBrushes.CellsForeground();
                k = k + 1;
            }
        }
Exemple #4
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
                });
            }
        }
Exemple #5
0
        private void highlightToday(int monthIndex, int year)
        {
            int tOutYear, tOutMonth, tOutDay;

            PDateHelper.GregorianToHijri(
                DateTime.Now.Year,
                DateTime.Now.Month,
                DateTime.Now.Day,
                out tOutYear, out tOutMonth, out tOutDay);

            if ((year != tOutYear) || (monthIndex != tOutMonth))
            {
                return;
            }
            //highlight today!
            for (var i = 0; i <= 41; i++)
            {
                if (DaysInfo[i + 7].Number != tOutDay.ToString(CultureInfo.InvariantCulture))
                {
                    continue;
                }
                DaysInfo[i + 7].FontWeight      = FontWeights.Bold;
                DaysInfo[i + 7].BackgroundBrush = CustomBrushes.TodayBackground();
                DaysInfo[i + 7].BorderBrush     = CustomBrushes.TodayBorderBrush();
            }
        }
Exemple #6
0
        private void highlightThisday(int year, int month, int day)
        {
            if (_currentMonth + 1 != month || _currentYear != year)
            {
                return;
            }

            //reset
            if (_lastSelectedIdx != -1)
            {
                DaysInfo[_lastSelectedIdx].BackgroundBrush = CustomBrushes.BorderBlueBackground();
                DaysInfo[_lastSelectedIdx].BorderBrush     = CustomBrushes.CellsBorederBrush();
                DaysInfo[_lastSelectedIdx].Foreground      = CustomBrushes.CellsForeground();
                DaysInfo[_lastSelectedIdx].FontWeight      = FontWeights.Normal;
            }

            for (var i = 0; i <= 41; i++)
            {
                if (DaysInfo[i + 7].Number != day.ToString(CultureInfo.InvariantCulture))
                {
                    continue;
                }
                DaysInfo[i + 7].FontWeight      = FontWeights.Bold;
                DaysInfo[i + 7].BackgroundBrush = CustomBrushes.HighlightBackground();
                DaysInfo[i + 7].BorderBrush     = CustomBrushes.HightlightBorderBrush();
                _lastSelectedIdx = i + 7;
            }
        }