Esempio n. 1
0
        public static void UpdateTime(this MauiTimePicker mauiTimePicker, ITimePicker timePicker, UIDatePicker?picker)
        {
            picker?.UpdateTime(timePicker);

            var cultureInfo = Culture.CurrentCulture;

            if (string.IsNullOrEmpty(timePicker.Format))
            {
                NSLocale locale = new NSLocale(cultureInfo.TwoLetterISOLanguageName);

                if (picker != null)
                {
                    picker.Locale = locale;
                }
            }

            var time   = timePicker.Time;
            var format = timePicker.Format;

            mauiTimePicker.Text = time.ToFormattedString(format, cultureInfo);

            if (format != null)
            {
                if (format.IndexOf("H", StringComparison.Ordinal) != -1)
                {
                    var      ci     = new CultureInfo("de-DE");
                    NSLocale locale = new NSLocale(ci.TwoLetterISOLanguageName);

                    if (picker != null)
                    {
                        picker.Locale = locale;
                    }
                }
                else if (format.IndexOf("h", StringComparison.Ordinal) != -1)
                {
                    var      ci     = new CultureInfo("en-US");
                    NSLocale locale = new NSLocale(ci.TwoLetterISOLanguageName);

                    if (picker != null)
                    {
                        picker.Locale = locale;
                    }
                }
            }

            mauiTimePicker.UpdateCharacterSpacing(timePicker);
        }
Esempio n. 2
0
        public static void UpdateTime(this MauiTimePicker mauiTimePicker, ITimePicker timePicker, UIDatePicker?picker)
        {
            if (picker != null)
            {
                picker.Date = new DateTime(1, 1, 1).Add(timePicker.Time).ToNSDate();
            }

            var cultureInfo = Culture.CurrentCulture;

            if (string.IsNullOrEmpty(timePicker.Format))
            {
                NSLocale locale = new NSLocale(cultureInfo.TwoLetterISOLanguageName);

                if (picker != null)
                {
                    picker.Locale = locale;
                }
            }

            var time   = timePicker.Time;
            var format = timePicker.Format;

            mauiTimePicker.Text = time.ToFormattedString(format, cultureInfo);

            if (timePicker.Format?.Contains('H') == true)
            {
                var      ci     = new CultureInfo("de-DE");
                NSLocale locale = new NSLocale(ci.TwoLetterISOLanguageName);

                if (picker != null)
                {
                    picker.Locale = locale;
                }
            }
            else if (timePicker.Format?.Contains('h') == true)
            {
                var      ci     = new CultureInfo("en-US");
                NSLocale locale = new NSLocale(ci.TwoLetterISOLanguageName);

                if (picker != null)
                {
                    picker.Locale = locale;
                }
            }

            mauiTimePicker.UpdateCharacterSpacing(timePicker);
        }
Esempio n. 3
0
 public static void UpdateFormat(this MauiTimePicker mauiTimePicker, ITimePicker timePicker)
 {
     mauiTimePicker.UpdateTime(timePicker, null);
 }
Esempio n. 4
0
 public static void UpdateTextAlignment(this MauiTimePicker textField, ITimePicker timePicker)
 {
     // TODO: Update TextAlignment based on the EffectiveFlowDirection property.
 }
Esempio n. 5
0
 public static void UpdateFormat(this MauiTimePicker mauiTimePicker, ITimePicker timePicker, UIDatePicker?picker)
 {
     mauiTimePicker.UpdateTime(timePicker, picker);
 }