committed by
GitHub
21 changed files with 264 additions and 263 deletions
@ -1 +1 @@ |
|||||
Subproject commit b122549406107170bbe6e67c0d6a1a4252beef77 |
Subproject commit 544af79d218127b4174da4be19896c5ca78eaa5d |
||||
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using Avalonia.Data; |
||||
|
|
||||
|
namespace Avalonia.Markup.Data |
||||
|
{ |
||||
|
internal class MarkupBindingChainException : BindingChainException |
||||
|
{ |
||||
|
private IList<string> _nodes = new List<string>(); |
||||
|
|
||||
|
public MarkupBindingChainException(string message) |
||||
|
: base(message) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public MarkupBindingChainException(string message, string node) |
||||
|
: base(message) |
||||
|
{ |
||||
|
AddNode(node); |
||||
|
} |
||||
|
|
||||
|
public MarkupBindingChainException(string message, string expression, string expressionNullPoint) |
||||
|
: base(message, expression, expressionNullPoint) |
||||
|
{ |
||||
|
_nodes = null; |
||||
|
} |
||||
|
|
||||
|
public bool HasNodes => _nodes.Count > 0; |
||||
|
public void AddNode(string node) => _nodes.Add(node); |
||||
|
|
||||
|
public void Commit(string expression) |
||||
|
{ |
||||
|
Expression = expression; |
||||
|
ExpressionErrorPoint = string.Join(".", _nodes.Reverse()) |
||||
|
.Replace(".!", "!") |
||||
|
.Replace(".[", "[") |
||||
|
.Replace(".^", "^"); |
||||
|
_nodes = null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,33 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using Avalonia.Data; |
|
||||
|
|
||||
namespace Avalonia.Markup.Data |
|
||||
{ |
|
||||
internal class MarkupBindingChainNullException : BindingChainNullException |
|
||||
{ |
|
||||
private IList<string> _nodes = new List<string>(); |
|
||||
|
|
||||
public MarkupBindingChainNullException() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public MarkupBindingChainNullException(string expression, string expressionNullPoint) |
|
||||
: base(expression, expressionNullPoint) |
|
||||
{ |
|
||||
_nodes = null; |
|
||||
} |
|
||||
|
|
||||
public bool HasNodes => _nodes.Count > 0; |
|
||||
public void AddNode(string node) => _nodes.Add(node); |
|
||||
|
|
||||
public void Commit(string expression) |
|
||||
{ |
|
||||
Expression = expression; |
|
||||
ExpressionNullPoint = string.Join(".", _nodes.Reverse()) |
|
||||
.Replace(".!", "!") |
|
||||
.Replace(".[", "["); |
|
||||
_nodes = null; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -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.StreamHandlers) |
||||
|
{ |
||||
|
if (plugin.Match(reference)) |
||||
|
{ |
||||
|
return plugin.Start(reference); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// TODO: Improve error.
|
||||
|
return Observable.Return(new BindingNotification( |
||||
|
new MarkupBindingChainException("Stream operator applied to unsupported type", Description), |
||||
|
BindingErrorType.Error)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue