private void callback_Callback(object source, CallbackEventArgs e) { String[] p = e.Parameter.Split('|'); Object key = TypeDescriptor.GetConverter(ObjectTypeInfo.KeyMember.MemberType).ConvertFromString(p[0]); IMemberInfo member = ObjectTypeInfo.FindMember(p[1]); Object value = null; if (typeof(IXPSimpleObject).IsAssignableFrom(member.MemberType)) { Type memberKeyType = XafTypesInfo.Instance.FindTypeInfo(member.MemberType).KeyMember.MemberType; int index1 = p[2].LastIndexOf("(", StringComparison.Ordinal); int index2 = p[2].LastIndexOf(")", StringComparison.Ordinal); if (index1 > 0 && index2 > index1) { string memberKeyText = p[2].Substring(index1 + 1, index2 - index1 - 1); value = ObjectSpace.GetObjectByKey(member.MemberType, Convert.ChangeType(memberKeyText, memberKeyType)); } } else { value = TypeDescriptor.GetConverter(member.MemberType).ConvertFromString(p[2]); } object obj = ObjectSpace.GetObjectByKey(ObjectTypeInfo.Type, key); member.SetValue(obj, value); ObjectSpace.CommitChanges(); }
string GetDisplayText(IPictureItem pictureItem) { string text = Model.Columns.GetVisibleColumns().Aggregate("", (current, modelColumn) => current + (ObjectTypeInfo.FindMember(modelColumn.PropertyName).GetValue(pictureItem) + "<br>")); return(text.TrimEnd("<br>".ToCharArray())); }