Beispiel #1
0
        void BtnNSDate_TouchUpInside(object sender, EventArgs e)
        {
            var currentTime2 = NSDate.Now;
            //lblDate.Text = currentTime2.Description;

            var tiempoFormato = new NSDateFormatter
            {
                TimeStyle  = NSDateFormatterStyle.Medium,
                DateFormat = "HH:mm:ss a"
            };

            var fechaFormato = new NSDateFormatter
            {
                DateStyle  = NSDateFormatterStyle.Long,
                DateFormat = "dd 'de' MMMM 'del' yyyy"
            };

            NSLocale f = new NSLocale(identifier: ("es_mx"));

            fechaFormato.Locale  = f;
            tiempoFormato.Locale = f;
            lblDate.Text         = fechaFormato.ToString(currentTime2);
            lblTime.Text         = tiempoFormato.ToString(currentTime2);

            /*
             * dateFormatter.locale = Locale(identifier: "en_US");
             *
             * NSDateFormatter.locale = NSLocale(NSIdentifier: "en_US");
             */
        }
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //Workaround from https://bugzilla.xamarin.com/show_bug.cgi?id=59596
            try
            {
                // Get the user's preferred language
                var language = NSLocale.PreferredLanguages[0];
                // Extract the language code
                var languageDic  = NSLocale.ComponentsFromLocaleIdentifier(language);
                var languageCode = languageDic["kCFLocaleLanguageCodeKey"].ToString();
                // Force .NET culture to that of the device
                var culture = new System.Globalization.CultureInfo(languageCode);
                System.Globalization.CultureInfo.CurrentCulture   = culture;
                System.Globalization.CultureInfo.CurrentUICulture = culture;
            }
            catch (Exception)
            {
                Console.WriteLine("Failed to set culture from iOS device culture");
            }
            global::Xamarin.Forms.Forms.Init();
            C1.Xamarin.Forms.Calendar.Platform.iOS.C1CalendarRenderer.Init();

            LoadApplication(new C1Calendar101.App());

            return(base.FinishedLaunching(app, options));
        }
        async void DateTimePikerFechafin(object sender, EventArgs e)
        {
            var modalPicker = new ModalPickerViewController(ModalPickerType.Date, "Elije Fecha", this)
            {
                HeaderBackgroundColor  = UIColor.Red,
                HeaderTextColor        = UIColor.White,
                TransitioningDelegate  = new ModalPickerTransitionDelegate(),
                ModalPresentationStyle = UIModalPresentationStyle.Custom
            };

            modalPicker.DatePicker.Mode = UIDatePickerMode.DateAndTime;

            modalPicker.OnModalPickerDismissed += (s, ea) =>
            {
                var dateFormatterFecha = new NSDateFormatter()
                {
                    DateFormat = "yyyy-MM-dd"
                };
                var dateFormatterHora = new NSDateFormatter()
                {
                    DateFormat = "HH:mm:ss"
                };

                NSLocale locale = NSLocale.FromLocaleIdentifier("es_MX");
                dateFormatterFecha.Locale = locale;
                dateFormatterHora.Locale  = locale;

                txtFinal.Text = dateFormatterFecha.ToString(modalPicker.DatePicker.Date) + " " + dateFormatterHora.ToString(modalPicker.DatePicker.Date);
            };

            await PresentViewControllerAsync(modalPicker, true);
        }
Beispiel #4
0
        async void DatePickerButtonTapped(object sender, EventArgs e)
        {
            var modalPicker = new ModalPickerViewController(ModalPickerType.Date, "Elije una Fecha", this)
            {
                HeaderBackgroundColor  = UIColor.Red,
                HeaderTextColor        = UIColor.White,
                TransitioningDelegate  = new ModalPickerTransitionDelegate(),
                ModalPresentationStyle = UIModalPresentationStyle.Custom
            };

            modalPicker.DatePicker.Mode = UIDatePickerMode.Date;

            modalPicker.OnModalPickerDismissed += (s, ea) =>
            {
                var dateFormatter = new NSDateFormatter()
                {
                    DateFormat = "yyyy-MM-dd"
                };

                NSLocale locale = NSLocale.FromLocaleIdentifier("es_MX");
                dateFormatter.Locale  = locale;
                txtRequeridaPara.Text = dateFormatter.ToString(modalPicker.DatePicker.Date);
            };

            await PresentViewControllerAsync(modalPicker, true);
        }
