Exemple #1
0
        public static IPropertyObserverWithGetterAndFallback <TResult> Observes <TResult>(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            bool autoSubscribe,
            [NotNull] Action action,
            [NotNull] TResult fallback)
        {
            var observer = new PropertyObserverWithGetterAndFallback <TResult>(propertyExpression, action, fallback, PropertyObserverFlag.None);

            if (autoSubscribe)
            {
                observer.Activate(true);
            }

            return(observer);
        }
        /// <summary>
        ///     Observeses the specified parameter1.
        /// </summary>
        /// <typeparam name="TParameter1">The type of the parameter1.</typeparam>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="parameter1">The parameter1.</param>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="autoSubscribe">if set to <c>true</c> [automatic subscribe].</param>
        /// <param name="action">The action.</param>
        /// <param name="fallback">The fallback.</param>
        /// <returns>
        ///     The Property Observer.
        /// </returns>
        public static IPropertyObserverWithGetterAndFallback <TResult> Observes <TParameter1, TResult>(
            [NotNull] this TParameter1 parameter1,
            [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
            bool autoSubscribe,
            [NotNull] Action action,
            [NotNull] TResult fallback)
            where TParameter1 : INotifyPropertyChanged
        {
            var observer = new PropertyObserverWithGetterAndFallback <TParameter1, TResult>(
                parameter1,
                propertyExpression,
                action,
                fallback, PropertyObserverFlag.None);

            if (autoSubscribe)
            {
                observer.Activate(true);
            }

            return(observer);
        }