Ejemplo n.º 1
0
        // 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));
        }
Ejemplo n.º 2
0
        // 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));
        }
Ejemplo n.º 3
0
        /***********
        * 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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
 public static IProperty <T> Property <T>(NotifyConfiguratorFactory <TClass, PropertyHolder <T> > configurator) => null;