Beispiel #5
0
        public void CountryLessLocale()
        {
            string name = "zh-Hans";             // there's no country data from the supplied name - ref bug #18520

            using (NSLocale locale = new NSLocale(name)) {
                Assert.Null(locale.CountryCode, "CountryCode");
            }
        }
        public void Is24HourFormat_24HourLocaleFormat_ReturnsTrue(string localeId, bool expectedResult)
        {
            var locale = NSLocale.FromLocaleIdentifier(localeId);

            var result = locale.Is24HourFormat();

            Assert.Equal(expectedResult, result);
        }
Beispiel #7
0
        public void FromLocaleIdentifier()
        {
            TestRuntime.AssertXcodeVersion(5, 0);

            string ident = NSLocale.CurrentLocale.Identifier;

            Assert.That(NSLocale.FromLocaleIdentifier(ident).Identifier, Is.EqualTo(ident), "FromLocaleIdentifier");
        }
Beispiel #8
0
 public void DisplayName_En()
 {
     using (NSLocale en = new NSLocale("en-US")) {
         Assert.That(en.GetIdentifierDisplayName(en.Identifier), Is.EqualTo("English (United States)"), "Identifier");
         Assert.That(en.GetLanguageCodeDisplayName(en.LanguageCode), Is.EqualTo("English"), "LanguageCode");
         Assert.That(en.GetCountryCodeDisplayName(en.CountryCode), Is.EqualTo("United States"), "CountryCode");
         Assert.That(en.GetCurrencyCodeDisplayName(en.CurrencyCode), Is.EqualTo("US Dollar"), "CurrencyCode");
     }
 }
Beispiel #9
0
		public void TestConversion ()
		{
			NSLocale locale;
			NSString canonical;
			CultureInfo info;
			
			locale = new NSLocale("en");
            Assert.IsNotNull(locale.LocaleIdentifier, "LocaleIdentifier should not be null");
			Assert.AreEqual("en", locale.LocaleIdentifier.ToString(), "Identifier should be equal");
			Check (locale);

			canonical = NSLocale.CanonicalLanguageIdentifierFromString("en");
			Assert.AreEqual("en", canonical.ToString(), "Canonical languages should be equal");
			canonical = NSLocale.CanonicalLocaleIdentifierFromString("en");
			Assert.AreEqual("en", canonical.ToString(), "Canonical locales should be equal");

			info = locale.ToCultureInfo ();
			Assert.AreEqual("en", info.Name, "Display name should be equal");

			locale = new NSLocale("en-US");
			Assert.AreEqual("en-US", locale.LocaleIdentifier.ToString(), "Identifier should be equal");
			Assert.AreEqual("en", locale.ObjectForKey<NSString>(NSLocale.NSLocaleLanguageCode).ToString(), "Language values should be equal");
			Assert.AreEqual("US", locale.ObjectForKey<NSString>(NSLocale.NSLocaleCountryCode).ToString(), "Country values should be equal");
			Check (locale);

			canonical = NSLocale.CanonicalLanguageIdentifierFromString("en-US");
			Assert.AreEqual("en-US", canonical.ToString(), "Canonical languages should be equal");
			canonical = NSLocale.CanonicalLocaleIdentifierFromString("en-US");
			Assert.AreEqual("en-US", canonical.ToString(), "Canonical locales should be equal");

			info = locale.ToCultureInfo ();
			Assert.AreEqual("en-US", info.Name, "Display name should be equal");

			locale = new NSLocale("fr_FR");
			Assert.AreEqual("fr_FR", locale.LocaleIdentifier.ToString(), "Identifier should be equal");
			Assert.AreEqual("fr", locale.ObjectForKey<NSString>(NSLocale.NSLocaleLanguageCode).ToString(), "Language values should be equal");
			Assert.AreEqual("FR", locale.ObjectForKey<NSString>(NSLocale.NSLocaleCountryCode).ToString(), "Country values should be equal");
			Check (locale);
			
			canonical = NSLocale.CanonicalLanguageIdentifierFromString("fr_FR");
			Assert.AreEqual("fr-FR", canonical.ToString(), "Canonical languages should be equal");
			canonical = NSLocale.CanonicalLocaleIdentifierFromString("fr_FR");
			Assert.AreEqual("fr_FR", canonical.ToString(), "Canonical locales should be equal");
			
			info = locale.ToCultureInfo ();
			Assert.AreEqual("fr-FR", info.Name, "Display name should be equal");

			locale = new NSLocale("zh-Hant_TW");
			Assert.AreEqual("zh_TW", locale.LocaleIdentifier.ToString(), "Identifier should be equal");
			Assert.AreEqual("zh", locale.ObjectForKey<NSString>(NSLocale.NSLocaleLanguageCode).ToString(), "Language values should be equal");
			Assert.AreEqual("TW", locale.ObjectForKey<NSString>(NSLocale.NSLocaleCountryCode).ToString(), "Country values should be equal");
			Check (locale);
			
			info = locale.ToCultureInfo ();
			Assert.AreEqual("zh-TW", info.Name, "Display name should be equal");
		}
