public static Computed <LoadingResult <TValue, TError> > Computed <TValue, TCommand, TError>(
     this IReactiveElement self,
     TCommand?initialCommand,
     IObservable <TCommand?> reloadCommand,
     Func <TCommand?, Task <TValue> > loadProperty,
     Func <Exception, TError> onError) =>
 self.Reactive(ComputedFactory, initialCommand, reloadCommand, loadProperty, onError);
 public static Computed <T> Computed <T, TEvent>(
     this IReactiveElement self,
     T initialValue,
     IObservable <TEvent> events,
     Func <T, TEvent, T> update,
     IEqualityComparer <T>?comparer = null) =>
 self.Reactive(ComputedFactory, initialValue, events, update, comparer);
 public static Computed <TValue> Computed <TValue, TState>(
     this IReactiveElement self,
     TState initialState,
     IObservable <Func <TState, TState> > updates,
     Func <TState, TValue> select,
     IEqualityComparer <TValue>?comparer = null) =>
 self.Reactive(ComputedFactory, initialState, updates, select, comparer);
 public static TReactive Reactive <TValue, TError, TReactive>(
     this IReactiveElement self,
     Func <IObservable <LoadingResult <TValue, TError> >, TReactive> factory,
     IObservable <Unit> reloadCommand,
     Func <Task <TValue> > loadProperty,
     Func <Exception, TError> onError)
     where TReactive : class, IUpdatableElement, IDisposable =>
 self.Reactive(factory, Unit.Default, reloadCommand, (_) => loadProperty(), onError);
 public static TReactive Reactive <TValue, TState, TReactive>(
     this IReactiveElement self,
     Func <IObservable <TValue>, TReactive> factory,
     IObservable <TState> source,
     Func <TState, TValue> select,
     IEqualityComparer <TValue>?comparer = null)
     where TReactive : class, IUpdatableElement, IDisposable =>
 self.Reactive(factory, source.Select(select), comparer);
 public static TReactive Reactive <TValue, TReactive>(
     this IReactiveElement self,
     Func <IObservable <TValue>, TReactive> factory,
     TValue initialValue,
     IObservable <Func <TValue, TValue> > updates,
     IEqualityComparer <TValue>?comparer = null)
     where TReactive : class, IUpdatableElement, IDisposable =>
 self.Reactive(
     factory,
     updates
     .Scan(initialValue, (acc, update) => update(acc))
     .StartWith(initialValue), comparer);
 public static TReactive Reactive <TValue, TCommand, TError, TReactive>(
     this IReactiveElement self,
     Func <IObservable <LoadingResult <TValue, TError> >, TReactive> factory,
     TCommand?initialCommand,
     IObservable <TCommand?> reloadCommand,
     Func <TCommand?, Task <TValue> > loadProperty,
     Func <Exception, TError> onError)
     where TReactive : class, IUpdatableElement, IDisposable =>
 self.Reactive(
     factory,
     initialCommand,
     reloadCommand,
     c => Observable.FromAsync(() => loadProperty(c)),
     onError);
 public static TReactive Reactive <TValue, TState, TEvent, TReactive>(
     this IReactiveElement self,
     Func <IObservable <TValue>, TReactive> factory,
     TState initialState,
     IObservable <TEvent> events,
     Func <TState, TEvent, TState> update,
     Func <TState, TValue> select,
     IEqualityComparer <TValue>?comparer = null)
     where TReactive : class, IUpdatableElement, IDisposable =>
 self.Reactive(
     factory,
     events
     .Scan(initialState, update)
     .StartWith(initialState)
     .Select(select), comparer);
        public static TReactive Reactive <TValue, TCommand, TError, TReactive>(
            this IReactiveElement self,
            Func <IObservable <LoadingResult <TValue, TError> >, TReactive> factory,
            TCommand?initialCommand,
            IObservable <TCommand?> reloadCommand,
            Func <TCommand?, IObservable <TValue> > loadProperty,
            Func <Exception, TError> onError)
            where TReactive : class, IUpdatableElement, IDisposable
        {
            var updates = CreateUpdates(initialCommand, reloadCommand, loadProperty, onError)
                          .Replay(1);

            self.DeferDispose(updates.Connect());

            return(self.Reactive(
                       factory,
                       LoadingResult.Create <TValue, TError>().StartLoading(),
                       updates));
        }
Ejemplo n.º 10
0
 public static Computed <TValue> Computed <TValue, TState>(
     this IReactiveElement self,
     IObservable <TState> source,
     Func <TState, TValue> select,
     IEqualityComparer <TValue>?comparer = null) =>
 self.Reactive(ComputedFactory, source, select, comparer);