Exemplo n.º 1
0
 private Calendar(IReadOnlyList <string> languages, _Calendar calendar, TimeZoneInfo timeZone, string clock, DateTimeOffset time)
 {
     _languages = languages;
     _calendar  = calendar;
     _timeZone  = timeZone;
     _clock     = clock;
     _time      = time;
 }
Exemplo n.º 2
0
 public Calendar(IEnumerable <string> languages)
 {
     _languages = languages.ToList();
     _calendar  = CultureInfo.CurrentCulture.Calendar;
     _timeZone  = TimeZoneInfo.Local;
     _clock     = GetDefaultClock();
     _time      = DateTimeOffset.Now;
 }
Exemplo n.º 3
0
 public Calendar(IEnumerable <string> languages, string calendar, string clock)
 {
     _languages = languages.ToList();
     _calendar  = GetCalendar(calendar);
     _timeZone  = TimeZoneInfo.Local;
     _clock     = GetClock(clock);
     _time      = DateTimeOffset.Now;
 }
Exemplo n.º 4
0
 public Calendar()
 {
     _languages = new string[1] {
         CultureInfo.CurrentCulture.IetfLanguageTag
     };
     _calendar = CultureInfo.CurrentCulture.Calendar;
     _timeZone = TimeZoneInfo.Local;
     _clock    = GetDefaultClock();
     _time     = DateTimeOffset.Now;
 }
Exemplo n.º 5
0
        private static string GetCalendarSystem(_Calendar calendar)
        {
            switch (calendar)
            {
            case global::System.Globalization.JulianCalendar _: return(CalendarIdentifiers.Julian);

            case global::System.Globalization.GregorianCalendar _: return(CalendarIdentifiers.Gregorian);

            case global::System.Globalization.HebrewCalendar _: return(CalendarIdentifiers.Hebrew);

            case global::System.Globalization.HijriCalendar _: return(CalendarIdentifiers.Hijri);

            case global::System.Globalization.JapaneseCalendar _: return(CalendarIdentifiers.Japanese);

            case global::System.Globalization.KoreanCalendar _: return(CalendarIdentifiers.Korean);

            case global::System.Globalization.TaiwanCalendar _: return(CalendarIdentifiers.Taiwan);

            case global::System.Globalization.ThaiBuddhistCalendar _: return(CalendarIdentifiers.Thai);

            case global::System.Globalization.UmAlQuraCalendar _: return(CalendarIdentifiers.UmAlQura);

            case global::System.Globalization.PersianCalendar _: return(CalendarIdentifiers.Persian);

            case global::System.Globalization.ChineseLunisolarCalendar _: return(CalendarIdentifiers.ChineseLunar);

            // Not supported by UWP as of 2019-05-23
            // https://docs.microsoft.com/en-us/uwp/api/windows.globalization.calendaridentifiers
            // case CalendarIdentifiers.VietnameseLunar: return new global::System.Globalization.VietnameseLunarCalendar();
            // case CalendarIdentifiers.TaiwanLunar: return new global::System.Globalization.TaiwanLunarCalendar();
            // case CalendarIdentifiers.KoreanLunar: return new global::System.Globalization.KoreanLunarCalendar();
            // case CalendarIdentifiers.JapaneseLunar: return new global::System.Globalization.JapaneseLunarCalendar();

            default: throw new ArgumentException(nameof(calendar));
            }
        }