Beispiel #10
0
        public static bool Has24HourTimeFormat(this NSLocale locale)
        {
            var formatter = new NSDateFormatter();

            formatter.Locale    = locale;
            formatter.DateStyle = NSDateFormatterStyle.None;
            formatter.TimeStyle = NSDateFormatterStyle.Short;
            var dateString = NSDateFormatter.ToLocalizedString(DateTime.Now.ToNSDate(), NSDateFormatterStyle.None, NSDateFormatterStyle.Short);

            return(!dateString.Contains(formatter.AMSymbol) && !dateString.Contains(formatter.PMSymbol));
        }
        /// <summary>
        ///     Gets a value indicating whether <c>true</c> if times should be formatted as 24 hour times,
        ///     <c>false</c> if times should be formatted as 12 hour (AM/PM) times.
        /// </summary>
        /// <param name="locale">Locale to check.</param>
        /// <returns><c>true</c> if 24 hour time format is selected, <c>false</c> otherwise.</returns>
        public static bool Is24HourFormat(this NSLocale locale)
        {
            if (locale == null)
            {
                throw new ArgumentNullException(nameof(locale));
            }

            var template = NSDateFormatter.GetDateFormatFromTemplate("j", 0, locale);

            return(!template.Contains("a"));
        }
        public void FromLocaleIdentifier()
        {
            if (!TestRuntime.CheckSystemAndSDKVersion(7, 0))
            {
                Assert.Inconclusive("Requires iOS7 or later");
            }

            string ident = NSLocale.CurrentLocale.Identifier;

            Assert.That(NSLocale.FromLocaleIdentifier(ident).Identifier, Is.EqualTo(ident), "FromLocaleIdentifier");
        }
        public APLParseOperation(NSData data, NSPersistentStoreCoordinator persistentStoreCoordinator)
        {
            dateFormatter = new NSDateFormatter()
            {
                DateFormat = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'",
                TimeZone   = NSTimeZone.LocalTimeZone,
                Locale     = NSLocale.FromLocaleIdentifier("en_US_POSIX")
            };

            earthquakeData = data;
            sharedPSC      = persistentStoreCoordinator;
        }
