// -----------------------------------------------------------------------
//
// Copyright 2015 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Styling
{
using System;
///
/// Holds the result of a match.
///
///
/// There are two types of selectors - ones whose match can never change for a particular
/// control (such as ) and ones whose result can
/// change over time (such as . For the first
/// category of selectors, the value of will be set but for the
/// second, will be null and will
/// hold an observable which tracks the match.
///
public class SelectorMatch
{
public static readonly SelectorMatch False = new SelectorMatch(false);
public static readonly SelectorMatch True = new SelectorMatch(true);
///
/// Initializes a new instance of the class.
///
/// The immediate match value.
public SelectorMatch(bool match)
{
this.ImmediateResult = match;
}
///
/// Initializes a new instance of the class.
///
/// The observable match value.
public SelectorMatch(IObservable match)
{
this.ObservableResult = match;
}
///
/// Gets the immedate result of the selector match, in the case of selectors that cannot
/// change over time.
///
public bool? ImmediateResult { get; }
///
/// Gets an observable which tracks the selector match, in the case of selectors that can
/// change over time.
///
public IObservable ObservableResult { get; }
}
}