Пример #1
0
        /// <summary>
        /// Creates the specified can execute expression.
        /// </summary>
        /// <param name="canExecuteExpression">The can execute expression.</param>
        /// <param name="fallback">if set to <c>true</c> [fallback].</param>
        /// <returns></returns>
        public static CanExecuteObserver Create([NotNull] Expression <Func <bool> > canExecuteExpression, bool fallback)
        {
            var instance = new CanExecuteObserver(canExecuteExpression, fallback);

            instance.Subscribe();
            return(instance);
        }
        /// <summary>
        ///     Creates the specified can execute expression.
        /// </summary>
        /// <param name="canExecuteExpression">The can execute expression.</param>
        /// <returns>Can Execute Observer.</returns>
        public static CanExecuteObserver Create([NotNull] Expression <Func <bool> > canExecuteExpression)
        {
            var instance = new CanExecuteObserver(canExecuteExpression);

            instance.Subscribe();
            instance.Update += () => { Debug.WriteLine("Update"); };
            return(instance);
        }
Пример #3
0
        /// <summary>
        ///     Creates the specified owner.
        /// </summary>
        /// <param name="parameter">The owner.</param>
        /// <param name="canExecuteExpression">The can execute expression.</param>
        /// <returns>The observer.</returns>
        public static CanExecuteObserver <TParameter1> Create(
            TParameter1 parameter,
            Expression <Func <TParameter1, bool> > canExecuteExpression)
        {
            var instance = new CanExecuteObserver <TParameter1>(parameter, canExecuteExpression);

            instance.Subscribe();
            return(instance);
        }