public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (!string.IsNullOrEmpty((string)value)) { IDynamics365UsersProvider provider = (IDynamics365UsersProvider)context.Instance; List <Dynamics365User> users = provider.GetUsers(); string id = Regex.Match((string)value, CoreUtility.FieldMatchPattern).Groups[1].Value; return(users.FirstOrDefault(x => x.ID.ToString() == id)); } return(null); }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { IDynamics365UsersProvider provider = (IDynamics365UsersProvider)context.Instance; return(new StandardValuesCollection(provider.GetUsers())); }