Ejemplo n.º 1
0
        protected RectangleF MoveIndicatorElement(
            WaitingBarIndicatorElement element,
            RectangleF clientRect,
            ProgressOrientation waitingDirection)
        {
            float x = clientRect.X;
            float y = clientRect.Y;

            if (waitingDirection == ProgressOrientation.Right && !this.RightToLeft || waitingDirection == ProgressOrientation.Left && this.RightToLeft)
            {
                x += this.offset;
                y += (float)(((double)clientRect.Height - (double)element.DesiredSize.Height) / 2.0);
            }
            if (waitingDirection == ProgressOrientation.Left && !this.RightToLeft || waitingDirection == ProgressOrientation.Right && this.RightToLeft)
            {
                x += clientRect.Width - element.DesiredSize.Width - this.offset;
                y += (float)(((double)clientRect.Height - (double)element.DesiredSize.Height) / 2.0);
            }
            if (waitingDirection == ProgressOrientation.Top)
            {
                y += clientRect.Height - element.DesiredSize.Height - this.offset;
                x += (float)(((double)clientRect.Width - (double)element.DesiredSize.Width) / 2.0);
            }
            if (waitingDirection == ProgressOrientation.Bottom)
            {
                y += this.offset;
                x += (float)(((double)clientRect.Width - (double)element.DesiredSize.Width) / 2.0);
            }
            return(new RectangleF(new PointF(x, y), element.DesiredSize));
        }
Ejemplo n.º 2
0
        private void UpdateElementOrientation(ProgressOrientation oldDirection, ProgressOrientation newDirection)
        {
            bool isVertical = false, wasVertical = false;

            if (oldDirection == ProgressOrientation.Top || oldDirection == ProgressOrientation.Bottom)
            {
                wasVertical = true;
            }
            if (newDirection == ProgressOrientation.Top || newDirection == ProgressOrientation.Bottom)
            {
                isVertical = true;
            }
            if (wasVertical && !isVertical)
            {
                this.WaitingBarOrientation = System.Windows.Forms.Orientation.Horizontal;

                if (GetValueSource(RadWaitingBarElement.WaitingIndicatorSizeProperty) != Telerik.WinControls.ValueSource.Local)
                {
                    SetDefaultValueOverride(RadWaitingBarElement.WaitingIndicatorSizeProperty, new System.Drawing.Size(WaitingIndicatorSize.Height, WaitingIndicatorSize.Width));
                }
            }
            if (!wasVertical && isVertical)
            {
                this.WaitingBarOrientation = System.Windows.Forms.Orientation.Vertical;

                if (GetValueSource(RadWaitingBarElement.WaitingIndicatorSizeProperty) != Telerik.WinControls.ValueSource.Local)
                {
                    SetDefaultValueOverride(RadWaitingBarElement.WaitingIndicatorSizeProperty, new System.Drawing.Size(WaitingIndicatorSize.Height, WaitingIndicatorSize.Width));
                }
            }
        }
Ejemplo n.º 3
0
        protected virtual float GetTransformAngle(ProgressOrientation direction)
        {
            float num = 0.0f;

            if (direction == ProgressOrientation.Top || direction == ProgressOrientation.Bottom)
            {
                num = 270f;
            }
            return(num);
        }
Ejemplo n.º 4
0
        protected virtual float GetTransformAngle(ProgressOrientation direction)
        {
            float angle = 0;

            if (direction == ProgressOrientation.Top || direction == ProgressOrientation.Bottom)
            {
                angle = 270f;
            }

            return(angle);
        }
Ejemplo n.º 5
0
 private void UpdateIndicatorStretch(ProgressOrientation progressOrientation)
 {
     if (progressOrientation == ProgressOrientation.Left || progressOrientation == ProgressOrientation.Right)
     {
         this.StretchIndicatorsHorizontally = false;
         this.StretchIndicatorsVertically   = true;
     }
     else
     {
         this.StretchIndicatorsHorizontally = true;
         this.StretchIndicatorsVertically   = false;
     }
 }
