Пример #1
0
        public bool Display(Window parent)
        {
            IProviderSettings settings = new ProviderSettings();

            // Construct the wizard
            Wizard wizard = new Wizard
                                {
                                    Owner = parent,
                                    ShowNavigationTree = false,
                                    SavedData = settings,
                                    Title = "Add New Log Provider"
                                };

            wizard.AddPage(new SelectProviderPage());

            var dialogResult = wizard.ShowDialog();
            if (dialogResult == true)
            {
                if (wizard.SavedData == null && !(wizard.SavedData is IProviderSettings))
                {
                    throw new NotImplementedException(
                        "The UserData was either null or the supplied object was not of the expected type: IProviderSettings");
                }

                Settings = (IProviderSettings)wizard.SavedData;
                Provider = Settings.Info;
            }

            return dialogResult ?? false;
        }
        public object Save(object saveData)
        {
            if (!(saveData is ProviderSettings))
            {
                saveData = new ProviderSettings();
            }

            ((ProviderSettings)saveData).Info = providers[SelectedProvider];
            ((ProviderSettings)saveData).Name = name;

            return saveData;
        }