示例#1
0
        private void _asyncOperation_Completed(object sender, EventArgs e)
        {
            // screen late calls to zombie detector
            if (_asyncOperation == null)
            {
                return;
            }

            if (_autoDetectionOperation.AuthenticationErrorOccurred)
            {
                HandleAuthenticationError();
                //Wizard.back();
            }
            else if (_autoDetectionOperation.FatalErrorOccurred)
            {
                HandleFatalError();
            }
            else if (_autoDetectionOperation.WasCancelled)
            {
                Wizard.back();
            }
            else
            {
                // copy the detected settings
                _autoDetectionOperation.OperationCompleted();

                // exclude steps as appropriate
                WizardStep excludeStep = _autoDetectionOperation.ExcludedStepIfCompleted;
                if (excludeStep != null)
                {
                    if (Wizard.StepExists(excludeStep))
                    {
                        Wizard.removeWizardStep(excludeStep);
                    }
                }

                // go to the next step (might be a substep or might be default)
                Wizard.next();

                // show non fatal errors
                _autoDetectionOperation.ShowNonFatalErrors(AutoDetectionPanel.FindForm());

                // remove us from the wizard
                Wizard.removeWizardStep(this);
            }

            // clear the account detector
            ExitAsyncOperation();
        }
        public override void Display()
        {
            base.Display();

            // create and start the operation
            _asyncOperation = _autoDetectionOperation.CreateOperation(
                _uiContext,
                AutoDetectionPanel.BrowserParentControl,
                _temporarySettings);
            _asyncOperation.Completed += new EventHandler(_asyncOperation_Completed);
            _asyncOperation.Cancelled += new EventHandler(_asyncOperation_Completed);

            // show the progress UI
            Wizard.NextEnabled   = false;
            Wizard.CancelEnabled = false;
            AutoDetectionPanel.Start(_asyncOperation, Wizard);

            // start the operation
            _asyncOperation.Start();
        }