Ejemplo n.º 6
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property == RadWaitingBarElement.WaitingDirectionProperty)
     {
         ProgressOrientation newValue = (ProgressOrientation)e.NewValue;
         this.UpdateElementsState(newValue);
         this.UpdateElementOrientation((ProgressOrientation)e.OldValue, newValue);
         this.UpdateIndicatorStretch(newValue);
         this.TransformElements();
         this.ContentElement.WaitingDirection = newValue;
     }
     if (e.Property == RadWaitingBarElement.WaitingStepProperty)
     {
         int newValue = (int)e.NewValue;
         if (newValue == 0 && this.WaitingSpeed != 0 && this.IsWaiting)
         {
             this.StopWaiting();
             this.continueWaiting = true;
         }
         if (newValue != 0 && this.WaitingSpeed != 0 && this.continueWaiting)
         {
             this.StartWaiting();
             this.continueWaiting = false;
         }
     }
     if (e.Property == RadWaitingBarElement.WaitingSpeedProperty)
     {
         int newValue = (int)e.NewValue;
         if (newValue == 0 && this.WaitingStep != 0 && this.IsWaiting)
         {
             this.StopWaiting();
             this.continueWaiting = true;
         }
         else if (newValue != 0 && this.WaitingStep != 0 && this.IsWaiting)
         {
             this.timer.Interval = 100 - newValue + 1;
         }
         else if (newValue != 0 && this.WaitingStep != 0 && (!this.IsWaiting && this.continueWaiting))
         {
             this.timer.Interval = 100 - newValue + 1;
             this.StartWaiting();
             this.continueWaiting = false;
         }
     }
     if (e.Property != RadElement.EnabledProperty || (bool)e.NewValue || !this.IsWaiting)
     {
         return;
     }
     this.StopWaiting();
 }
Ejemplo n.º 7
0
        public override void UpdateWaitingDirection(ProgressOrientation waitingDirection)
        {
            switch (waitingDirection)
            {
            case ProgressOrientation.Top:
            case ProgressOrientation.Left:
                this.RotationDirection = RotationDirection.CounterClockwise;
                break;

            default:
                this.RotationDirection = RotationDirection.Clockwise;
                break;
            }
            base.UpdateWaitingDirection(waitingDirection);
        }
Ejemplo n.º 8
0
 public ProgressOrientation GetReversedDirection(ProgressOrientation direction)
 {
     if (direction == ProgressOrientation.Bottom)
     {
         return(ProgressOrientation.Top);
     }
     if (direction == ProgressOrientation.Top)
     {
         return(ProgressOrientation.Bottom);
     }
     if (direction == ProgressOrientation.Left)
     {
         return(ProgressOrientation.Right);
     }
     return(ProgressOrientation.Left);
 }
Ejemplo n.º 9
0
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            if (e.Property == ShowProgressIndicatorsProperty)
            {
                UpdateProgressIndicator();
            }
            if (e.Property == DashProperty || e.Property == HatchProperty)
            {
                if (this.Dash || this.Hatch)
                {
                    this.separatorsElement.Visibility = ElementVisibility.Visible;
                }
                else
                {
                    this.separatorsElement.Visibility = ElementVisibility.Collapsed;
                }
            }
            if (e.Property == ValueProperty1 || e.Property == ValueProperty2)
            {
                if (this.indicatorElement1.AutoOpacity)
                {
                    ControlProgressIndicatorsOpacity();
                }
                UpdateProgressIndicator();
            }
            if (e.Property == ProgressOrientationProperty)
            {
                ProgressOrientation progressOrientation = (ProgressOrientation)e.NewValue;

                bool isVertical;

                if (progressOrientation == ProgressOrientation.Top || progressOrientation == ProgressOrientation.Bottom)
                {
                    isVertical = true;
                }
                else
                {
                    isVertical = false;
                }

                this.SetValue(RadProgressBarElement.IsVerticalProperty, isVertical);
                this.indicatorElement1.SetValue(ProgressIndicatorElement.IsVerticalProperty, isVertical);
                this.indicatorElement2.SetValue(ProgressIndicatorElement.IsVerticalProperty, isVertical);
            }

            base.OnPropertyChanged(e);
        }
