Ejemplo n.º 1
0
        private void SetActiveControl(Control control)
        {
            try
            {
                foreach (Control item in panelControls.Controls)
                    item.Visible = false;

                control.Visible = true;
                _currentControl = control as IWizardControl;
                nextButton.Enabled = false;
                backButton.Enabled = !IsFirstControl(_currentControl);

                if (IsLastControl(_currentControl))
                {
                    finishButton.Location = nextButton.Location;
                    nextButton.Visible = false;
                    finishButton.Visible = true;
                }
                else
                {
                    nextButton.Visible = true;
                    finishButton.Visible = false;
                }

                _currentControl.Translate();
                _currentControl.Activate();
                labelCaption.Text = _currentControl.Caption;
                labelDescription.Text = _currentControl.Description; 
                if (_currentControl.Image == ImageType.Question)
                    imageBox.Image = imageListIcons.Images[0];
                else
                    imageBox.Image = imageListIcons.Images[1];
                nextButton.Enabled = _currentControl.IsReadyForNextStep;

                if (NetOfficeProject.TargetLanguage == TargetLanguage.German)
                    labelCurrentStep.Text = string.Format("Schritt {0} von {1}", GetControlIndex(_currentControl) + 1, _parent.ListControls.Count);
                else
                    labelCurrentStep.Text = string.Format("Step {0} of {1}", GetControlIndex(_currentControl) + 1, _parent.ListControls.Count);

                labelCurrentStep.Tag = new string[] { (GetControlIndex(_currentControl) + 1).ToString(), _parent.ListControls.Count.ToString()};

            }
            catch (Exception ex)
            {
                MessageBox.Show("SetActiveControl " + ex.Message);
            }
        }