public NumberFormatInfo() { // Set up defaults for invariant culture mIsReadOnly = true; mCurrencyDecimalDigits = 2; mCurrencyDecimalSeparator = "."; mCurrencyGroupSeparator = ","; mCurrencyGroupSizes = new int[] { 3 }; mCurrencyNegativePattern = 0; mCurrencyPositivePattern = 0; mCurrencySymbol = "$"; mDigitSubstitution = DigitShapes.None; mNaNSymbol = "NaN"; mNativeDigits = defaultNativeDigits; mNegativeInfinitySymbol = "-Infinity"; mNegativeSign = "-"; mNumberDecimalDigits = 2; mNumberDecimalSeparator = "."; mNumberGroupSeparator = ","; mNumberGroupSizes = new int[] { 3 }; mNumberNegativePattern = 1; mPercentDecimalDigits = 2; mPercentDecimalSeparator = "."; mPercentGroupSeparator = ","; mPercentGroupSizes = new int[] { 3 }; mPercentNegativePattern = 0; mPercentPositivePattern = 0; mPercentSymbol = "%"; mPerMilleSymbol = "\x2030"; mPositiveInfinitySymbol = "Infinity"; mPositiveSign = "+"; }
internal NumberFormatInfo(StreamReader s) { this.isReadOnly = true; // Sets up information from stream this.currencyDecimalDigits = int.Parse(s.ReadLine()); this.currencyDecimalSeparator = s.ReadLine(); this.currencyGroupSeparator = s.ReadLine(); this.currencyGroupSizes = ConvertToIntArray(s.ReadLine()); this.currencyNegativePattern = int.Parse(s.ReadLine()); this.currencyPositivePattern = int.Parse(s.ReadLine()); this.currencySymbol = s.ReadLine(); this.digitSubstitution = (DigitShapes)int.Parse(s.ReadLine()); this.naNSymbol = s.ReadLine(); this.nativeDigits = s.ReadLine().Split(','); this.negativeInfinitySymbol = s.ReadLine(); this.negativeSign = s.ReadLine(); this.numberDecimalDigits = int.Parse(s.ReadLine()); this.numberDecimalSeparator = s.ReadLine(); this.numberGroupSeparator = s.ReadLine(); this.numberGroupSizes = ConvertToIntArray(s.ReadLine()); this.numberNegativePattern = int.Parse(s.ReadLine()); this.percentDecimalDigits = int.Parse(s.ReadLine()); this.percentDecimalSeparator = s.ReadLine(); this.percentGroupSeparator = s.ReadLine(); this.percentGroupSizes = ConvertToIntArray(s.ReadLine()); this.percentNegativePattern = int.Parse(s.ReadLine()); this.percentPositivePattern = int.Parse(s.ReadLine()); this.percentSymbol = s.ReadLine(); this.perMilleSymbol = s.ReadLine(); this.positiveInfinitySymbol = s.ReadLine(); this.positiveSign = s.ReadLine(); }
public NumberFormatInfo() { this.isReadOnly = true; // Set up defaults for invariant culture this.currencyDecimalDigits = 2; this.currencyDecimalSeparator = "."; this.currencyGroupSeparator = ","; this.currencyGroupSizes = new int[] { 3 }; this.currencyNegativePattern = 0; this.currencyPositivePattern = 0; this.currencySymbol = "$"; this.digitSubstitution = DigitShapes.None; this.naNSymbol = "NaN"; this.nativeDigits = defaultNativeDigits; this.negativeInfinitySymbol = "-Infinity"; this.negativeSign = "-"; this.numberDecimalDigits = 2; this.numberDecimalSeparator = "."; this.numberGroupSeparator = ","; this.numberGroupSizes = new int[] { 3 }; this.numberNegativePattern = 1; this.percentDecimalDigits = 2; this.percentDecimalSeparator = "."; this.percentGroupSeparator = ","; this.percentGroupSizes = new int[] { 3 }; this.percentNegativePattern = 0; this.percentPositivePattern = 0; this.percentSymbol = "%"; this.perMilleSymbol = "\x2030"; this.positiveInfinitySymbol = "Infinity"; this.positiveSign = "+"; }
private void OnApplyClicked(object sender, RoutedEventArgs e) { DigitShapes shapes = DigitShapes.None; if (_substContext.IsChecked == true) { shapes = DigitShapes.Context; } else if (_substAlways.IsChecked == true) { shapes = DigitShapes.NativeNational; } try { Cursor = Cursors.Wait; Program.Apply((int)_cultureBox.SelectedValue, shapes, (string)_digitsBox.SelectedValue); MessageBox.Show(this, "Succesfully applied.", Title, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Win32Exception ex) { MessageBox.Show(this, "Selected configuration was rejected. Windows might not support these settings yet, sorry!" + Environment.NewLine + Environment.NewLine + "Returned error: " + ex.Message, Title, MessageBoxButton.OK, MessageBoxImage.Error); } finally { ClearValue(CursorProperty); } }
private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName) { switch (digitSub) { case DigitShapes.Context: case DigitShapes.None: case DigitShapes.NativeNational: return; } throw new ArgumentException(propertyName, Environment.GetResourceString("Argument_InvalidDigitSubstitution")); }
public void DigitSubstitutionListTest(string cultureName, DigitShapes shape) { try { CultureInfo ci = CultureInfo.GetCultureInfo(cultureName); Assert.Equal(ci.NumberFormat.DigitSubstitution, shape); } catch (CultureNotFoundException) { // ignore the cultures that we cannot create as it is not supported on the platforms } }
private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName) { switch (digitSub) { case DigitShapes.Context: case DigitShapes.None: case DigitShapes.NativeNational: // Success. break; default: throw new ArgumentException(SR.Argument_InvalidDigitSubstitution, propertyName); } }
static private void VerifyDigitSubstitution(DigitShapes digitSub, String propertyName) { switch (digitSub) { case DigitShapes.Context: case DigitShapes.None: case DigitShapes.NativeNational: // Success. break; default: throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDigitSubstitution"), propertyName); } }
private static bool ArgumentsParseShapes(string value, out DigitShapes shapes) { if (Enum.TryParse(value, true, out shapes)) { return(true); } if ("native".Equals(value, StringComparison.CurrentCultureIgnoreCase) || "national".Equals(value, StringComparison.CurrentCultureIgnoreCase)) { shapes = DigitShapes.NativeNational; return(true); } return(false); }
static private void VerifyDigitSubstitution(DigitShapes digitSub, String propertyName) { switch(digitSub) { case DigitShapes.Context: case DigitShapes.None: case DigitShapes.NativeNational: // Success. break; default: throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDigitSubstitution"), propertyName); } }