Esempio n. 1
0
        public void ExpressionExtensions_GetNameTest()
        {
            TestClass c = new TestClass();

            Assert.AreEqual("TestProperty", ExpressionMethods.GetName((() => c.TestProperty)),
                            "GetName returned the incorrect name of the property in the selector method");
        }
Esempio n. 2
0
 /// <summary>
 /// Gets the command associated with the given property and delegates.
 /// <b>For use outside of property setters and getters</b>
 /// </summary>
 /// <param name="execute">Action to be performed by the command. Recieves the command parameter as an argument</param>
 /// <param name="canExecute">Func that is used to determine if the command can be executed</param>
 /// <param name="selector">The expression that selects the appropriate property</param>
 /// <returns>The command composed of the supplied delegates</returns>
 protected ICommand GetCommand <T>(Action <object> execute, Func <bool> canExecute, Expression <Func <T> > selector)
 {
     return(this.GetCommand(execute, (x => canExecute()), ExpressionMethods.GetName(selector)));
 }
Esempio n. 3
0
 /// <summary>
 /// Gets the command associated with the given property and delegates.
 /// <b>For use outside of property setters and getters</b>
 /// </summary>
 /// <param name="execute">Action to be performed by the command. Recieves the command parameter as an argument</param>
 /// <param name="canExecute">Predicate that is used to determine if the command can be executed</param>
 /// <param name="selector">The expression that selects the appropriate property</param>
 /// <returns>The command composed of the supplied delegates</returns>
 protected ICommand GetCommand <T>(Action <object> execute, Predicate <object> canExecute, Expression <Func <T> > selector)
 {
     return(this.GetCommand(execute, canExecute, ExpressionMethods.GetName(selector)));
 }
Esempio n. 4
0
 /// <summary>
 /// Gets the command associated with the given property and delegate.
 /// <b>For use outside of property setters and getters</b>
 /// </summary>
 /// <param name="execute">Action to be performed by the command</param>
 /// <param name="selector">The expression that selects the appropriate property</param>
 /// <returns>The command composed of the supplied delegate</returns>
 protected ICommand GetCommand <T>(Action execute, Expression <Func <T> > selector)
 {
     return(this.GetCommand((x => execute()), (x => true), ExpressionMethods.GetName(selector)));
 }