Exemple #1
0
        /// <inheritdoc/>
        protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options)
        {
            // Calculate the sizes of the track's components.
            var thumbSize          = CalculateThumbSize(finalSize);
            var decreaseButtonSize = CalculateDecreaseButtonSize(finalSize, thumbSize);
            var increaseButtonSize = CalculateIncreaseButtonSize(finalSize, decreaseButtonSize, thumbSize);

            // Arrange the track's components.
            var position    = new Point2D(0, 0);
            var orientation = this.Orientation;

            if (IsDirectionReversed)
            {
                IncreaseButton.Arrange(new RectangleD(position, increaseButtonSize));
                position += (orientation == Orientation.Horizontal) ? new Point2D(increaseButtonSize.Width, 0) : new Point2D(0, increaseButtonSize.Height);

                Thumb.Arrange(new RectangleD(position, thumbSize));
                position += (orientation == Orientation.Horizontal) ? new Point2D(thumbSize.Width, 0) : new Point2D(0, thumbSize.Height);

                DecreaseButton.Arrange(new RectangleD(position, decreaseButtonSize));
            }
            else
            {
                DecreaseButton.Arrange(new RectangleD(position, decreaseButtonSize));
                position += (orientation == Orientation.Horizontal) ? new Point2D(decreaseButtonSize.Width, 0) : new Point2D(0, decreaseButtonSize.Height);

                Thumb.Arrange(new RectangleD(position, thumbSize));
                position += (orientation == Orientation.Horizontal) ? new Point2D(thumbSize.Width, 0) : new Point2D(0, thumbSize.Height);

                IncreaseButton.Arrange(new RectangleD(position, increaseButtonSize));
            }

            return(finalSize);
        }
Exemple #2
0
 /// <summary>
 /// Performs increment.
 /// </summary>
 public void Increment()
 {
     if (AutomationType == AutomationType.UIA2)
     {
         IncreaseButton.Invoke();
         Wait.UntilInputIsProcessed();
     }
     else // UIA3
     {
         SetForeground();
         Wait.UntilInputIsProcessed();
         IncreaseButton.Click();
         Wait.UntilInputIsProcessed();
     }
 }
