Exemplo n.º 1
0
 public HeaderListViewItem(HeadersItem item, RequestFilteringPage page)
     : base(item.Header)
 {
     Item  = item;
     _page = page;
     SubItems.Add(new ListViewSubItem(this, item.SizeLimit.ToString()));
 }
Exemplo n.º 2
0
        public NewHeaderDialog(IServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            InitializeComponent();

            var container = new CompositeDisposable();

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

            container.Add(
                Observable.FromEventPattern <EventArgs>(txtName, "TextChanged")
                .Merge(Observable.FromEventPattern <EventArgs>(txtLimit, "TextChanged"))
                .Sample(TimeSpan.FromSeconds(1))
                .Subscribe(evt =>
            {
                btnOK.Enabled = !string.IsNullOrWhiteSpace(txtName.Text) &&
                                !string.IsNullOrWhiteSpace(txtLimit.Text);
            }));

            container.Add(
                Observable.FromEventPattern <EventArgs>(btnOK, "Click")
                .Subscribe(evt =>
            {
                Item = new HeadersItem(null)
                {
                    Header = txtName.Text, SizeLimit = uint.Parse(txtLimit.Text)
                };
                DialogResult = DialogResult.OK;
            }));
        }