Repository navigation
Expand file tree
/
Copy pathAddResponseHead.cs
More file actions
58 lines (54 loc) · 1.74 KB
/
Copy pathAddResponseHead.cs
File metadata and controls
58 lines (54 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FreeCookies
{
public partial class AddResponseHead : Form
{
CookiesControl cookiesControl;
ListView editListView;
bool isAdd;
public AddResponseHead(ListView yourEditListView, CookiesControl yourCookiesControl , bool yourIsAdd)
{
InitializeComponent();
editListView = yourEditListView;
cookiesControl = yourCookiesControl;
isAdd = yourIsAdd;
}
private void AddResponseHead_Load(object sender, EventArgs e)
{
if(!isAdd)
{
string headStr= editListView.SelectedItems[0].Text;
tb_key.Text=headStr.Remove(headStr.IndexOf(": "));
rtb_value.Text = headStr.Substring(headStr.IndexOf(": ") + 2);
}
}
private void bt_ok_Click(object sender, EventArgs e)
{
if(tb_key.Text==""||rtb_value.Text=="")
{
MessageBox.Show("input key and value","Stop" , MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
else
{
if (isAdd)
{
editListView.Items.Add(String.Format("{0}: {1}", tb_key.Text, rtb_value.Text));
}
else
{
editListView.SelectedItems[0].Text = String.Format("{0}: {1}", tb_key.Text, rtb_value.Text);
}
cookiesControl.ReflushAddResponseHeads();
this.Close();
}
}
}
}