From 7de4bf836e7bb75d9c44d27f016a56f3a31ea89f Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 5 May 2015 11:59:32 +0200 Subject: [PATCH] Documented newly added classes. --- Perspex.Base/PriorityBindingEntry.cs | 12 +++++ Perspex.Base/PriorityLevel.cs | 68 ++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/Perspex.Base/PriorityBindingEntry.cs b/Perspex.Base/PriorityBindingEntry.cs index 8b6aca589a..6a62dbed1b 100644 --- a/Perspex.Base/PriorityBindingEntry.cs +++ b/Perspex.Base/PriorityBindingEntry.cs @@ -18,11 +18,20 @@ namespace Perspex /// private IDisposable subscription; + /// + /// Initializes a new instance of the class. + /// + /// + /// The binding index. Later bindings should have higher indexes. + /// public PriorityBindingEntry(int index) { this.Index = index; } + /// + /// Gets the observable associated with the entry. + /// public IObservable Observable { get; private set; } /// @@ -34,6 +43,9 @@ namespace Perspex private set; } + /// + /// Gets the binding entry index. Later bindings will have higher indexes. + /// public int Index { get; diff --git a/Perspex.Base/PriorityLevel.cs b/Perspex.Base/PriorityLevel.cs index f8bdf23b99..e9ce948b38 100644 --- a/Perspex.Base/PriorityLevel.cs +++ b/Perspex.Base/PriorityLevel.cs @@ -10,14 +10,50 @@ namespace Perspex using System.Collections.Generic; using System.Reactive.Disposables; + /// + /// Stores bindings for a priority level in a . + /// + /// + /// + /// Each priority level in a has a current , + /// a list of and a . When there are no + /// bindings present, or all bindings return then + /// Value will equal DirectValue. + /// + /// + /// When there are bindings present, then the latest added binding that doesn't return + /// UnsetValue will take precedence. The active binding is returned by the + /// property (which refers to the active binding's + /// property rather than the index in + /// Bindings). + /// + /// + /// If DirectValue is set while a binding is active, then it will replace the + /// current value until the active binding fires again/ + /// + /// internal class PriorityLevel { + /// + /// Method called when current value changes. + /// private Action changed; + /// + /// The current direct value. + /// private object directValue; + /// + /// The index of the next . + /// private int nextIndex; + /// + /// Initializes a new instance of the class. + /// + /// The priority. + /// A method to be called when the current value changes. public PriorityLevel( int priority, Action changed) @@ -31,8 +67,14 @@ namespace Perspex this.Bindings = new LinkedList(); } + /// + /// Gets the priority of this level. + /// public int Priority { get; } + /// + /// Gets or sets the direct value for this priority level. + /// public object DirectValue { get @@ -47,12 +89,27 @@ namespace Perspex } } + /// + /// Gets the current binding for the priority level. + /// public object Value { get; private set; } + /// + /// Gets the value of the active binding, or -1 + /// if no binding is active. + /// public int ActiveBindingIndex { get; private set; } + /// + /// Gets the bindings for the priority level. + /// public LinkedList Bindings { get; } + /// + /// Adds a binding. + /// + /// The binding to add. + /// A disposable used to remove the binding. public IDisposable Add(IObservable binding) { Contract.Requires(binding != null); @@ -73,6 +130,10 @@ namespace Perspex }); } + /// + /// Invoked when an entry in changes value. + /// + /// The entry that changed. private void Changed(PriorityBindingEntry entry) { if (entry.Index >= this.ActiveBindingIndex) @@ -90,6 +151,10 @@ namespace Perspex } } + /// + /// Invoked when an entry in completes. + /// + /// The entry that completed. private void Completed(PriorityBindingEntry entry) { this.Bindings.Remove(entry); @@ -100,6 +165,9 @@ namespace Perspex } } + /// + /// Activates the first binding that has a value. + /// private void ActivateFirstBinding() { foreach (var binding in this.Bindings)