Ejemplo n.º 10
0
        protected virtual void UpdateElementsState(ProgressOrientation direction)
        {
            bool isVertical = false;

            if (direction == ProgressOrientation.Top || direction == ProgressOrientation.Bottom)
            {
                isVertical = true;
            }

            this.SetValue(RadWaitingBarElement.IsVerticalProperty, isVertical);
            this.SeparatorElement.SetValue(WaitingBarSeparatorElement.IsVerticalProperty, isVertical);
            for (int i = 0; i < this.Indicators.Count; i++)
            {
                this.Indicators[i].SetValue(WaitingBarIndicatorElement.IsVerticalProperty, isVertical);
                this.Indicators[i].SeparatorElement.SetValue(WaitingBarSeparatorElement.IsVerticalProperty, isVertical);
            }
        }
Ejemplo n.º 11
0
        protected RectangleF GetThrobberIndicatorElementFinalSize(
            WaitingBarIndicatorElement element,
            RectangleF clientRect)
        {
            bool flag = this.IsVertical();

            if (!flag && (double)this.offset >= (double)clientRect.Width - (double)element.DesiredSize.Width || flag && (double)this.offset >= (double)clientRect.Height - (double)element.DesiredSize.Height)
            {
                this.offset      = 0.0f;
                this.isBackwards = !this.isBackwards;
            }
            if (!this.isBackwards)
            {
                return(this.MoveIndicatorElement(element, clientRect, this.WaitingDirection));
            }
            ProgressOrientation reversedDirection = this.GetReversedDirection(this.WaitingDirection);

            return(this.MoveIndicatorElement(element, clientRect, reversedDirection));
        }
Ejemplo n.º 12
0
        protected RectangleF GetThrobberIndicatorElementFinalSize(WaitingBarIndicatorElement element, RectangleF clientRect)
        {
            bool isVertical = IsVertical();

            if ((!isVertical && offset >= clientRect.Width - element.DesiredSize.Width) || (isVertical && offset >= clientRect.Height - element.DesiredSize.Height))
            {
                offset      = 0;
                isBackwards = isBackwards ? false : true;
            }

            if (!isBackwards)
            {
                return(MoveIndicatorElement(element, clientRect, this.WaitingDirection));
            }
            else
            {
                ProgressOrientation reverseDirection = GetReversedDirection(this.WaitingDirection);
                return(MoveIndicatorElement(element, clientRect, reverseDirection));
            }
        }
Ejemplo n.º 13
0
        private void UpdateElementOrientation(
            ProgressOrientation oldDirection,
            ProgressOrientation newDirection)
        {
            bool flag1 = false;
            bool flag2 = false;

            if (oldDirection == ProgressOrientation.Top || oldDirection == ProgressOrientation.Bottom)
            {
                flag2 = true;
            }
            if (newDirection == ProgressOrientation.Top || newDirection == ProgressOrientation.Bottom)
            {
                flag1 = true;
            }
            if (flag2 && !flag1)
            {
                this.WaitingBarOrientation = Orientation.Horizontal;
                if (this.GetValueSource(RadWaitingBarElement.WaitingIndicatorSizeProperty) == ValueSource.Local)
                {
                    return;
                }
                int num = (int)this.SetDefaultValueOverride(RadWaitingBarElement.WaitingIndicatorSizeProperty, (object)new Size(this.WaitingIndicatorSize.Height, this.WaitingIndicatorSize.Width));
            }
            else
            {
                if (flag2 || !flag1)
                {
                    return;
                }
                this.WaitingBarOrientation = Orientation.Vertical;
                if (this.GetValueSource(RadWaitingBarElement.WaitingIndicatorSizeProperty) == ValueSource.Local)
                {
                    return;
                }
                int num = (int)this.SetDefaultValueOverride(RadWaitingBarElement.WaitingIndicatorSizeProperty, (object)new Size(this.WaitingIndicatorSize.Height, this.WaitingIndicatorSize.Width));
            }
        }
