public void RegisterMethodAutorun(Func <TStore, ValueTask> autorunMethod)
        {
            IPropertyProxy propertyProxy = propertyProxyFactory.Create(RootObservableProperty);
            var            store         = propertyProxyWrapper.WrapPropertyObservable <TStore>(propertyProxy);

            DependencyInjector.InjectDependency(store);

            IInvokableReactable       target  = new MethodAutorunContainer <TStore>(autorunMethod, store);
            ReactableInvoker <TStore> invoker = new ReactableInvoker <TStore>(target, this);

            invoker.PlantSubscriber(propertyProxy);
        }
        private TStore GetStore(IObservableProperty observableProperty)
        {
            if (!storeInstanceCache.TryGetValue(observableProperty, out TStore store))
            {
                IPropertyProxy propertyProxy = propertyProxyFactory.Create(observableProperty);
                store = propertyProxyWrapper.WrapPropertyObservable <TStore>(propertyProxy);
            }

            return(store);
        }
        public PropertyObserver(
            IObservableHolder <T> observableHolder,
            IPropertyProxyFactory propertyProxyFactory,
            IPropertyProxyWrapper propertyProxyWrapper) : base(observableHolder)
        {
            this.observableHolder = observableHolder;

            IPropertyProxy propertyProxy = propertyProxyFactory.Create(observableHolder.RootObservableProperty);

            WrappedInstance = propertyProxyWrapper.WrapPropertyObservable <T>(propertyProxy);

            PlantSubscriber(propertyProxy);
        }
        public StoreAccessor(
            IStoreHolder <TStore> storeHolder,
            IPropertyProxyFactory propertyProxyFactory,
            IPropertyProxyWrapper propertyProxyWrapper) : base(storeHolder)
        {
            this.propertyProxyWrapper = propertyProxyWrapper;

            IPropertyProxy propertyProxy = propertyProxyFactory.Create(storeHolder.RootObservableProperty, storeHolder.StoreReactables);

            Store = propertyProxyWrapper.WrapPropertyObservable <TStore>(propertyProxy);
            storeHolder.DependencyInjector.InjectDependency(Store);

            PlantSubscriber(propertyProxy);
        }
Example #5
0
        private T BoxItem(T item)
        {
            if (!(item != null && proxyWrapper.UnwrapPropertyObservable(item) is IPropertyProxy propertyProxy))
            {
                IObservableProperty observableProperty = observableFactory.CreateObservableProperty(typeof(T));
                if (item != null)
                {
                    observableProperty.OverwriteFrom(item, true);
                }
                propertyProxy = proxyFactory.Create(observableProperty);
            }

            foreach (var subscriber in subscribers)
            {
                propertyProxy.Subscribe(subscriber);
            }

            return(proxyWrapper.WrapPropertyObservable <T>(propertyProxy));
        }