|
|
@ -24,13 +24,11 @@ namespace Avalonia |
|
|
/// <see cref="IPriorityValueOwner.Changed"/> method on the
|
|
|
/// <see cref="IPriorityValueOwner.Changed"/> method on the
|
|
|
/// owner object is fired with the old and new values.
|
|
|
/// owner object is fired with the old and new values.
|
|
|
/// </remarks>
|
|
|
/// </remarks>
|
|
|
internal class PriorityValue |
|
|
internal sealed class PriorityValue : ISetAndNotifyHandler<(object,int)> |
|
|
{ |
|
|
{ |
|
|
private readonly Type _valueType; |
|
|
private readonly Type _valueType; |
|
|
private readonly SingleOrDictionary<int, PriorityLevel> _levels = new SingleOrDictionary<int, PriorityLevel>(); |
|
|
private readonly SingleOrDictionary<int, PriorityLevel> _levels = new SingleOrDictionary<int, PriorityLevel>(); |
|
|
|
|
|
|
|
|
private readonly Func<object, object> _validate; |
|
|
private readonly Func<object, object> _validate; |
|
|
private readonly SetAndNotifyCallback<(object, int)> _setAndNotifyCallback; |
|
|
|
|
|
private (object value, int priority) _value; |
|
|
private (object value, int priority) _value; |
|
|
private DeferredSetter<object> _setter; |
|
|
private DeferredSetter<object> _setter; |
|
|
|
|
|
|
|
|
@ -52,7 +50,6 @@ namespace Avalonia |
|
|
_valueType = valueType; |
|
|
_valueType = valueType; |
|
|
_value = (AvaloniaProperty.UnsetValue, int.MaxValue); |
|
|
_value = (AvaloniaProperty.UnsetValue, int.MaxValue); |
|
|
_validate = validate; |
|
|
_validate = validate; |
|
|
_setAndNotifyCallback = SetAndNotify; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
@ -257,10 +254,15 @@ namespace Avalonia |
|
|
_setter = Owner.GetNonDirectDeferredSetter(Property); |
|
|
_setter = Owner.GetNonDirectDeferredSetter(Property); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_setter.SetAndNotifyCallback(Property, _setAndNotifyCallback, ref _value, newValue); |
|
|
_setter.SetAndNotifyCallback(Property, this, ref _value, newValue); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ISetAndNotifyHandler<(object, int)>.HandleSetAndNotify(AvaloniaProperty property, ref (object, int) backing, (object, int) value) |
|
|
|
|
|
{ |
|
|
|
|
|
SetAndNotify(ref backing, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void SetAndNotify(AvaloniaProperty property, ref (object value, int priority) backing, (object value, int priority) update) |
|
|
private void SetAndNotify(ref (object value, int priority) backing, (object value, int priority) update) |
|
|
{ |
|
|
{ |
|
|
var val = update.value; |
|
|
var val = update.value; |
|
|
var notification = val as BindingNotification; |
|
|
var notification = val as BindingNotification; |
|
|
|