|
|
|
@ -2,6 +2,7 @@ |
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Runtime.ExceptionServices; |
|
|
|
using Avalonia.Data; |
|
|
|
using Avalonia.Threading; |
|
|
|
|
|
|
|
@ -10,9 +11,9 @@ namespace Avalonia |
|
|
|
/// <summary>
|
|
|
|
/// A registered binding in a <see cref="PriorityValue"/>.
|
|
|
|
/// </summary>
|
|
|
|
internal class PriorityBindingEntry : IDisposable |
|
|
|
internal class PriorityBindingEntry : IDisposable, IObserver<object> |
|
|
|
{ |
|
|
|
private PriorityLevel _owner; |
|
|
|
private readonly PriorityLevel _owner; |
|
|
|
private IDisposable _subscription; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -85,7 +86,7 @@ namespace Avalonia |
|
|
|
Description = ((IDescription)binding).Description; |
|
|
|
} |
|
|
|
|
|
|
|
_subscription = binding.Subscribe(ValueChanged, Completed); |
|
|
|
_subscription = binding.Subscribe(this); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -96,7 +97,7 @@ namespace Avalonia |
|
|
|
_subscription?.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
private void ValueChanged(object value) |
|
|
|
void IObserver<object>.OnNext(object value) |
|
|
|
{ |
|
|
|
void Signal() |
|
|
|
{ |
|
|
|
@ -132,7 +133,7 @@ namespace Avalonia |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void Completed() |
|
|
|
void IObserver<object>.OnCompleted() |
|
|
|
{ |
|
|
|
HasCompleted = true; |
|
|
|
|
|
|
|
@ -145,5 +146,10 @@ namespace Avalonia |
|
|
|
Dispatcher.UIThread.Post(() => _owner.Completed(this)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void IObserver<object>.OnError(Exception error) |
|
|
|
{ |
|
|
|
ExceptionDispatchInfo.Capture(error).Throw(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|