protected override async Task InitializeAsync()
        {
            await base.InitializeAsync();

            using (AvailableFormats.SuspendChangeNotifications())
            {
                foreach (var cultureInfo in CultureInfo.GetCultures(CultureTypes.AllCultures))
                {
                    var format = new CultureFormat
                    {
                        CultureCode = $"[{cultureInfo.IetfLanguageTag}]",
                        FormatValue = cultureInfo.DateTimeFormat.ShortDatePattern
                    };

                    AvailableFormats.Add(format);
                    if (!cultureInfo.Equals(CultureInfo.CurrentCulture))
                    {
                        continue;
                    }

                    SelectedFormat  = format;
                    DateValueString = DateValue.Value.ToString(format.FormatValue);
                }
            }
        }
Exemplo n.º 2
0
        protected override async Task InitializeAsync()
        {
            await base.InitializeAsync();

            using (AvailableFormats.SuspendChangeNotifications())
            {
                foreach (var cultureInfo in CultureInfo.GetCultures(CultureTypes.AllCultures))
                {
                    var format = new CultureFormat
                    {
                        Culture     = cultureInfo,
                        FormatValue = cultureInfo.DateTimeFormat.ShortDatePattern + " " + cultureInfo.DateTimeFormat.LongTimePattern
                    };

                    AvailableFormats.Add(format);

                    format = new CultureFormat
                    {
                        Culture     = cultureInfo,
                        FormatValue = cultureInfo.DateTimeFormat.ShortDatePattern
                    };

                    AvailableFormats.Add(format);

                    format = new CultureFormat
                    {
                        Culture     = cultureInfo,
                        FormatValue = cultureInfo.DateTimeFormat.ShortDatePattern + " " + cultureInfo.DateTimeFormat.ShortTimePattern
                    };

                    AvailableFormats.Add(format);

                    if (cultureInfo.Equals(CultureInfo.CurrentCulture))
                    {
                        SelectedFormat = format;
                    }
                }
            }
        }
 public override void Configure(XmlElement element)
 {
     base.Configure(element);
     CultureTypes  = XmlUtilities.GetAttribute(element, "cultureTypes", CultureTypes);
     CultureFormat = XmlUtilities.GetAttribute(element, "cultureFormat", CultureFormat);
 }
 public CultureGenerator()
 {
     CultureTypes  = CultureTypes.AllCultures;
     CultureFormat = CultureFormat.Auto;
 }
 public override void Configure(XmlElement element)
 {
     base.Configure(element);
     CultureTypes = XmlUtilities.GetAttribute(element, "cultureTypes", CultureTypes);
     CultureFormat = XmlUtilities.GetAttribute(element, "cultureFormat", CultureFormat);
 }
 public CultureGenerator()
 {
     CultureTypes = CultureTypes.AllCultures;
     CultureFormat = CultureFormat.Auto;
 }