Esempio n. 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();
        }
Esempio n. 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();
                }
            }
        }
        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();
        }