Ejemplo n.º 14
0
        protected virtual void UpdateElementsState(ProgressOrientation direction)
        {
            bool flag = false;

            if (direction == ProgressOrientation.Top || direction == ProgressOrientation.Bottom)
            {
                flag = true;
            }
            int num1 = (int)this.SetValue(RadWaitingBarElement.IsVerticalProperty, (object)flag);

            if (!this.ContentElement.IsOldWaitingStyle)
            {
                return;
            }
            int num2 = (int)this.SeparatorElement.SetValue(WaitingBarSeparatorElement.IsVerticalProperty, (object)flag);

            for (int index = 0; index < this.WaitingIndicators.Count; ++index)
            {
                WaitingBarIndicatorElement waitingIndicator = this.WaitingIndicators[index] as WaitingBarIndicatorElement;
                int num3 = (int)waitingIndicator.SetValue(WaitingBarIndicatorElement.IsVerticalProperty, (object)flag);
                int num4 = (int)waitingIndicator.SeparatorElement.SetValue(WaitingBarSeparatorElement.IsVerticalProperty, (object)flag);
            }
        }
Ejemplo n.º 15
0
        public ProgressOrientation GetReversedDirection(ProgressOrientation direction)
        {
            ProgressOrientation progressOrientation;

            switch (direction)
            {
            case ProgressOrientation.Top:
                progressOrientation = ProgressOrientation.Bottom;
                break;

            case ProgressOrientation.Bottom:
                progressOrientation = ProgressOrientation.Top;
                break;

            case ProgressOrientation.Left:
                progressOrientation = ProgressOrientation.Right;
                break;

            default:
                progressOrientation = ProgressOrientation.Left;
                break;
            }
            return(progressOrientation);
        }
Ejemplo n.º 16
0
 public virtual void UpdateWaitingDirection(ProgressOrientation waitingDirection)
 {
     this.ResetAnimation();
 }
Ejemplo n.º 17
0
 public override void UpdateWaitingDirection(ProgressOrientation waitingDirection)
 {
     this.WaitingDirection = waitingDirection;
     base.UpdateWaitingDirection(waitingDirection);
 }
Ejemplo n.º 18
0
 public WaitingBarContentElement()
 {
     this.offset           = 0.0f;
     this.waitingDirection = ProgressOrientation.Right;
     this.WaitingIndicators.CollectionChanged += new NotifyCollectionChangedEventHandler(this.WaitingIndicators_CollectionChanged);
 }
Ejemplo n.º 19
0
        protected RectangleF MoveIndicatorElement(WaitingBarIndicatorElement element, RectangleF clientRect, ProgressOrientation waitingDirection)
        {
            float dx = clientRect.X;
            float dy = clientRect.Y;

            if ((waitingDirection == ProgressOrientation.Right && !this.RightToLeft) || (waitingDirection == ProgressOrientation.Left && this.RightToLeft))
            {
                dx += offset;
                dy += (clientRect.Height - element.DesiredSize.Height) / 2;
            }

            if ((waitingDirection == ProgressOrientation.Left && !this.RightToLeft) || (waitingDirection == ProgressOrientation.Right && this.RightToLeft))
            {
                dx += clientRect.Width - element.DesiredSize.Width - offset;
                dy += (clientRect.Height - element.DesiredSize.Height) / 2;
            }

            if (waitingDirection == ProgressOrientation.Top)
            {
                dy += clientRect.Height - element.DesiredSize.Height - offset;
                dx += (clientRect.Width - element.DesiredSize.Width) / 2;
            }

            if (waitingDirection == ProgressOrientation.Bottom)
            {
                dy += offset;
                dx += (clientRect.Width - element.DesiredSize.Width) / 2;
            }

            return(new RectangleF(new PointF(dx, dy), element.DesiredSize));
        }