Exemple #3
0
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            double decreaseButtonLength, thumbLength, increaseButtonLength;
            var    isVertical   = Orientation == Orientation.Vertical;
            var    viewportSize = Math.Max(0.0, ViewportSize);

            // If viewport is NaN, compute thumb's size based on its desired size,
            // otherwise compute the thumb base on the viewport and extent properties
            if (double.IsNaN(ViewportSize))
            {
                ComputeSliderLengths(arrangeSize, isVertical, out decreaseButtonLength, out thumbLength, out increaseButtonLength);
            }
            else
            {
                // Don't arrange if there's not enough content or the track is too small
                if (!ComputeScrollBarLengths(arrangeSize, viewportSize, isVertical, out decreaseButtonLength, out thumbLength, out increaseButtonLength))
                {
                    return(arrangeSize);
                }
            }

            // Layout the pieces of track
            var offset              = new Point();
            var pieceSize           = arrangeSize;
            var isDirectionReversed = IsDirectionReversed;

            if (isVertical)
            {
                CoerceLength(ref decreaseButtonLength, arrangeSize.Height);
                CoerceLength(ref increaseButtonLength, arrangeSize.Height);
                CoerceLength(ref thumbLength, arrangeSize.Height);

                offset    = offset.WithY(isDirectionReversed ? decreaseButtonLength + thumbLength : 0.0);
                pieceSize = pieceSize.WithHeight(increaseButtonLength);

                if (IncreaseButton != null)
                {
                    IncreaseButton.Arrange(new Rect(offset, pieceSize));
                }

                offset    = offset.WithY(isDirectionReversed ? 0.0 : increaseButtonLength + thumbLength);
                pieceSize = pieceSize.WithHeight(decreaseButtonLength);

                if (DecreaseButton != null)
                {
                    DecreaseButton.Arrange(new Rect(offset, pieceSize));
                }

                offset    = offset.WithY(isDirectionReversed ? decreaseButtonLength : increaseButtonLength);
                pieceSize = pieceSize.WithHeight(thumbLength);

                if (Thumb != null)
                {
                    Thumb.Arrange(new Rect(offset, pieceSize));
                }

                ThumbCenterOffset = offset.Y + (thumbLength * 0.5);
            }
            else
            {
                CoerceLength(ref decreaseButtonLength, arrangeSize.Width);
                CoerceLength(ref increaseButtonLength, arrangeSize.Width);
                CoerceLength(ref thumbLength, arrangeSize.Width);

                offset    = offset.WithX(isDirectionReversed ? increaseButtonLength + thumbLength : 0.0);
                pieceSize = pieceSize.WithWidth(decreaseButtonLength);

                if (DecreaseButton != null)
                {
                    DecreaseButton.Arrange(new Rect(offset, pieceSize));
                }

                offset    = offset.WithX(isDirectionReversed ? 0.0 : decreaseButtonLength + thumbLength);
                pieceSize = pieceSize.WithWidth(increaseButtonLength);

                if (IncreaseButton != null)
                {
                    IncreaseButton.Arrange(new Rect(offset, pieceSize));
                }

                offset    = offset.WithX(isDirectionReversed ? increaseButtonLength : decreaseButtonLength);
                pieceSize = pieceSize.WithWidth(thumbLength);

                if (Thumb != null)
                {
                    Thumb.Arrange(new Rect(offset, pieceSize));
                }

                ThumbCenterOffset = offset.X + (thumbLength * 0.5);
            }

            return(arrangeSize);
        }
        void ReleaseDesignerOutlets()
        {
            if (addMoreButton != null)
            {
                addMoreButton.Dispose();
                addMoreButton = null;
            }

            if (AnalysisLabel != null)
            {
                AnalysisLabel.Dispose();
                AnalysisLabel = null;
            }

            if (caloriesLabel != null)
            {
                caloriesLabel.Dispose();
                caloriesLabel = null;
            }

            if (caloriesText != null)
            {
                caloriesText.Dispose();
                caloriesText = null;
            }

            if (carbsLabel != null)
            {
                carbsLabel.Dispose();
                carbsLabel = null;
            }

            if (carbsText != null)
            {
                carbsText.Dispose();
                carbsText = null;
            }

            if (decreaseButton != null)
            {
                decreaseButton.Dispose();
                decreaseButton = null;
            }

            if (fatLabel != null)
            {
                fatLabel.Dispose();
                fatLabel = null;
            }

            if (fatText != null)
            {
                fatText.Dispose();
                fatText = null;
            }

            if (finishButton != null)
            {
                finishButton.Dispose();
                finishButton = null;
            }

            if (IncreaseButton != null)
            {
                IncreaseButton.Dispose();
                IncreaseButton = null;
            }

            if (MealTypeButton != null)
            {
                MealTypeButton.Dispose();
                MealTypeButton = null;
            }

            if (proteinLabel != null)
            {
                proteinLabel.Dispose();
                proteinLabel = null;
            }

            if (proteinText != null)
            {
                proteinText.Dispose();
                proteinText = null;
            }

            if (quantityLabel != null)
            {
                quantityLabel.Dispose();
                quantityLabel = null;
            }

            if (SelectedPictureImageView != null)
            {
                SelectedPictureImageView.Dispose();
                SelectedPictureImageView = null;
            }

            if (servingSizeText != null)
            {
                servingSizeText.Dispose();
                servingSizeText = null;
            }
        }
Exemple #5
0
        void ReleaseDesignerOutlets()
        {
            if (AnalysisLabel != null)
            {
                AnalysisLabel.Dispose();
                AnalysisLabel = null;
            }

            if (caloriesLabel != null)
            {
                caloriesLabel.Dispose();
                caloriesLabel = null;
            }

            if (caloriesText != null)
            {
                caloriesText.Dispose();
                caloriesText = null;
            }

            if (carbsLabel != null)
            {
                carbsLabel.Dispose();
                carbsLabel = null;
            }

            if (carbsText != null)
            {
                carbsText.Dispose();
                carbsText = null;
            }

            if (decreaseButton != null)
            {
                decreaseButton.Dispose();
                decreaseButton = null;
            }

            if (fatLabel != null)
            {
                fatLabel.Dispose();
                fatLabel = null;
            }

            if (fatText != null)
            {
                fatText.Dispose();
                fatText = null;
            }

            if (IncreaseButton != null)
            {
                IncreaseButton.Dispose();
                IncreaseButton = null;
            }

            if (proteinLabel != null)
            {
                proteinLabel.Dispose();
                proteinLabel = null;
            }

            if (proteinText != null)
            {
                proteinText.Dispose();
                proteinText = null;
            }

            if (quantity != null)
            {
                quantity.Dispose();
                quantity = null;
            }

            if (SelectedPictureImageView != null)
            {
                SelectedPictureImageView.Dispose();
                SelectedPictureImageView = null;
            }
        }