public static IScriptCommand IfDependencyProperty <T>(string elementVariable = "{Sender}", DependencyProperty property = null, ComparsionOperator op = ComparsionOperator.Equals, T value = default(T), IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { string destinationVariable = ParameterDic.CombineVariable(elementVariable, property.ToString() + "Value"); return(HubScriptCommands.GetDependencyProperty(elementVariable, property, destinationVariable, ScriptCommands.IfValue(op, destinationVariable, value, trueCommand, otherwiseCommand))); }
/// <summary> /// Get the property and compare if it's equal to value before setting. /// </summary> /// <param name="elementVariable"></param> /// <param name="property"></param> /// <param name="value"></param> /// <param name="ifChanged"></param> /// <param name="ifUnchanged"></param> /// <returns></returns> public static IScriptCommand SetDependencyPropertyIfDifferentValue(string elementVariable, DependencyProperty property, object value, IScriptCommand ifChanged, IScriptCommand ifUnchanged = null) { string valueVariable = ParameterDic.CombineVariable(elementVariable, "Value"); return(HubScriptCommands.GetDependencyProperty(elementVariable, property, valueVariable, ScriptCommands.IfEquals(valueVariable, value, ifUnchanged, SetDependencyPropertyValue(elementVariable, property, value, ifChanged)))); }