-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathEditQL.cs
115 lines (97 loc) · 3.02 KB
/
EditQL.cs
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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 JD_Get
{
public partial class EditQL : Form
{
Form1 form { set; get; }
public EditQL(Form1 form)
{
InitializeComponent();
this.form=form;
}
private void button1_Click(object sender, EventArgs e)
{
if (!ConfigHelp.IsValidUri(QL_URL.Text)) {
MessageBox.Show("青龙地址非网址");
return;
}
ConfigHelp.SetSetting("QL_URL", QL_URL.Text);
ConfigHelp.SetSetting("QL_ClientID", QL_ClientID.Text);
ConfigHelp.SetSetting("QL_ClientSecret", QL_ClientSecret.Text);
form.GetQLConfig();
this.Close();
}
private void EditQL_Load(object sender, EventArgs e)
{
var ql= new QLHelp();
this.QL_URL.Text = ql.Url;
this.QL_ClientID.Text = ql.ClientID;
this.QL_ClientSecret.Text = ql.ClientSecret;
}
private void button2_Click(object sender, EventArgs e)
{
var testQL = new QLHelp()
{
ClientID= QL_ClientID.Text,
ClientSecret= QL_ClientSecret.Text,
Url = QL_URL.Text,
};
try
{
string token = testQL.Login();
MessageBox.Show("测试通过");
}
catch(Exception ex)
{
MessageBox.Show("参数存在错误"+ex.Message);
}
}
private void button3_Click(object sender, EventArgs e)
{
var testQL = new QLHelp()
{
ClientID = QL_ClientID.Text,
ClientSecret = QL_ClientSecret.Text,
Url = QL_URL.Text,
};
try
{
testQL.Login();
testQL.AddEnvs("来自工具的测试", "https://github.com/yclown/", "ToolTest");
MessageBox.Show("测试通过");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button4_Click(object sender, EventArgs e)
{
var testQL = new QLHelp()
{
ClientID = QL_ClientID.Text,
ClientSecret = QL_ClientSecret.Text,
Url = QL_URL.Text,
};
try
{
testQL.Login();
string id= testQL.GetEnvs("ToolTest");
testQL.UpdateEnvs(id, "https://github.com/yclown/", "更新成功");
MessageBox.Show("测试通过");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}