Esempio n. 1
0
 // given a formatString/formatInfo combination, this method suggest the most appropriate user control
 // the result of the function is one of the strings "Numeric", "Currency", "DateTime", "Percentage", "Scientific", "Custom"
 public static string FormatTypeStringFromFormatString(string formatString)
 {
     if (string.IsNullOrEmpty(formatString))
     {
         return(SR.BindingFormattingDialogFormatTypeNoFormatting);
     }
     if (NumericFormatType.ParseStatic(formatString))
     {
         return(SR.BindingFormattingDialogFormatTypeNumeric);
     }
     else if (CurrencyFormatType.ParseStatic(formatString))
     {
         return(SR.BindingFormattingDialogFormatTypeCurrency);
     }
     else if (DateTimeFormatType.ParseStatic(formatString))
     {
         return(SR.BindingFormattingDialogFormatTypeDateTime);
     }
     else if (ScientificFormatType.ParseStatic(formatString))
     {
         return(SR.BindingFormattingDialogFormatTypeScientific);
     }
     else
     {
         return(SR.BindingFormattingDialogFormatTypeCustom);
     }
 }
 public static string FormatTypeStringFromFormatString(string formatString)
 {
     if (string.IsNullOrEmpty(formatString))
     {
         return(System.Design.SR.GetString("BindingFormattingDialogFormatTypeNoFormatting"));
     }
     if (NumericFormatType.ParseStatic(formatString))
     {
         return(System.Design.SR.GetString("BindingFormattingDialogFormatTypeNumeric"));
     }
     if (CurrencyFormatType.ParseStatic(formatString))
     {
         return(System.Design.SR.GetString("BindingFormattingDialogFormatTypeCurrency"));
     }
     if (DateTimeFormatType.ParseStatic(formatString))
     {
         return(System.Design.SR.GetString("BindingFormattingDialogFormatTypeDateTime"));
     }
     if (ScientificFormatType.ParseStatic(formatString))
     {
         return(System.Design.SR.GetString("BindingFormattingDialogFormatTypeScientific"));
     }
     return(System.Design.SR.GetString("BindingFormattingDialogFormatTypeCustom"));
 }