Beispiel #14
0
        private void ResolveCalendarCulture()
        {
            try {
                UIDatePicker calendar = (UIDatePicker)Control.InputView;

                NSLocale nSLocale = ((DatePickerExtended)Element).CalendarCulture != null ? new NSLocale(((DatePickerExtended)Element).CalendarCulture.Name.Substring(0, 2)) : new NSLocale("en");

                calendar.Locale = nSLocale;
            }
            catch (System.Exception exc) {
                Debugger.Break();
            }
        }
        public void GetDateFormatFromTemplateTest()
        {
            var          us_locale      = new NSLocale("en_US");
            var          gb_locale      = new NSLocale("en_GB");
            const string dateComponents = "yMMMMd";

            var dateFormat = NSDateFormatter.GetDateFormatFromTemplate(dateComponents, 0, us_locale);

            Assert.AreEqual("MMMM d, y", dateFormat, "#US");

            dateFormat = NSDateFormatter.GetDateFormatFromTemplate(dateComponents, 0, gb_locale);
            Assert.AreEqual("d MMMM y", dateFormat, "GB");
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TextField.Locale    = NSLocale.FromLocaleIdentifier("en_US");
            TextField.MaxLength = 10;
            TextField.Format    = (string text, out string newText) =>
            {
                newText = "";

                return(text == "$0.0");
            };
        }
        static NSDateFormatter NewDateFormatter(NSDateFormatter current, NSLocale locale)
        {
            var dateStyle = current.DateStyle;
            var timeStyle = current.TimeStyle;

            var baseline = BaselineFormatter;

            var merged = new NSDateFormatter();

            merged.Locale = locale;

            merged.DateStyle = baseline.DateStyle = current.DateStyle = dateStyle;
            merged.TimeStyle = baseline.TimeStyle = current.TimeStyle = NSDateFormatterStyle.None;
            var mergedDateFormat   = merged.DateFormat;
            var baselineDateFormat = baseline.DateFormat;
            var currentDateFormat  = current.DateFormat;

            merged.DateStyle = baseline.DateStyle = current.DateStyle = NSDateFormatterStyle.None;
            merged.TimeStyle = baseline.TimeStyle = current.TimeStyle = timeStyle;
            var mergedTimeFormat   = merged.DateFormat;
            var baselineTimeFormat = baseline.DateFormat;
            var currentTimeFormat  = current.DateFormat;

            merged.DateStyle = baseline.DateStyle = current.DateStyle = dateStyle;
            merged.TimeStyle = baseline.TimeStyle = current.TimeStyle = timeStyle;

            if (!current.AMSymbol.Equals(baseline.AMSymbol))
            {
                merged.AMSymbol = current.AMSymbol;
            }
            if (!current.PMSymbol.Equals(baseline.PMSymbol))
            {
                merged.PMSymbol = current.PMSymbol;
            }

            if (!current.DateFormat.Equals(baseline.DateFormat))
            {
                var format = merged.DateFormat;
                if (baselineDateFormat != currentDateFormat)
                {
                    format = format.Replace(mergedDateFormat, currentDateFormat);
                }
                if (baselineTimeFormat != currentTimeFormat)
                {
                    format = format.Replace(mergedTimeFormat, currentTimeFormat);
                }
                merged.DateFormat = format;
            }

            return(merged);
        }
Beispiel #18
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			NSLocale locale = new NSLocale ("en");
			this.datePicker.Locale = locale;
			this.datePicker.Mode = UIDatePickerMode.Date;
			// Perform any additional setup after loading the view, typically from a nib.
			this.datePicker.ValueChanged+=DatePicker_ValueChanged;
			lbl = new UILabel ();
			lbl.Frame = new CoreGraphics.CGRect (100, 20, 200, 30);
			lbl.BackgroundColor = UIColor.Gray;
			this.View.AddSubview (lbl);
			CreateCustomerDatePicker ();

		}
Beispiel #19
0
 public virtual void SetSelectedLocale(NSLocale locale, bool animated)
 {
     if (locale == null)
     {
         throw new ArgumentNullException("locale");
     }
     if (IsDirectBinding)
     {
         global::ApiDefinition.Messaging.void_objc_msgSend_IntPtr_bool(this.Handle, Selector.GetHandle("setSelectedLocale:animated:"), locale.Handle, animated);
     }
     else
     {
         global::ApiDefinition.Messaging.void_objc_msgSendSuper_IntPtr_bool(this.SuperHandle, Selector.GetHandle("setSelectedLocale:animated:"), locale.Handle, animated);
     }
 }
