Beispiel #1
0
      public ValidatableSlider
      (
         string         endingRemarks,
         Color?         maxColor,
         double         maxValue,
         Color?         minColor,
         double         minValue,
         FontAttributes remarksFontAttributes,
         double?        remarksFontSize,
         Color?         remarksTextColor,
         Color?         sliderColor,
         string         startingRemarks,
         double         step,
         Color?         thumbColor,
         bool           asleepInitially = false
      )
      : base(Slider.ValueProperty, asleepInitially: asleepInitially)
      {
         ErrorUtils.IssueArgumentErrorIfTrue(!maxValue.IsGreaterThan(minValue),
            nameof(ValidatableSlider) +
            ": The minimum values must be less than the maximum value");

         // Counter-intuitive
         _maxColor = maxColor ?? Color.Green;

         _endingRemarks         = endingRemarks;
         _maxValue              = maxValue;
         _minValue              = minValue;
         _remarksFontAttributes = remarksFontAttributes;
         _remarksFontSize       = remarksFontSize ?? Device.GetNamedSize(NamedSize.Small, typeof(Label));
         _remarksTextColor      = remarksTextColor ?? Color.DimGray;

         // Counter-intuitive
         _minColor = minColor ?? Color.Red;

         _sliderColor     = sliderColor ?? Color.Gray;
         _startingRemarks = startingRemarks;
         _step            = step;
         _thumbColor      = thumbColor ?? Color.Black;

         if (!IsConstructing)
         {
            RecreateAllViewsBindingsAndStyles();
         }
      }
Beispiel #2
0
        /// <summary>
        /// Adds the range sorted and without notification.
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="comparer">The comparer.</param>
        public void AddRangeSortedAndWithoutNotification(T[] list, IDecideWhichIsLess <T> comparer = null)
        {
            ErrorUtils.IssueArgumentErrorIfTrue
                (list.IsAnEmptyList(),
                nameof(BetterObservableCollection <T>) + ": " +
                nameof(AddRangeSortedAndWithoutNotification) + " requires a valid list");

            RunActionWithoutNotification
            (
                () =>
            {
                foreach (var item in list)
                {
                    AddSorted(item, comparer);
                }
            }
            );
        }