예제 #1
0
        private void UpdateText(Windows.Globalization.Calendar calendar)
        {
            switch (this.owner.ComponentType)
            {
            case DateTimeComponentType.Day:
                this.headerText  = calendar.DayAsPaddedString(2);
                this.contentText = calendar.DayOfWeekAsSoloString();
                break;

            case DateTimeComponentType.Month:
                this.headerText  = calendar.MonthAsPaddedNumericString(2);
                this.contentText = calendar.MonthAsSoloString();
                break;

            case DateTimeComponentType.Year:
                this.headerText = calendar.YearAsPaddedString(4);
                if (calendar.GetCalendarSystem() == Windows.Globalization.CalendarIdentifiers.Gregorian &&
                    DateTime.IsLeapYear(calendar.GetUtcDateTime().Year))
                {
                    this.contentText = InputLocalizationManager.Instance.GetString("LeapYear");
                }
                else
                {
                    this.contentText = " ";
                }
                break;

            case DateTimeComponentType.Hour:
                this.headerText  = calendar.HourAsString();
                this.contentText = string.Empty;
                break;

            case DateTimeComponentType.Minute:
                this.headerText  = calendar.MinuteAsPaddedString(2);
                this.contentText = string.Empty;
                break;

            case DateTimeComponentType.AMPM:
                this.headerText  = calendar.PeriodAsString();
                this.contentText = string.Empty;
                break;
            }

            this.OnPropertyChanged(nameof(this.HeaderText));
            this.OnPropertyChanged(nameof(this.ContentText));
        }