Exemple #1
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string)
     {
         MessageString point;
         if (MessageString.TryParse((string)value, out point))
         {
             return(point);
         }
     }
     return(base.ConvertFrom(context, culture, value));
 }
Exemple #2
0
        public static bool TryParse(string s, out MessageString result)
        {
            result = null;

            var parts = s.Split(',');

            if (parts.Length != 2)
            {
                return(false);
            }
            int imagekey;

            if (int.TryParse(parts[0], out imagekey))
            {
                result = new MessageString()
                {
                    RomId = imagekey, Username = parts[1]
                };
                return(true);
            }
            return(false);
        }