Example #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(PropEditorFrameRate.GetRateByname(s));
         }
         else
         {
             return(Convert.ToInt32(value));
         }
     }
     return(base.ConvertFrom(context, culture, value));
 }
Example #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);
             }
             int rate;
             try
             {
                 rate = Convert.ToInt32(value);
             }
             catch
             {
                 rate = 24000;
             }
             return(PropEditorFrameRate.RateName(rate));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }