// Filter // public static IObservableFilter <T> Filter <T>(NotifyConfiguratorFactory <TClass, ObservableFilterPropertyHolder <T> > configurator, [CallerMemberName] string name = null) { var c = PropertyCache <TClass> .GetByHolder <ObservableFilterPropertyHolder <T> >(name, n => configurator(new NotifyConfigurator <TClass, ObservableFilterPropertyHolder <T> >().Init((target, filter) => filter.OnTriggered())) .Compile(n)); return(new ObservableFilterPropertyHolder <T>(c)); }
// TRIGGER public static ITrigger Trigger(NotifyConfiguratorFactory <TClass, NotifyTrigger> configurator, [CallerMemberName] string name = null) { var c = PropertyCache <TClass> .GetByHolder <NotifyTrigger>(name, n => configurator(new NotifyConfigurator <TClass, NotifyTrigger>()) .Compile(n) ); return(new NotifyTrigger(c)); }
/*********** * COMMAND * ***********/ public static ICommand Command(NotifyConfiguratorFactory <TClass, CommandPropertyHolder> configurator, [CallerMemberName] string name = null) { #if DEBUG Debug.Assert(typeof(TClass).GetProperty(name) != null, $"{name} is not a property of " + typeof(TClass).Name + " (did you forget {get;} ?)"); #endif var c = PropertyCache <TClass> .GetByHolder <CommandPropertyHolder>(name, n => configurator(new NotifyConfigurator <TClass, CommandPropertyHolder>()) .Compile(n)); return(new CommandPropertyHolder(c)); }
public static PropertyHolder <T> Property <T>(NotifyConfiguratorFactory <TClass, PropertyHolder <T> > configurator, [CallerMemberName] string name = null) { // TODO : benchmark this and see if just storing uncompiled whould perform better : var activator = PropertyCache <TClass> .GetByHolder <PropertyHolder <T> >(name, n => configurator(new NotifyConfigurator <TClass, PropertyHolder <T> >()) .Compile(n) ); return(new PropertyHolder <T>(activator)); }
public static IProperty <T> Property <T>(NotifyConfiguratorFactory <TClass, PropertyHolder <T> > configurator) => null;