예제 #1
0
 public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     if (value != null)
     {
         string s = value as string;
         if (!string.IsNullOrEmpty(s))
         {
             return(PropEditorAudioSampleSize.GetRateByName(s));
         }
         else
         {
             return(Convert.ToInt16(value));
         }
     }
     return(base.ConvertFrom(context, culture, value));
 }
예제 #2
0
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (typeof(string).Equals(destinationType))
     {
         if (value != null)
         {
             if (value is string)
             {
                 return(value);
             }
             short rate;
             try
             {
                 rate = Convert.ToInt16(value);
             }
             catch
             {
                 rate = 16;
             }
             return(PropEditorAudioSampleSize.RateName(rate));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }