Esempio n. 1
0
        public NewQueryDialog(IServiceProvider serviceProvider, bool allowed)
            : base(serviceProvider)
        {
            InitializeComponent();
            Text = allowed ? "Allow Query String" : "Deny Query String";

            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>(btnOK, "Click")
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                Item = new QueryStringsItem(null, allowed)
                {
                    QueryString = txtName.Text
                };
                DialogResult = DialogResult.OK;
            }));
        }
Esempio n. 2
0
 public QueryListViewItem(QueryStringsItem item, RequestFilteringPage page)
     : base(item.QueryString)
 {
     Item  = item;
     _page = page;
     SubItems.Add(new ListViewSubItem(this, item.Allowed ? "Always allow" : "Deny"));
 }