public static ReadOnlyReactiveProperty <T> LazyReadOnlyReactiveProperty <T>(
     this IReactiveLazyPropertyHolder target,
     Func <ReadOnlyReactiveProperty <T> > valueProvider,
     [CallerMemberName] string propertyName = null)
 {
     return(target
            .LazyProperty(valueProvider, propertyName)
            .AddTo(target.Disposables));
 }
 public static AsyncReactiveCommand LazyAsyncReactiveCommand(
     this IReactiveLazyPropertyHolder target,
     Func <AsyncReactiveCommand> valueProvider,
     [CallerMemberName] string propertyName = null)
 {
     return(target
            .LazyProperty(valueProvider, propertyName)
            .AddTo(target.Disposables));
 }
        public static ReadOnlyReactiveProperty <TValue> LazyReadOnlyReactivePropertyFrom <TSource, TValue>(
            this IReactiveLazyPropertyHolder target,
            TSource source,
            Expression <Func <TSource, TValue> > propertySelector,
            [CallerMemberName] string propertyName = null)
            where TSource : INotifyPropertyChanged
        {
            ReadOnlyReactiveProperty <TValue> createReactiveProperty()
            {
                return(source.ToReadOnlyReactiveProperty(propertySelector));
            }

            return(target.LazyReadOnlyReactiveProperty(createReactiveProperty, propertyName));
        }
Beispiel #4
0
        public static ReactiveProperty <T> LazyReactiveProperty <T>(
            this IReactiveLazyPropertyHolder target,
            T initialValue,
            ReactivePropertyMode mode = ReactivePropertyMode.Default,
            IEqualityComparer <T> equalityComparer = null,
            [CallerMemberName] string propertyName = null)
        {
            ReactiveProperty <T> createReactiveProperty()
            {
                return(new ReactiveProperty <T>(initialValue, mode, equalityComparer));
            }

            return(target.LazyReactiveProperty(createReactiveProperty, propertyName));
        }
Beispiel #5
0
        //public static ReactiveProperty<T> LazyReactiveProperty<T>(
        //	this IReactiveLazyPropertyHolder target,
        //	Func<T> initialValueProvider,
        //	ReactivePropertyMode mode = ReactivePropertyMode.Default,
        //	IEqualityComparer<T> equalityComparer = null,
        //	[CallerMemberName]string propertyName = null)
        //{
        //	ReactiveProperty<T> createReactiveProperty()
        //	{
        //		return new ReactiveProperty<T>(initialValueProvider.Invoke(), mode, equalityComparer);
        //	}

        //	return target.LazyReactiveProperty(createReactiveProperty, propertyName);
        //}

        public static ReactiveProperty <T> LazyReactiveProperty <T>(
            this IReactiveLazyPropertyHolder target,
            IScheduler raiseEventScheduler,
            Func <T> initialValueProvider,
            ReactivePropertyMode mode = ReactivePropertyMode.Default,
            IEqualityComparer <T> equalityComparer = null,
            [CallerMemberName] string propertyName = null)
        {
            ReactiveProperty <T> createReactiveProperty()
            {
                return(new ReactiveProperty <T>(initialValueProvider.Invoke(), mode, equalityComparer));
            }

            return(target.LazyReactiveProperty(createReactiveProperty, propertyName));
        }
        public static AsyncReactiveCommand <T> LazyAsyncReactiveCommand <T>(
            this IReactiveLazyPropertyHolder target,
            Func <T, Task> executeHandler,
            [CallerMemberName] string propertyName = null)
        {
            AsyncReactiveCommand <T> createAsyncReactiveCommand()
            {
                return(new AsyncReactiveCommand <T>()
                       .WithSubscribe(executeHandler, x => x.AddTo(target.Disposables)));
            }

            return(target.LazyAsyncReactiveCommand(
                       createAsyncReactiveCommand,
                       propertyName));
        }
        public static ReactiveCommand LazyReactiveCommand(
            this IReactiveLazyPropertyHolder target,
            Action executeHandler,
            [CallerMemberName] string propertyName = null)
        {
            ReactiveCommand createReactiveCommand()
            {
                return(new ReactiveCommand()
                       .WithSubscribe(executeHandler, x => x.AddTo(target.Disposables)));
            }

            return(target.LazyReactiveCommand(
                       createReactiveCommand,
                       propertyName));
        }
        public static AsyncReactiveCommand LazyAsyncReactiveCommand(
            this IReactiveLazyPropertyHolder target,
            bool initialValue,
            Func <Task> executeHandler,
            [CallerMemberName] string propertyName = null)
        {
            AsyncReactiveCommand createAsyncReactiveCommand()
            {
                return(new AsyncReactiveCommand(Observable.Empty(initialValue))
                       .WithSubscribe(executeHandler, x => x.AddTo(target.Disposables)));
            }

            return(target.LazyAsyncReactiveCommand(
                       createAsyncReactiveCommand,
                       propertyName));
        }
        public static ReactiveCommand <T> LazyReactiveCommand <T>(
            this IReactiveLazyPropertyHolder target,
            bool initialValue,
            Action <T> executeHandler,
            [CallerMemberName] string propertyName = null)
        {
            ReactiveCommand <T> createReactiveCommand()
            {
                return(new ReactiveCommand <T>(Observable.Empty <bool>(), initialValue)
                       .WithSubscribe(executeHandler, x => x.AddTo(target.Disposables)));
            }

            return(target.LazyReactiveCommand(
                       createReactiveCommand,
                       propertyName));
        }