bool SetProperty(Experiment ex, PropertyAccess p, object value, bool notifyui = false) { object v = value.Convert(p.Type); p.Setter(ex, v); if (notifyui) { OnNotifyUI?.Invoke(p.Name, v); } return(true); }
static Experiment() { var T = typeof(Experiment); Properties = new Dictionary <string, PropertyAccess>(); foreach (var p in T.GetProperties()) { var n = p.Name; Properties[n] = new PropertyAccess(p.PropertyType, n, T.DelegateForGetPropertyValue(n), T.DelegateForSetPropertyValue(n)); } }
object GetProperty(Experiment ex, PropertyAccess p) { return(p.Getter(ex)); }