GetCalendarSystem() public method

public GetCalendarSystem ( ) : string
return string
 private string ReportCalendarData(Calendar calendar, string calendarLabel)
 {
     string results = calendarLabel + ": " + calendar.GetCalendarSystem() + "\n";
     results += "Calendar system: " + calendar.GetCalendarSystem() + "\n";
     results += "Numeral System: " + calendar.NumeralSystem + "\n";
     results += "Resolved Language " + calendar.ResolvedLanguage + "\n";
     results += "Name of Month: " + calendar.MonthAsSoloString() + "\n";
     results += "Day of Month: " + calendar.DayAsPaddedString(2) + "\n";
     results += "Day of Week: " + calendar.DayOfWeekAsSoloString() + "\n";
     results += "Year: " + calendar.YearAsString() + "\n";
     results += "\n";
     return results;
 }
        /// <summary>
        /// This is the click handler for the 'Display' button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Display_Click(object sender, RoutedEventArgs e)
        {
            // This scenario uses the Windows.Globalization.Calendar class to display the parts of a date.

            // Store results here.
            StringBuilder results = new StringBuilder();

            // Create Calendar objects using different constructors.
            Calendar calendar = new Calendar();
            Calendar japaneseCalendar = new Calendar(new[] { "ja-JP" }, CalendarIdentifiers.Japanese, ClockIdentifiers.TwelveHour);
            Calendar hebrewCalendar = new Calendar(new[] { "he-IL" }, CalendarIdentifiers.Hebrew, ClockIdentifiers.TwentyFourHour);

            // Display individual date/time elements.
            results.AppendLine("User's default calendar system: " + calendar.GetCalendarSystem());
            results.AppendLine("Name of Month: " + calendar.MonthAsSoloString());
            results.AppendLine("Day of Month: " + calendar.DayAsPaddedString(2));
            results.AppendLine("Day of Week: " + calendar.DayOfWeekAsSoloString());
            results.AppendLine("Year: " + calendar.YearAsString());
            results.AppendLine();
            results.AppendLine("Calendar system: " + japaneseCalendar.GetCalendarSystem());
            results.AppendLine("Name of Month: " + japaneseCalendar.MonthAsSoloString());
            results.AppendLine("Day of Month: " + japaneseCalendar.DayAsPaddedString(2));
            results.AppendLine("Day of Week: " + japaneseCalendar.DayOfWeekAsSoloString());
            results.AppendLine("Year: " + japaneseCalendar.YearAsString());
            results.AppendLine();
            results.AppendLine("Calendar system: " + hebrewCalendar.GetCalendarSystem());
            results.AppendLine("Name of Month: " + hebrewCalendar.MonthAsSoloString());
            results.AppendLine("Day of Month: " + hebrewCalendar.DayAsPaddedString(2));
            results.AppendLine("Day of Week: " + hebrewCalendar.DayOfWeekAsSoloString());
            results.AppendLine("Year: " + hebrewCalendar.YearAsString());
            results.AppendLine();

            // Display the results
            OutputTextBlock.Text=results.ToString();
        }
 private string ReportCalendarData(Calendar calendar, string calendarLabel)
 {
     string results = calendarLabel + ": " + calendar.GetCalendarSystem() + "\n";
     results += "Months in this Year: " + calendar.NumberOfMonthsInThisYear + "\n";
     results += "Days in this Month: " + calendar.NumberOfDaysInThisMonth + "\n";
     results += "Hours in this Period: " + calendar.NumberOfHoursInThisPeriod + "\n";
     results += "Era: " + calendar.EraAsString() + "\n";
     results += "\n";
     return results;
 }
Beispiel #4
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));
        }
        /// <summary>
        /// This is the click handler for the 'Display' button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Display_Click(object sender, RoutedEventArgs e)
        {
            // This scenario uses the Windows.Globalization.Calendar class to display the calendar
            // system statistics.
            
            // Store results here.
            StringBuilder results = new StringBuilder();

            // Create Calendar objects using different constructors.
            Calendar calendar = new Calendar();
            Calendar japaneseCalendar = new Calendar(new[] { "ja-JP" }, CalendarIdentifiers.Japanese, ClockIdentifiers.TwelveHour);
            Calendar hebrewCalendar = new Calendar(new[] { "he-IL" }, CalendarIdentifiers.Hebrew, ClockIdentifiers.TwentyFourHour);

            // Display individual date/time elements.
            results.AppendLine("User's default calendar system: " + calendar.GetCalendarSystem());
            results.AppendLine("Months in this Year: " + calendar.NumberOfMonthsInThisYear);
            results.AppendLine("Days in this Month: " + calendar.NumberOfDaysInThisMonth);
            results.AppendLine("Hours in this Period: " + calendar.NumberOfHoursInThisPeriod);
            results.AppendLine("Era: " + calendar.EraAsString());
            results.AppendLine();
            results.AppendLine("Calendar system: " + japaneseCalendar.GetCalendarSystem());
            results.AppendLine("Months in this Year: " + japaneseCalendar.NumberOfMonthsInThisYear);
            results.AppendLine("Days in this Month: " + japaneseCalendar.NumberOfDaysInThisMonth);
            results.AppendLine("Hours in this Period: " + japaneseCalendar.NumberOfHoursInThisPeriod);
            results.AppendLine("Era: " + japaneseCalendar.EraAsString());
            results.AppendLine();
            results.AppendLine("Calendar system: " + hebrewCalendar.GetCalendarSystem());
            results.AppendLine("Months in this Year: " + hebrewCalendar.NumberOfMonthsInThisYear);
            results.AppendLine("Days in this Month: " + hebrewCalendar.NumberOfDaysInThisMonth);
            results.AppendLine("Hours in this Period: " + hebrewCalendar.NumberOfHoursInThisPeriod);
            results.AppendLine("Era: " + hebrewCalendar.EraAsString());
            results.AppendLine();

            // Display results
            rootPage.NotifyUser(results.ToString(), NotifyType.StatusMessage);
        }
        /// <summary>
        /// This is a helper function to display calendar's properties in presentable format
        /// </summary>
        /// <param name="calendar"></param>
        private String GetCalendarProperties(Calendar calendar)
        {
            StringBuilder returnString = new StringBuilder();
            
            returnString.AppendLine("Calendar system: " + calendar.GetCalendarSystem());
            returnString.AppendLine("Numeral System: " + calendar.NumeralSystem);
            returnString.AppendLine("Resolved Language " + calendar.ResolvedLanguage);
            returnString.AppendLine("Name of Month: " + calendar.MonthAsSoloString());
            returnString.AppendLine("Day of Month: " + calendar.DayAsPaddedString(2));
            returnString.AppendLine("Day of Week: " + calendar.DayOfWeekAsSoloString());
            returnString.AppendLine("Year: " + calendar.YearAsString());
            returnString.AppendLine();

            return(returnString.ToString());
        }