Beispiel #1
0
        /// <summary>
        /// Displays the configuration UI
        /// </summary>
        /// <param name="parameter">The object to be configured as a tool panel item</param>
        public void Execute(object parameter)
        {
            if (configurationUI == null)
            {
                // Get the command to configure
                WizardConfiguration = parameter as ISupportsWizardConfiguration ?? WizardConfiguration;
                if (WizardConfiguration != null)
                {
                    configurationUI = createWizard();
                }
            }

            if (configurationUI.CurrentPage == null && configurationUI.Pages != null &&
                configurationUI.Pages.Count > 0)
            {
                configurationUI.CurrentPage = configurationUI.Pages[0];
            }

            MapApplication.Current.ShowWindow(DialogTitle, configurationUI, IsModal, null, (e, o) =>
            {
                Wizard wiz = e as Wizard;
                if (wiz != null)
                {
                    wiz.CurrentPage = null;
                }

                if (_configurationComplete)
                {
                    // Hide configuration UI and fire the completed event
                    if (WizardConfiguration != null)
                    {
                        WizardConfiguration.OnCompleted();
                    }

                    if (Completed != null)
                    {
                        Completed(this, EventArgs.Empty);
                    }
                }
                else
                {
                    if (WizardConfiguration != null)
                    {
                        WizardConfiguration.OnCancelled();
                    }

                    if (Cancelled != null)
                    {
                        Cancelled(this, EventArgs.Empty);
                    }
                }
                _configurationComplete = false;
            }, WindowType.DesignTimeFloating);
        }
Beispiel #2
0
        private void Wizard_PageChanging(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Wizard wizard = sender as Wizard;

            // If underlying command implements ISupportsWizardConfiguration, fire PageChanging method
            // and cancel wizard page change accordingly
            if (WizardConfiguration != null)
            {
                e.Cancel = !WizardConfiguration.PageChanging();
            }
        }
        private async Task<WizardConfiguration> UpdateWizardConfigurationAsync()
        {
            WizardConfiguration wizardConfiguration;
            var fileName = WizardConfigurator.GetWizardConfigurationFileName(DestinationPath);

            if (!File.Exists(fileName))
            {
                wizardConfiguration = new WizardConfiguration();
                await Task.Delay(100);
            }
            else
            {
                wizardConfiguration = await WizardConfigurator.LoadAsync(fileName);
            }

            return wizardConfiguration;
        }