Beispiel #20
0
        public void DisplayName_Fr()
        {
            using (NSLocale en = new NSLocale("en-US"))
                using (NSLocale fr = new NSLocale("fr-CA")) {
                    Assert.That(fr.GetIdentifierDisplayName(en.Identifier), Is.EqualTo("anglais (États-Unis)"), "Identifier");
                    Assert.That(fr.GetLanguageCodeDisplayName(en.LanguageCode), Is.EqualTo("anglais"), "LanguageCode");
                    Assert.That(fr.GetCountryCodeDisplayName(en.CountryCode), Is.EqualTo("États-Unis"), "CountryCode");
                    Assert.That(fr.GetCurrencyCodeDisplayName(en.CurrencyCode), Is.EqualTo("dollar des États-Unis"), "CurrencyCode");

                    Assert.That(en.GetIdentifierDisplayName(fr.Identifier), Is.EqualTo("French (Canada)"), "Identifier");
                    Assert.That(en.GetLanguageCodeDisplayName(fr.LanguageCode), Is.EqualTo("French"), "LanguageCode");
                    Assert.That(en.GetCountryCodeDisplayName(fr.CountryCode), Is.EqualTo("Canada"), "CountryCode");
                    Assert.That(en.GetCurrencyCodeDisplayName(fr.CurrencyCode), Is.EqualTo("Canadian Dollar"), "CurrencyCode");
                }
        }
Beispiel #21
0
        public override string GetCountryCodeViaLocale()
        {
            try
            {
                string response = NSLocale.GetCurrentCountryCode();
                Debug.Log("[GetCountryCodeViaLocale]. Response: " + (response ?? "null"));

                return(response);
            }
            catch (Exception e)
            {
                Debug.Log("[GetCountryCodeViaLocale]. Error: " + e.Message);
                return(EEARegionStatus.Unknown.ToString());
            }
        }
Beispiel #22
0
        partial void BtnNSDate_TouchUpInside(Foundation.NSObject sender)
        {
            var             currentTime   = new NSDate();
            NSDateFormatter dateFormatter = new NSDateFormatter();

            dateFormatter.DateFormat = "dd 'de' MMMM 'de' yyyy";
            NSDateFormatter timeFormatter = new NSDateFormatter();

            timeFormatter.DateFormat = "h:m:s a";
            NSLocale locale = new NSLocale("es_MX");

            dateFormatter.Locale = locale;
            timeFormatter.Locale = locale;
            LblDate.Text         = dateFormatter.ToString(currentTime);
            LblTime.Text         = timeFormatter.ToString(currentTime);
        }
Beispiel #23
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);
        }
Beispiel #24
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);
        }
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            if (Settings.OverideDistance == false)
            {
                NSLocale locale = NSLocale.CurrentLocale;
                Settings.DistanceIsMetric = locale.UsesMetricSystem;
            }

            SetupParallax();
            View.UserInteractionEnabled = true;

            View.AddGestureRecognizer(new UISwipeGestureRecognizer(gesture =>
                                                                   _stepManager.StartCountingFrom(DateTime.Now))
            {
                Direction = UISwipeGestureRecognizerDirection.Down,
            });

            View.AddGestureRecognizer(new UISwipeGestureRecognizer(gesture =>
                                                                   _stepManager.StartCountingFrom(DateTime.Today))
            {
                Direction = UISwipeGestureRecognizerDirection.Up,
            });

            // Perform any additional setup after loading the view, typically from a nib.
            _progressView       = new ProgressView();
            _progressView.Frame = this.View.Frame;
            this.View.AddSubview(_progressView);
            this.View.SendSubviewToBack(_progressView);
            _stepManager.DailyStepCountChanged += TodaysStepCountChanged;

            #if !DEBUG
            if (CMStepCounter.IsStepCountingAvailable == false)
            {
                var unsupportedDevice = new UnsupportedDevice();
                unsupportedDevice.View.Frame = View.Frame;
                View.Add(unsupportedDevice.View);
            }
            #endif

            btnDistance.SetTitleColor(UIColor.White, UIControlState.Normal);
            btnDistance.SetTitleColor(UIColor.White, UIControlState.Selected);
            btnDistance.SetTitleColor(UIColor.White, UIControlState.Highlighted);
            lblDate.Text = DateString;
        }
