コード例 #1
0
        /// <summary>
        /// Création du viewmodel
        /// </summary>
        public NatalChartDefinitionViewModel(ITimeZoneProvider tzProvider)
        {
            Definition = new NatalChartDefinition();
            Definition.BirthPlacePosition = new GeoPosition();
            Definition.BirthDate.SetDate(DateTimeOffset.Now);
            this.BirthDateTimeZone = TimeZoneInfo.Local;

            // Liste des genres
            ListGenders = new List <KeyValuePair <Gender, string> >();
            ListGenders.Add(new KeyValuePair <Gender, string>(Gender.Female, Locales.Gender_Female_Caption));
            ListGenders.Add(new KeyValuePair <Gender, string>(Gender.Male, Locales.Gender_Male_Caption));

            // Liste des mode d'heures d'été
            ListDayLightDefinitions = new List <KeyValuePair <DayLightDefinition, string> >();
            ListDayLightDefinitions.Add(new KeyValuePair <DayLightDefinition, string>(DayLightDefinition.FromTimeZone, Locales.DayLight_FromTimeZone_Caption));
            ListDayLightDefinitions.Add(new KeyValuePair <DayLightDefinition, string>(DayLightDefinition.On, Locales.DayLight_On_Caption));
            ListDayLightDefinitions.Add(new KeyValuePair <DayLightDefinition, string>(DayLightDefinition.Off, Locales.DayLight_Off_Caption));

            // Liste des fuseaux horaire
            ListTimeZoneInfos = new List <KeyValuePair <TimeZoneInfo, String> >();
            ListTimeZoneInfos.Add(new KeyValuePair <TimeZoneInfo, string>(null, Locales.TimeZone_Custom_Caption));
            if (tzProvider != null)
            {
                ListTimeZoneInfos.AddRange(tzProvider.GetTimeZones().Select(tz => new KeyValuePair <TimeZoneInfo, String>(tz, tz.DisplayName)));
            }

            // Liste des systèmes de maisons
            ListHouseSystems = new List <KeyValuePair <HouseSystem, string> >();
            foreach (HouseSystem hs in Enum.GetValues(typeof(HouseSystem)))
            {
                ListHouseSystems.Add(new KeyValuePair <HouseSystem, string>(hs, hs.GetCaptionString()));
            }

            // Liste des positions
            ListPositionCenters = new List <KeyValuePair <PositionCenter, string> >();
            foreach (PositionCenter pc in Enum.GetValues(typeof(PositionCenter)))
            {
                ListPositionCenters.Add(new KeyValuePair <PositionCenter, string>(pc, pc.GetCaptionString()));
            }
        }
コード例 #2
0
 public object GetTimeZones()
 {
     return(Json(_timeZoneProvider.GetTimeZones()));
 }