示例#1
0
        private void CollectionCheckEquality(object?sender, EventArgs args)
        {
            ConditionEqualityChangedEventArgs collectionArgs = new ConditionEqualityChangedEventArgs
            {
                NewValue = this.Cast <Condition>().All(c => c.Compare()),
            };

            if (collectionArgs.NewValue)
            {
                CollectionIsSatisfied?.Invoke(this, collectionArgs);
            }
        }
        private void OnSatisfied(object?sender, ConditionEqualityChangedEventArgs args)
        {
            if (AssociatedObject == null)
            {
                return;
            }

            DataBindingHelper.RefreshDataBindingsOnActions(Actions);

            // NOTE: In UWP version binding null check is not present but Avalonia throws exception as Bindings are null when first initialized.
            var binding = (sender as ConditionCollection).All(c => (c as Condition).Binding != null);

            if (binding)
            {
                // Some value has changed--either the binding value, reference value, or the comparison condition. Re-evaluate the equation.
                if (args.NewValue)
                {
                    Interaction.ExecuteActions(AssociatedObject, Actions, args);
                }
            }
        }