Beispiel #26
0
        public void DisplayCountryCodeNames(NSString s)
        {
            Console.WriteLine(s);
            NSLocale current = NSLocale.CurrentLocale;
            IntPtr   handle  = current.Handle;
            IntPtr   selDisplayNameForKeyValue = new Selector("displayNameForKey:value:").Handle;

            foreach (var countryCode in NSLocale.ISOCountryCodes)
            {
                using (var nsvalue = new NSString(countryCode)) {
                    string ret = NSString.FromHandle(Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(handle, selDisplayNameForKeyValue, s.Handle, nsvalue.Handle));
                    if (!String.IsNullOrWhiteSpace(ret))
                    {
                        Console.WriteLine("{0} -> {1}", countryCode, ret);
                    }
                }
            }
        }
            protected internal override void NativeInit()
            {
                if (this.NativeUIElement == null)
                {
                    var nativePicker = new UIDatePicker
                    {
                        Locale      = NSLocale.FromLocaleIdentifier(CultureInfo.CurrentUICulture.Name.Replace('-', '_')),
                        MaximumDate = ConvertDate(parent.MaxYear),
                        MinimumDate = ConvertDate(parent.MinYear),
                        Mode        = UIDatePickerMode.Date
                    };
                    nativePicker.SetDate(ConvertDate(parent.Date), false);
                    nativePicker.ValueChanged += OnDateChanged;
                    this.NativeUIElement       = nativePicker;
                }

                base.NativeInit();
            }
Beispiel #28
0
 public void Properties()
 {
     using (NSLocale en = new NSLocale("en-US")) {
         Assert.That(en.AlternateQuotationBeginDelimiterKey, Is.EqualTo("‘"), "AlternateQuotationBeginDelimiterKey");
         Assert.That(en.AlternateQuotationEndDelimiterKey, Is.EqualTo("’"), "AlternateQuotationEndDelimiterKey");
         Assert.Null(en.CollationIdentifier, "CollationIdentifier");
         Assert.That(en.CollatorIdentifier, Is.EqualTo("en-US"), "CollatorIdentifier");
         Assert.That(en.CountryCode, Is.EqualTo("US"), "CountryCode");
         Assert.That(en.CurrencyCode, Is.EqualTo("USD"), "CurrencyCode");
         Assert.That(en.CurrencySymbol, Is.EqualTo("$"), "CurrencySymbol");
         Assert.That(en.DecimalSeparator, Is.EqualTo("."), "DecimalSeparator");
         Assert.That(en.GroupingSeparator, Is.EqualTo(","), "GroupingSeparator");
         Assert.That(en.Identifier, Is.EqualTo("en-US"), "Identifier");
         Assert.That(en.LanguageCode, Is.EqualTo("en"), "LanguageCode");
         Assert.That(en.LocaleIdentifier, Is.EqualTo("en-US"), "LocaleIdentifier");
         Assert.That(en.MeasurementSystem, Is.EqualTo("U.S."), "MeasurementSystem");
         Assert.That(en.QuotationBeginDelimiterKey, Is.EqualTo("“"), "QuotationBeginDelimiterKey");
         Assert.That(en.QuotationEndDelimiterKey, Is.EqualTo("”"), "QuotationEndDelimiterKey");
     }
 }
