// 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.Linq;
using System.Reactive.Linq;
using System.Reflection;
namespace Avalonia.Data.Core.Plugins
{
///
/// Handles binding to s for the '^' stream binding operator.
///
public class ObservableStreamPlugin : IStreamPlugin
{
static MethodInfo observableSelect;
///
/// Checks whether this plugin handles the specified value.
///
/// A weak reference to the value.
/// True if the plugin can handle the value; otherwise false.
public virtual bool Match(WeakReference reference)
{
return reference.Target.GetType().GetInterfaces().Any(x =>
x.IsGenericType &&
x.GetGenericTypeDefinition() == typeof(IObservable<>));
}
///
/// Starts producing output based on the specified value.
///
/// A weak reference to the object.
///
/// An observable that produces the output for the value.
///
public virtual IObservable