상속: System.Windows.Forms.UserControl
예제 #1
0
        /// <summary>
        /// Occurs after the wizard switches the page.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="CristiPotlog.Controls.Wizard.AfterSwitchPagesEventArgs"/> instance containing the event data.</param>
        private void _wizard_AfterSwitchPages(object sender, Wizard.AfterSwitchPagesEventArgs e)
        {
            WizardPage newpage = _wizard.Pages[e.NewIndex];

            if(newpage == _pageSourcePath) {
                _wizard.NextEnabled = !string.IsNullOrEmpty(_localpath.Text);
            }
            else if(newpage == _pageDestination) {
                _wizard.NextEnabled = !string.IsNullOrEmpty(_pageDestination.Text) && _plugin.SelectedItem != null;
            }
            else if (newpage == _pageFileTypes) {
                _project.ActiveDeployConfig.Destinations[0].Name = _destinationName.Text;

                // Setup filters to point to our single destination
                DeployDestination dest = _project.ActiveDeployConfig.Destinations[0];
                foreach (FilterSettings fs in _project.ActiveDeployConfig.FilterSettings) {
                    foreach (Filter f in fs.IncludeFiles) {
                        f.DeployDestinationIdentifier = dest.Identifier;
                    }
                }

                _filtersView.RefreshUI();
            }
        }