Beispiel #29
0
        void UpdateTime()
        {
            _picker.Date = new DateTime(1, 1, 1).Add(Element.Time).ToNSDate();
            string iOSLocale    = NSLocale.CurrentLocale.CountryCode;
            var    cultureInfos = CultureInfo.GetCultures(CultureTypes.AllCultures)
                                  .Where(c => c.Name.EndsWith("-" + iOSLocale)).FirstOrDefault();

            if (cultureInfos == null)
            {
                cultureInfos = CultureInfo.InvariantCulture;
            }

            if (String.IsNullOrEmpty(Element.Format))
            {
                string   timeformat = cultureInfos.DateTimeFormat.ShortTimePattern;
                NSLocale locale     = new NSLocale(cultureInfos.TwoLetterISOLanguageName);
                Control.Text   = DateTime.Today.Add(Element.Time).ToString(timeformat, cultureInfos);
                _picker.Locale = locale;
            }
            else
            {
                Control.Text = DateTime.Today.Add(Element.Time).ToString(Element.Format, cultureInfos);
            }

            if (Element.Format?.Contains('H') == true)
            {
                var      ci     = new System.Globalization.CultureInfo("de-DE");
                NSLocale locale = new NSLocale(ci.TwoLetterISOLanguageName);
                _picker.Locale = locale;
            }
            else if (Element.Format?.Contains('h') == true)
            {
                var      ci     = new System.Globalization.CultureInfo("en-US");
                NSLocale locale = new NSLocale(ci.TwoLetterISOLanguageName);
                _picker.Locale = locale;
            }
            Element.InvalidateMeasureNonVirtual(Controls.Internals.InvalidationTrigger.MeasureChanged);
        }
Beispiel #30
0
 public void SetUp()
 {
     formatter             = new NSNumberFormatter();
     formatter.NumberStyle = NSNumberFormatterStyle.Currency;
     formatter.Locale      = NSLocale.FromLocaleIdentifier("en-US");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:AcidStudios.iOS.Dialog.DatePickerDialog"/> class.
 /// Specify the Text color of the Picker and Modal Window Title, Done, Cancel Button, the font that will Use, Locale and Display/Hide Cancel Button
 /// </summary>
 /// <param name="textColor">Text color.</param>
 /// <param name="buttonColor">Button color.</param>
 /// <param name="cancelButtonColor">Cancel button color.</param>
 /// <param name="font">Font used for Text in Modal Window.</param>
 /// <param name="locale">Locale for Date Picker.</param>
 /// <param name="showCancelButton">Display or Hide the Cancel Button.</param>
 public DatePickerDialog(UIColor textColor, UIColor buttonColor, UIColor cancelButtonColor, UIFont font, NSLocale locale, bool showCancelButton) : base(textColor, buttonColor, cancelButtonColor, font, showCancelButton)
 {
     this.locale = locale;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:AcidStudios.iOS.Dialog.DatePickerDialog"/> class.
 /// Gives the chance to Show or Hide a Cancel Button and specify the Locale of DatePicker.
 /// </summary>
 /// <param name="locale">Locale for Date Picker.</param>
 /// <param name="showCancelButton">Display or Hide the Cancel Button.</param>
 public DatePickerDialog(NSLocale locale, bool showCancelButton) : this(null, null, null, null, locale, showCancelButton)
 {
 }
 public static string SymbolForLocale(NSLocale locale)
 {
     NSNumberFormatter formatter = new NSNumberFormatter ();
     formatter.NumberStyle = NSNumberFormatterStyle.Currency;
     formatter.Locale = locale;
     return formatter.CurrencySymbol;
 }
		public MMNumberKeyboard(CGRect  Frame,/*inputViewStyle*/ UIInputViewStyle inputViewStyle ,/*locale*/  NSLocale  locale):base(Frame ,/*inputViewStyle*/ inputViewStyle){
			//this = base.init(Frame ,/*inputViewStyle*/ inputViewStyle);
			//if (this) {
				this.locale = locale;
				this._commonInit();
			//}
			//return this;
		}