コード例 #1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewHeaders.SelectedItems.Count == 0)
            {
                return;
            }

            var item     = listViewHeaders.SelectedItems[0];
            var header   = item.SubItems[0].Text;
            var oldValue = item.SubItems[1].Text;

            using (var form = new HttpHeaderForm(header, oldValue))
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var newValue = form.HttpHeaderValue;
                if (oldValue != newValue)
                {
                    item.SubItems[1].Text = newValue;
                    OnHttpHeadersChanged();
                }
            }
        }
コード例 #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            var headers = GetHttpHeaders();

            using (var form = new HttpHeaderForm(headers.Keys))
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (headers.ContainsKey(form.HttpHeader))
                {
                    MessageBox.Show("This http header already exists.", RS.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                var item = new ListViewItem(new[] { form.HttpHeader, form.HttpHeaderValue });
                listViewHeaders.Items.Add(item);
                OnHttpHeadersChanged();
            }
        }