Browse Source
Which is now required when wanting to get the value produced by a Task/IObservable rather than the Task/IObservable itself. Fixes #711.pull/764/head
6 changed files with 84 additions and 52 deletions
@ -0,0 +1,31 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using System.Globalization; |
|||
using Avalonia.Data; |
|||
using System.Reactive.Linq; |
|||
|
|||
namespace Avalonia.Markup.Data |
|||
{ |
|||
internal class StreamNode : ExpressionNode |
|||
{ |
|||
public override string Description => "^"; |
|||
|
|||
protected override IObservable<object> StartListeningCore(WeakReference reference) |
|||
{ |
|||
foreach (var plugin in ExpressionObserver.ValueHandlers) |
|||
{ |
|||
if (plugin.Match(reference)) |
|||
{ |
|||
return plugin.Start(reference); |
|||
} |
|||
} |
|||
|
|||
// TODO: Improve error.
|
|||
return Observable.Return(new BindingNotification( |
|||
new InvalidCastException("Value could not be streamed."), |
|||
BindingErrorType.Error)); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue