예제 #1
0
        private void InitializeSteps()
        {
            StopAnimations();

            this.Controls.Clear();

            foreach (ProgressStep step in _steps)
            {
                AnimatedPictureBox animatedPictureBox = new AnimatedPictureBox();
                animatedPictureBox.Image = step.Image;
                animatedPictureBox.ExtraImageAlignment   = _extraImageAlignment;
                animatedPictureBox.TextAlign             = _textAlignment;
                animatedPictureBox.AnimationIntervall    = _animationIntervall;
                animatedPictureBox.AnimationStepSize     = _animationStepSize;
                animatedPictureBox.AllowDisabledPainting = false;
                animatedPictureBox.Text = step.Text;

                StepAnimators stepAnimators = new StepAnimators(_animateExtraImage, _animateBackColor, _inProgressState.BackColor, _inProgressState.BackColor2, animatedPictureBox);
                animatedPictureBox.Tag = stepAnimators;

                this.Controls.Add(animatedPictureBox);
            }

            Reset();
            RepositionIcons();
        }
예제 #2
0
        /// <summary>
        /// Transforms the <see cref="CurrentStep"/> to <see cref="FinishedState"/>, sets <see
        /// cref="CurrentStep"/> to the next following step and transforms it into <see
        /// cref="InProgressState"/> also change the extra images to the appropriate values. If <see
        /// cref="BlockNextStepCall"/> is set to true than this call will not return until the
        /// animations are still runnning.
        /// </summary>
        public void NextStep()
        {
            AnimatedPictureBox finishingAnimatedPictureBox  = null;
            AnimatedPictureBox inProgressAnimatedPictureBox = null;

            if (_currentStep >= 0 && _currentStep < _steps.Count)
            {
                finishingAnimatedPictureBox             = GetAnimatedPictureBox(_currentStep);
                finishingAnimatedPictureBox.BorderStyle = ButtonBorderStyle.None;
                StepAnimators stepAnimators = (StepAnimators)finishingAnimatedPictureBox.Tag;
                stepAnimators.Stop();
                if (_showExtraImages)
                {
                    finishingAnimatedPictureBox.ExtraImage = _finishedExtraImage;
                }
                finishingAnimatedPictureBox.Animate(_finishedState);
            }

            _currentStep++;

            if (_currentStep >= 0 && _currentStep < _steps.Count)
            {
                inProgressAnimatedPictureBox             = GetAnimatedPictureBox(_currentStep);
                inProgressAnimatedPictureBox.BorderStyle = ButtonBorderStyle.Dashed;
                inProgressAnimatedPictureBox.Animate(_inProgressState);
                if (_showExtraImages)
                {
                    inProgressAnimatedPictureBox.ExtraImage = _inProgressExtraImage;
                }
                if (_stepNotificationControl != null)
                {
                    _stepNotificationControl.Text = string.Format(CurrentStep.Description, CurrentStep.Name, _currentStep + 1, _steps.Count);
                }
                StepAnimators stepAnimators = (StepAnimators)inProgressAnimatedPictureBox.Tag;
                stepAnimators.Start(_animateExtraImage, _animateBackColor);
            }
            if (inProgressAnimatedPictureBox == null && _stepNotificationControl != null)
            {
                _stepNotificationControl.Text = string.Format(_finishedNotificationText, _steps.Count);
            }

            if (_blockNextStepCall)
            {
                while ((inProgressAnimatedPictureBox != null && inProgressAnimatedPictureBox.IsAnimationRunning) || (finishingAnimatedPictureBox != null && finishingAnimatedPictureBox.IsAnimationRunning))
                {
                    Thread.Sleep(10);
                    Application.DoEvents();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="animateExtraImageRotationAngle">
        /// Indicates whether the the extra image should be rotated.
        /// </param>
        /// <param name="animateColor">Indicates whether the colors should be animated.</param>
        /// <param name="color1">First color of the animation.</param>
        /// <param name="color2">Second color of the animation.</param>
        /// <param name="pictureBox">AnimatedPictureBox.</param>
        internal StepAnimators(bool animateExtraImageRotationAngle, bool animateColor, Color color1, Color color2, AnimatedPictureBox pictureBox)
        {
            _pictureBox = pictureBox;

            _extraImageRotationAngleAnimator = new ExtendedPictureBoxExtraImageRotationAngleAnimator();
            _extraImageRotationAngleAnimator.ExtendedPictureBox = (ExtendedPictureBox)pictureBox;
            _extraImageRotationAngleAnimator.StartRotationAngle = 0f;
            _extraImageRotationAngleAnimator.EndRotationAngle   = 360f;
            _extraImageRotationAngleAnimator.LoopMode           = LoopMode.Repeat;

            _backColorAnimator            = new ControlBackColorAnimator();
            _backColorAnimator.Control    = (Control)pictureBox;
            _backColorAnimator.StartColor = color1;
            _backColorAnimator.EndColor   = color2;
            _backColorAnimator.LoopMode   = LoopMode.Bidirectional;

            _backColor2Animator = new ExtendedPictureBoxBackColor2Animator();
            _backColor2Animator.ExtendedPictureBox = (ExtendedPictureBox)pictureBox;
            _backColor2Animator.StartColor         = color2;
            _backColor2Animator.EndColor           = color1;
            _backColor2Animator.ParentAnimator     = _backColorAnimator;
        }
예제 #4
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="animateExtraImageRotationAngle">
        /// Indicates whether the the extra image should be rotated.
        /// </param>
        /// <param name="animateColor">Indicates whether the colors should be animated.</param>
        /// <param name="color1">First color of the animation.</param>
        /// <param name="color2">Second color of the animation.</param>
        /// <param name="pictureBox">AnimatedPictureBox.</param>
        internal StepAnimators(bool animateExtraImageRotationAngle, bool animateColor, Color color1, Color color2, AnimatedPictureBox pictureBox)
        {
            _pictureBox = pictureBox;

            _extraImageRotationAngleAnimator = new ExtendedPictureBoxExtraImageRotationAngleAnimator();
            _extraImageRotationAngleAnimator.ExtendedPictureBox = (ExtendedPictureBox)pictureBox;
            _extraImageRotationAngleAnimator.StartRotationAngle = 0f;
            _extraImageRotationAngleAnimator.EndRotationAngle = 360f;
            _extraImageRotationAngleAnimator.LoopMode = LoopMode.Repeat;

            _backColorAnimator = new ControlBackColorAnimator();
            _backColorAnimator.Control = (Control)pictureBox;
            _backColorAnimator.StartColor = color1;
            _backColorAnimator.EndColor = color2;
            _backColorAnimator.LoopMode = LoopMode.Bidirectional;

            _backColor2Animator = new ExtendedPictureBoxBackColor2Animator();
            _backColor2Animator.ExtendedPictureBox = (ExtendedPictureBox)pictureBox;
            _backColor2Animator.StartColor = color2;
            _backColor2Animator.EndColor = color1;
            _backColor2Animator.ParentAnimator = _backColorAnimator;
        }
        private void InitializeSteps()
        {
            StopAnimations();

            this.Controls.Clear();

            foreach (ProgressStep step in _steps)
            {
                AnimatedPictureBox animatedPictureBox = new AnimatedPictureBox();
                animatedPictureBox.Image = step.Image;
                animatedPictureBox.ExtraImageAlignment = _extraImageAlignment;
                animatedPictureBox.TextAlign = _textAlignment;
                animatedPictureBox.AnimationIntervall = _animationIntervall;
                animatedPictureBox.AnimationStepSize = _animationStepSize;
                animatedPictureBox.AllowDisabledPainting = false;
                animatedPictureBox.Text = step.Text;

                StepAnimators stepAnimators = new StepAnimators(_animateExtraImage, _animateBackColor, _inProgressState.BackColor, _inProgressState.BackColor2, animatedPictureBox);
                animatedPictureBox.Tag = stepAnimators;

                this.Controls.Add(animatedPictureBox);
            }

            Reset();
            RepositionIcons();
        }