Example #1
0
        public override void OnLeavePage(object sender, Microsoft.BizTalk.Wizard.PageEventArgs e)
        {
            // if the user pressed the "Next" button
            if (e.Button == Microsoft.BizTalk.Wizard.PageEventButton.Next)
            {
                // the RegistryKey to query / update
                RegistryKey wizardKey = null;

                try
                {
                    // open our private 'configuration' key, enable writing
                    wizardKey = Registry.CurrentUser.OpenSubKey(ourSettingKey, true);

                    // if our key doesn't exist,
                    if (wizardKey == null)
                    {
                        // create it
                        wizardKey = Registry.CurrentUser.CreateSubKey(ourSettingKey);
                    }

                    // set the value the user selected regarding skipping this dialog
                    wizardKey.SetValue(skipWelcome, checkBoxSkipWelcome.Checked);
                }
                finally
                {
                    // make sure the RegistryKey instance is closed
                    if (wizardKey != null)
                    {
                        wizardKey.Close();
                    }
                }
            }

            base.OnLeavePage(sender, e);
        }
Example #2
0
        public override void OnEnterPage(object sender, Microsoft.BizTalk.Wizard.PageEventArgs e)
        {
            // retrieve the WizardForm which hosts our page
            Microsoft.BizTalk.Wizard.WizardForm form1 = base.WizardForm;

            // enable the buttons as we see fit
            form1.ButtonBack.Enabled   = false;
            form1.ButtonBack.Visible   = true;
            form1.ButtonNext.Enabled   = true;
            form1.ButtonNext.Visible   = true;
            form1.ButtonFinish.Enabled = false;
            form1.ButtonFinish.Visible = false;

            // select the Next button
            form1.ButtonNext.Select();

            // and set focus to it
            form1.ButtonNext.Focus();

            RegistryKey wizardKey = null;

            try
            {
                // open our private 'configuration' key, enable writing
                wizardKey = Registry.CurrentUser.OpenSubKey(ourSettingKey);

                if (wizardKey != null)
                {
                    // try and retrieve the setting whether to skip this page
                    string currentWelcomeValue = wizardKey.GetValue(skipWelcome) as string;

                    // if we should skip this page,
                    if (currentWelcomeValue != null && bool.Parse(currentWelcomeValue))
                    {
                        // set the checkbox
                        checkBoxSkipWelcome.Checked = true;

                        // programmatically click the Next button
                        form1.ButtonNext.PerformClick();
                    }
                }
            }
            finally
            {
                // make sure the RegistryKey instance is closed
                if (wizardKey != null)
                {
                    wizardKey.Close();
                }
            }
        }