104 throw new ArgumentNullException(
"Model");
108 foreach(var itr
in typeof(T).GetAllMemberVars(x => Attribute.IsDefined(x, typeof(GlueAttribute))))
112 var attributes = field.Member.GetCustomAttributes(typeof(GlueAttribute),
true).OfType<GlueAttribute>();
113 foreach(var attr
in attributes)
115 var obj = BindInternal(attr.Name,
116 () => field.Getter(model),
117 attr.Writeable && field.Setter != null ? x => field.Setter(model, x) : (Action<object>)null,
118 attr.UpdateFrequency);
119 if (model is INotifyPropertyUpdated)
120 obj.NotifyModelEvent += ((INotifyPropertyUpdated)model).PropertyUpdated;
125 if (model is INotifyPropertyChanged)
127 ((INotifyPropertyChanged)model).PropertyChanged += (sender, e) => this.
Touch(e.PropertyName);
131 foreach(var method
in typeof(T).GetAllMethods(x => Attribute.IsDefined(x, typeof(GlueAttribute))))
133 Action methodAction = (Action)Delegate.CreateDelegate(typeof(Action), model, method);
135 var attributes = method.GetCustomAttributes(typeof(GlueAttribute),
true).OfType<GlueAttribute>();
136 foreach(var attr
in attributes)
138 _control.Target.AddCallback(
139 string.Format(
"__glue_{0}", attr.Name),
140 (name, args) => methodAction()
void Touch(string name)
Definition: BuiGlue.cs:146