예제 #2
0
        /// <summary>
        /// Occurs before the wizard switches pages.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="CristiPotlog.Controls.Wizard.BeforeSwitchPagesEventArgs"/> instance containing the event data.</param>
        private void _wizard_BeforeSwitchPages(object sender, Wizard.BeforeSwitchPagesEventArgs e)
        {
            WizardPage oldpage = _wizard.Pages[e.OldIndex];
            WizardPage newpage = _wizard.Pages[e.NewIndex];

            if(newpage == _pageDestination) {
                if(!Directory.Exists(_localpath.Text)) {
                    MessageBox.Show(this, string.Format("Directory '{0}' does not exist.", _localpath.Text), "Directory not found",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    _localpath.Focus();
                    e.Cancel = true;
                }
            }
            else if(newpage == _pageFileTypes) {
                if(_destinationName.Text.Length == 0) {
                    MessageBox.Show(this, "Please enter a name for the destination.", "No destination name",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    _destinationName.Focus();
                    e.Cancel = true;
                }
            }
        }
 /// <summary>
 /// Creates a new instance of the <see cref="WizardPagesCollection"/> class.
 /// </summary>
 /// <param name="owner">A Wizard object that owns the collection.</param>
 internal WizardPagesCollection(Wizard owner)
 {
     this.owner = owner;
 }
        private void pluginInstallWizzard_BeforeSwitchPages(object sender, Wizard.BeforeSwitchPagesEventArgs e)
        {
            // get wizard page already displayed
            WizardPage oldPage = this.pluginInstallWizzard.Pages[e.OldIndex];

            // check if we're going forward from options page
            if (oldPage == this.installedStudioVersionsPage && e.NewIndex > e.OldIndex)
            {
               var selectedStudioVersionsGeneric = chkStudioVersions.CheckedObjects;
                if (selectedStudioVersionsGeneric.Count == 0)
                {
                    MessageBox.Show(this,
                        Resources
                            .InstallerForm_pluginInstallWizzard_BeforeSwitchPages_Please_select_at_least_one_Studio_version_,
                        Resources.InstallerForm_pluginInstallWizzard_BeforeSwitchPages_Please_select_Studio_version, MessageBoxButtons.OK);
                    e.Cancel = true;
                    return;
                }

                _installService.StudioVersions = selectedStudioVersionsGeneric.OfType<StudioVersion>().ToList();
                if (!_installService.IsPluginInstalled()) return;
                var dialogResult = MessageBox.Show(this,
                    string.Format("Plugin {0} is already installed. Are you sure you want to continue?",
                        _pluginPackageInfo.PluginName),
                    Resources.InstallerForm_pluginInstallWizzard_BeforeSwitchPages_Please_select_Studio_version,
                    MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }

                var processes = _installService.GetStudioProcesses();
                if (processes.Count > 0)
                {
                    using (var processesForm = new Processes(processes))
                    {
                        processesForm.ShowDialog();
                    }
                    e.Cancel = true;
                    return;
                }
                _installService.RemoveInstalledPlugin();
            }
        }
        private void pluginInstallWizzard_AfterSwitchPages(object sender, Wizard.AfterSwitchPagesEventArgs e)
        {
            // get wizard page to be displayed
            WizardPage newPage = this.pluginInstallWizzard.Pages[e.NewIndex];

            // check if license page
            if (newPage == this.licensePage)
            {
                // sync next button's state with check box
                this.pluginInstallWizzard.NextEnabled = this.checkIAgree.Checked;
            }
            if (newPage == this.taskRunnerPage)
            {
                this.StartTask();
            }
        }
예제 #6
0
        /// <summary>
        /// Provides custom drawing to the wizard page.
        /// </summary>
        protected override void OnPaint(PaintEventArgs e)
        {
            // raise paint event
            base.OnPaint(e);

            // check if custom style
            if (this.style == WizardPageStyle.Custom)
            {
                // filter out
                return;
            }

            // init graphic resources
            Rectangle headerRect      = this.ClientRectangle;
            Rectangle glyphRect       = Rectangle.Empty;
            Rectangle titleRect       = Rectangle.Empty;
            Rectangle descriptionRect = Rectangle.Empty;

            // determine text format
            StringFormat textFormat = StringFormat.GenericDefault;

            textFormat.LineAlignment = StringAlignment.Near;
            textFormat.Alignment     = StringAlignment.Near;
            textFormat.Trimming      = StringTrimming.EllipsisCharacter;

            switch (this.style)
            {
            case WizardPageStyle.Standard:
                // adjust height for header
                headerRect.Height = HEADER_AREA_HEIGHT;
                // draw header border
                ControlPaint.DrawBorder3D(e.Graphics, headerRect, Border3DStyle.Etched, Border3DSide.Bottom);
                // adjust header rect not to overwrite the border
                headerRect.Height -= SystemInformation.Border3DSize.Height;
                // fill header with window color
                e.Graphics.FillRectangle(SystemBrushes.Window, headerRect);

                // determine header image regtangle
                int headerPadding = (int)Math.Floor((double)((HEADER_AREA_HEIGHT - HEADER_GLYPH_SIZE) / 2));
                glyphRect.Location = new Point(this.Width - HEADER_GLYPH_SIZE - headerPadding, headerPadding);
                glyphRect.Size     = new Size(HEADER_GLYPH_SIZE, HEADER_GLYPH_SIZE);

                // determine the header content
                Image headerImage     = null;
                Font  headerFont      = this.Font;
                Font  headerTitleFont = this.Font;
                if (this.Parent != null && this.Parent is Wizard)
                {
                    // get content from parent wizard, if exists
                    Wizard parentWizard = (Wizard)this.Parent;
                    headerImage     = parentWizard.HeaderImage;
                    headerFont      = parentWizard.HeaderFont;
                    headerTitleFont = parentWizard.HeaderTitleFont;
                }

                // check if we have an image
                if (headerImage == null)
                {
                    // display a focus rect as a place holder
                    ControlPaint.DrawFocusRectangle(e.Graphics, glyphRect);
                }
                else
                {
                    // draw header image
                    e.Graphics.DrawImage(headerImage, glyphRect);
                }

                // determine title height
                int headerTitleHeight = (int)Math.Ceiling(e.Graphics.MeasureString(this.title, headerTitleFont, 0, textFormat).Height);

                // calculate text sizes
                titleRect.Location = new Point(HEADER_TEXT_PADDING,
                                               HEADER_TEXT_PADDING);
                titleRect.Size = new Size(glyphRect.Left - HEADER_TEXT_PADDING,
                                          headerTitleHeight);
                descriptionRect.Location = titleRect.Location;
                descriptionRect.Y       += headerTitleHeight + HEADER_TEXT_PADDING / 2;
                descriptionRect.Size     = new Size(titleRect.Width,
                                                    HEADER_AREA_HEIGHT - descriptionRect.Y);

                // draw tilte text (single line, truncated with ellipsis)
                e.Graphics.DrawString(this.title,
                                      headerTitleFont,
                                      SystemBrushes.WindowText,
                                      titleRect,
                                      textFormat);
                // draw description text (multiple lines if needed)
                e.Graphics.DrawString(this.description,
                                      headerFont,
                                      SystemBrushes.WindowText,
                                      descriptionRect,
                                      textFormat);
                break;

            case WizardPageStyle.Welcome:
            case WizardPageStyle.Finish:
                // fill whole page with window color
                e.Graphics.FillRectangle(SystemBrushes.Window, headerRect);

                // determine welcome image regtangle
                glyphRect.Location = Point.Empty;
                glyphRect.Size     = new Size(WELCOME_GLYPH_WIDTH, this.Height);

                // determine the icon that should appear on the welcome page
                Image welcomeImage     = null;
                Font  welcomeFont      = this.Font;
                Font  welcomeTitleFont = this.Font;
                if (this.Parent != null && this.Parent is Wizard)
                {
                    // get content from parent wizard, if exists
                    Wizard parentWizard = (Wizard)this.Parent;
                    welcomeImage     = parentWizard.WelcomeImage;
                    welcomeFont      = parentWizard.WelcomeFont;
                    welcomeTitleFont = parentWizard.WelcomeTitleFont;
                }

                // check if we have an image
                if (welcomeImage == null)
                {
                    // display a focus rect as a place holder
                    ControlPaint.DrawFocusRectangle(e.Graphics, glyphRect);
                }
                else
                {
                    // draw welcome page image
                    e.Graphics.DrawImage(welcomeImage, glyphRect);
                }

                // calculate text sizes
                titleRect.Location = new Point(WELCOME_GLYPH_WIDTH + HEADER_TEXT_PADDING,
                                               HEADER_TEXT_PADDING);
                titleRect.Width = this.Width - titleRect.Left - HEADER_TEXT_PADDING;
                // determine title height
                int welcomeTitleHeight = (int)Math.Ceiling(e.Graphics.MeasureString(this.title, welcomeTitleFont, titleRect.Width, textFormat).Height);
                descriptionRect.Location = titleRect.Location;
                descriptionRect.Y       += welcomeTitleHeight + HEADER_TEXT_PADDING;
                descriptionRect.Size     = new Size(this.Width - descriptionRect.Left - HEADER_TEXT_PADDING,
                                                    this.Height - descriptionRect.Y);

                // draw tilte text (multiple lines if needed)
                e.Graphics.DrawString(this.title,
                                      welcomeTitleFont,
                                      SystemBrushes.WindowText,
                                      titleRect,
                                      textFormat);
                // draw description text (multiple lines if needed)
                e.Graphics.DrawString(this.description,
                                      welcomeFont,
                                      SystemBrushes.WindowText,
                                      descriptionRect,
                                      textFormat);
                break;
            }
        }
 /// <summary>
 /// Creates a new instance of the <see cref="WizardPagesCollection"/> class.
 /// </summary>
 /// <param name="owner">A Wizard object that owns the collection.</param>
 internal WizardPagesCollection(Wizard owner)
 {
     this.owner = owner;
 }