This commit is contained in:
Dan Clark
2024-11-23 21:41:59 +00:00
parent e809c22cb7
commit 911ed375b4
17 changed files with 311 additions and 18 deletions
+46
View File
@@ -0,0 +1,46 @@
using Microsoft.UI.Xaml;
using Microsoft.Xaml.Interactions.Core;
using Toolkit.Foundation;
namespace Toolkit.UI.WinUI;
public class ComparisonCondition :
DependencyObject,
ICondition
{
public static readonly DependencyProperty LeftOperandProperty =
DependencyProperty.Register(nameof(LeftOperand),
typeof(object), typeof(ComparisonCondition),
new PropertyMetadata(null));
public static readonly DependencyProperty OperatorProperty =
DependencyProperty.Register(nameof(Operator),
typeof(ComparisonConditionType), typeof(ComparisonCondition),
new PropertyMetadata(null));
public static readonly DependencyProperty RightOperandProperty =
DependencyProperty.Register(nameof(RightOperand),
typeof(object), typeof(ComparisonCondition),
new PropertyMetadata(null));
public object LeftOperand
{
get => GetValue(LeftOperandProperty);
set => SetValue(LeftOperandProperty, value);
}
public object RightOperand
{
get => GetValue(RightOperandProperty);
set => SetValue(RightOperandProperty, value);
}
public ComparisonConditionType Operator
{
get => (ComparisonConditionType)GetValue(OperatorProperty);
set => SetValue(OperatorProperty, value);
}
public bool Evaluate() =>
ComparisonLogic.Evaluate(LeftOperand, Operator, RightOperand);
}