Пример #1
0
 public CustomTagsListViewItem(CustomTagsItem item, CustomTagsPage page)
     : base(item.Name)
 {
     this.Item = item;
     _page     = page;
     this.SubItems.Add(new ListViewSubItem(this, item.TagString));
     this.SubItems.Add(new ListViewSubItem(this, item.Flag));
 }
Пример #2
0
        public AddCustomTagsDialog(IServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            InitializeComponent();

            var container = new CompositeDisposable();

            FormClosed += (sender, args) => container.Dispose();

            container.Add(
                Observable.FromEventPattern <EventArgs>(txtName, "TextChanged")
                .Sample(TimeSpan.FromSeconds(1))
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                btnOK.Enabled = !string.IsNullOrWhiteSpace(txtName.Text);
            }));

            container.Add(
                Observable.FromEventPattern <EventArgs>(btnRemove, "Click")
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                foreach (DataGridViewRow row in dgvTags.SelectedRows)
                {
                    if (!row.IsNewRow)
                    {
                        dgvTags.Rows.Remove(row);
                    }
                }
            }));

            container.Add(
                Observable.FromEventPattern <EventArgs>(btnOK, "Click")
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                Item      = new CustomTagsItem(null);
                Item.Name = txtName.Text;
                foreach (DataGridViewRow row in dgvTags.Rows)
                {
                    var tag       = new CustomTagItem(null);
                    tag.Name      = row.Cells[0].Value.ToString();
                    tag.Attribute = row.Cells[1].Value.ToString();
                    Item.Add(tag);
                }

                DialogResult = DialogResult.OK;
            }));

            container.Add(
                Observable.FromEventPattern <DataGridViewCellEventArgs>(dgvTags, "RowEnter")
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                btnRemove.Enabled = !dgvTags.SelectedRows[0].IsNewRow;
            }));
        }
Пример #3
0
        public void Load()
        {
            Items = new List <CustomTagsItem>();
            var service = (IConfigurationService)GetService(typeof(IConfigurationService));
            var section = service.GetSection("system.webServer/rewrite/outboundRules");
            ConfigurationElementCollection rulesCollection = section.GetCollection("customTags");

            foreach (ConfigurationElement ruleElement in rulesCollection)
            {
                var node = new CustomTagsItem(ruleElement);
                Items.Add(node);
            }

            CanRevert = section.CanRevert();
            OnRewriteSettingsSaved();
        }
        public void Load()
        {
            var service       = (IConfigurationService)this.GetService(typeof(IConfigurationService));
            var outSection    = service.GetSection("system.webServer/rewrite/outboundRules");
            var preConditions = outSection.ChildElements["preConditions"];

            this.PreConditions = new List <PreConditionItem>();
            this.Tags          = new List <CustomTagsItem>();
            foreach (ConfigurationElement condition in preConditions.GetCollection())
            {
                var item = new PreConditionItem(condition);
                this.PreConditions.Add(item);
            }

            var tags = outSection.ChildElements["customTags"];

            foreach (ConfigurationElement condition in tags.GetCollection())
            {
                var item = new CustomTagsItem(condition);
                this.Tags.Add(item);
            }

            this.LoadItems();
        }