/// <summary>
 /// Observeses the can execute.
 /// </summary>
 /// <typeparam name="TParameter1">The type of the parameter1.</typeparam>
 /// <typeparam name="TParameter2">The type of the parameter2.</typeparam>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="parameter2">The parameter2.</param>
 /// <param name="canExecuteExpression">The can execute expression.</param>
 /// <returns>
 /// Result of ObservesCanExecute as CanExecuteObserver&lt;TParameter1, TParameter2&gt;.
 /// </returns>
 public CanExecuteObserver <TParameter1, TParameter2> ObservesCanExecute <TParameter1, TParameter2>(
     TParameter1 parameter1,
     TParameter2 parameter2,
     Expression <Func <TParameter1, TParameter2, bool> > canExecuteExpression)
     where TParameter1 : INotifyPropertyChanged
     where TParameter2 : INotifyPropertyChanged =>
 CanExecuteObserver <TParameter1, TParameter2> .Create(parameter1, parameter2, canExecuteExpression);
Beispiel #2
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);
        }
Beispiel #4
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);
        }
 /// <summary>
 /// Observeses the can execute.
 /// </summary>
 /// <typeparam name="TParameter">The type of the owner.</typeparam>
 /// <param name="parameter">The owner.</param>
 /// <param name="canExecuteExpression">The can execute expression.</param>
 /// <returns>
 /// Result of ObservesCanExecute as CanExecuteObserver&lt;TParameter&gt;.
 /// </returns>
 public CanExecuteObserver <TParameter> ObservesCanExecute <TParameter>(
     TParameter parameter,
     Expression <Func <TParameter, bool> > canExecuteExpression)
     where TParameter : INotifyPropertyChanged =>
 CanExecuteObserver <TParameter> .Create(parameter, canExecuteExpression);
 /// <summary>
 /// Observeses the can execute.
 /// </summary>
 /// <param name="canExecuteExpression">The can execute expression.</param>
 /// <returns>
 /// Result of ObservesCanExecute as CanExecuteObserver.
 /// </returns>
 public CanExecuteObserver ObservesCanExecute(
     Expression <Func <bool> > canExecuteExpression) =>
 CanExecuteObserver.Create(canExecuteExpression);