Example #1
0
 /// <summary>
 /// Called when a priority level encounters an error.
 /// </summary>
 /// <param name="level">The priority level of the changed entry.</param>
 /// <param name="error">The binding error.</param>
 public void LevelError(PriorityLevel level, BindingError error)
 {
     Logger.Log(
         LogEventLevel.Error,
         LogArea.Binding,
         _owner,
         "Error binding to {Target}.{Property}: {Message}",
         _owner,
         Property,
         error.Exception.Message);
 }
Example #2
0
        /// <summary>
        /// Gets the <see cref="PriorityLevel"/> with the specified priority, creating it if it
        /// doesn't already exist.
        /// </summary>
        /// <param name="priority">The priority.</param>
        /// <returns>The priority level.</returns>
        private PriorityLevel GetLevel(int priority)
        {
            PriorityLevel result;

            if (!_levels.TryGetValue(priority, out result))
            {
                result = new PriorityLevel(this, priority);
                _levels.Add(priority, result);
            }

            return(result);
        }
Example #3
0
        /// <summary>
        /// Gets the <see cref="PriorityLevel"/> with the specified priority, creating it if it
        /// doesn't already exist.
        /// </summary>
        /// <param name="priority">The priority.</param>
        /// <returns>The priority level.</returns>
        private PriorityLevel GetLevel(int priority)
        {
            PriorityLevel result;

            if (!_levels.TryGetValue(priority, out result))
            {
                var mode = (LevelPrecedenceMode)(priority % 2);
                result = new PriorityLevel(priority, mode, ValueChanged);
                _levels.Add(priority, result);
            }

            return(result);
        }
Example #4
0
        /// <summary>
        /// Called when the value for a priority level changes.
        /// </summary>
        /// <param name="level">The priority level of the changed entry.</param>
        private void ValueChanged(PriorityLevel level)
        {
            if (level.Priority <= ValuePriority)
            {
                if (level.Value != PerspexProperty.UnsetValue)
                {
                    UpdateValue(level.Value, level.Priority);
                }
                else
                {
                    foreach (var i in _levels.Values.OrderBy(x => x.Priority))
                    {
                        if (i.Value != PerspexProperty.UnsetValue)
                        {
                            UpdateValue(i.Value, i.Priority);
                            return;
                        }
                    }

                    UpdateValue(PerspexProperty.UnsetValue, int.MaxValue);
                }
            }
        }
Example #5
0
        /// <summary>
        /// Called when the value for a priority level changes.
        /// </summary>
        /// <param name="level">The priority level of the changed entry.</param>
        private void ValueChanged(PriorityLevel level)
        {
            if (level.Priority <= this.ValuePriority)
            {
                if (level.Value != PerspexProperty.UnsetValue)
                {
                    this.UpdateValue(level.Value, level.Priority);
                }
                else
                {
                    foreach (var i in this.levels.Values.OrderBy(x => x.Priority))
                    {
                        if (i.Value != PerspexProperty.UnsetValue)
                        {
                            this.UpdateValue(i.Value, i.Priority);
                            return;
                        }
                    }

                    this.UpdateValue(PerspexProperty.UnsetValue, int.MaxValue);
                }
            }
        }
Example #6
0
        /// <summary>
        /// Gets the <see cref="PriorityLevel"/> with the specified priority, creating it if it
        /// doesn't already exist.
        /// </summary>
        /// <param name="priority">The priority.</param>
        /// <returns>The priority level.</returns>
        private PriorityLevel GetLevel(int priority)
        {
            PriorityLevel result;

            if (!this.levels.TryGetValue(priority, out result))
            {
                var mode = (LevelPrecedenceMode)(priority % 2);
                result = new PriorityLevel(priority, mode, this.ValueChanged);
                this.levels.Add(priority, result);
            }

            return result;
        }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriorityBindingEntry"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="index">
 /// The binding index. Later bindings should have higher indexes.
 /// </param>
 public PriorityBindingEntry(PriorityLevel owner, int index)
 {
     _owner = owner;
     Index  = index;
 }