public void Add()
        {
            var dialog = new NativeModulesDialog(this.Module, this);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));

            foreach (var item in dialog.Items)
            {
                this.Items.Add(item);
                this.SelectedItem = item;
                // server level modules are in "" location.
                ConfigurationSection           section    = service.Scope == ManagementScope.Server ? service.GetSection("system.webServer/modules", string.Empty) : service.GetSection("system.webServer/modules");
                ConfigurationElementCollection collection = section.GetCollection();
                item.AppendTo(collection);
            }

            // TODO: how to add item?
            service.ServerManager.CommitChanges();
            this.OnSettingsSaved();
        }
Пример #2
0
        public void Add()
        {
            var dialog = new NativeModulesDialog(Module, this);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var service = (IConfigurationService)GetService(typeof(IConfigurationService));

            foreach (var item in dialog.Items)
            {
                Items.Add(item);
                SelectedItem = item;
                // server level modules are in "" location.
                ConfigurationElementCollection collection = GetCollection(service);
                item.AppendTo(collection);
            }

            // TODO: how to add item?
            service.ServerManager.CommitChanges();
            OnSettingsSaved();
        }