Example #1
0
        /// <summary>
        /// Invoked when an entry in <see cref="Bindings"/> completes.
        /// </summary>
        /// <param name="entry">The entry that completed.</param>
        private void Completed(PriorityBindingEntry entry)
        {
            Bindings.Remove(entry);

            if (entry.Index >= ActiveBindingIndex)
            {
                ActivateFirstBinding();
            }
        }
Example #2
0
 /// <summary>
 /// Invoked when an entry in <see cref="Bindings"/> changes value.
 /// </summary>
 /// <param name="entry">The entry that changed.</param>
 public void Changed(PriorityBindingEntry entry)
 {
     if (entry.Index >= ActiveBindingIndex)
     {
         if (entry.Value != PerspexProperty.UnsetValue)
         {
             Value = entry.Value;
             ActiveBindingIndex = entry.Index;
             _owner.LevelValueChanged(this);
         }
         else
         {
             ActivateFirstBinding();
         }
     }
 }
Example #3
0
 /// <summary>
 /// Invoked when an entry in <see cref="Bindings"/> changes value.
 /// </summary>
 /// <param name="entry">The entry that changed.</param>
 private void Changed(PriorityBindingEntry entry)
 {
     if (_mode == LevelPrecedenceMode.Latest || entry.Index >= ActiveBindingIndex)
     {
         if (entry.Value != PerspexProperty.UnsetValue)
         {
             Value = entry.Value;
             ActiveBindingIndex = entry.Index;
             _changed(this);
         }
         else
         {
             ActivateFirstBinding();
         }
     }
 }
Example #4
0
        /// <summary>
        /// Adds a binding.
        /// </summary>
        /// <param name="binding">The binding to add.</param>
        /// <returns>A disposable used to remove the binding.</returns>
        public IDisposable Add(IObservable <object> binding)
        {
            Contract.Requires <ArgumentNullException>(binding != null);

            var entry = new PriorityBindingEntry(_nextIndex++);
            var node  = Bindings.AddFirst(entry);

            entry.Start(binding, Changed, Completed);

            return(Disposable.Create(() =>
            {
                Bindings.Remove(node);

                if (entry.Index >= ActiveBindingIndex)
                {
                    ActivateFirstBinding();
                }
            }));
        }
Example #5
0
        /// <summary>
        /// Invoked when an entry in <see cref="Bindings"/> completes.
        /// </summary>
        /// <param name="entry">The entry that completed.</param>
        private void Completed(PriorityBindingEntry entry)
        {
            Bindings.Remove(entry);

            if (entry.Index >= ActiveBindingIndex)
            {
                ActivateFirstBinding();
            }
        }
Example #6
0
 /// <summary>
 /// Invoked when an entry in <see cref="Bindings"/> changes value.
 /// </summary>
 /// <param name="entry">The entry that changed.</param>
 private void Changed(PriorityBindingEntry entry)
 {
     if (_mode == LevelPrecedenceMode.Latest || entry.Index >= ActiveBindingIndex)
     {
         if (entry.Value != PerspexProperty.UnsetValue)
         {
             Value = entry.Value;
             ActiveBindingIndex = entry.Index;
             _changed(this);
         }
         else
         {
             ActivateFirstBinding();
         }
     }
 }
Example #7
0
        /// <summary>
        /// Adds a binding.
        /// </summary>
        /// <param name="binding">The binding to add.</param>
        /// <returns>A disposable used to remove the binding.</returns>
        public IDisposable Add(IObservable<object> binding)
        {
            Contract.Requires<ArgumentNullException>(binding != null);

            var entry = new PriorityBindingEntry(_nextIndex++);
            var node = Bindings.AddFirst(entry);

            entry.Start(binding, Changed, Completed);

            return Disposable.Create(() =>
            {
                Bindings.Remove(node);

                if (entry.Index >= ActiveBindingIndex)
                {
                    ActivateFirstBinding();
                }
            });
        }
Example #8
0
 /// <summary>
 /// Invoked when an entry in <see cref="Bindings"/> encounters a recoverable error.
 /// </summary>
 /// <param name="entry">The entry that completed.</param>
 /// <param name="error">The error.</param>
 public void Error(PriorityBindingEntry entry, BindingError error)
 {
     _owner.LevelError(this, error);
 }