Skip to content

Commit 65fd2c3

Browse files
committed
完成测试工具的AOT改造。
1 parent c7b215a commit 65fd2c3

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

QpTestClient/Controls/AotPropertyGrid.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ private TextBox createPropertyTextBox(string propertyName, string propertyDescri
116116
var control = new TextBox();
117117
control.BorderStyle = BorderStyle.None;
118118
control.Dock = DockStyle.Top;
119+
control.ReadOnly = ReadOnly;
119120
control.Margin = new Padding(0);
120121
control.Size = new Size(698, 38);
121122
control.GotFocus += (_, _) =>
@@ -135,6 +136,7 @@ private CheckBox createPropertyCheckBox(string propertyName, string propertyDesc
135136
control.Padding = new Padding(10, 0, 0, 0);
136137
control.Size = new Size(696, 36);
137138
control.UseVisualStyleBackColor = false;
139+
control.Enabled = !ReadOnly;
138140
return control;
139141
}
140142

@@ -148,6 +150,7 @@ private ComboBox createPropertyComboBox(string propertyName, string propertyDesc
148150
control.FormattingEnabled = true;
149151
control.Location = new Point(0, 0);
150152
control.Size = new Size(696, 39);
153+
control.Enabled = !ReadOnly;
151154
return control;
152155
}
153156

@@ -202,6 +205,26 @@ private void LinkControl(Label label, Control control)
202205
}
203206
}
204207
};
208+
label.DoubleClick += (_, _) =>
209+
{
210+
if (ReadOnly)
211+
return;
212+
if (control is TextBox textBox)
213+
{
214+
textBox.SelectAll();
215+
}
216+
else if(control is CheckBox checkBox)
217+
{
218+
checkBox.Checked = !checkBox.Checked;
219+
}
220+
else if (control is ComboBox cmb)
221+
{
222+
var index = cmb.SelectedIndex+1;
223+
if (index >= cmb.Items.Count)
224+
index = 0;
225+
cmb.SelectedIndex = index;
226+
}
227+
};
205228
control.GotFocus += (_, _) =>
206229
{
207230
ActiveLabel(label);

QpTestClient/Controls/ConnectionInfoControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public ConnectionInfoControl(ConnectionContext item)
2222
var qpClientTypeInfo = QpClientTypeManager.Instance.Get(item.ConnectionInfo.QpClientTypeName);
2323
var ctl = new AotPropertyGrid();
2424
qpClientTypeInfo.EditOptions(ctl, item.ConnectionInfo.QpClientOptions);
25-
ctl.Dock = DockStyle.Fill;
2625
ctl.GenerateControls();
2726
ctl.ReadOnly = true;
27+
ctl.Dock = DockStyle.Fill;
2828
tpBasic.Controls.Add(ctl);
2929
}
3030
private string lastNetstatStr = string.Empty;

QpTestClient/QpClientTypeManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ private void EditCommonClientOptions(AotPropertyGrid propertyGrid, QpClientOptio
2424
{
2525
propertyGrid.RegisterProperty("密码", "", () => options.Password, t => options.Password = t);
2626
propertyGrid.RegisterGroup("高级");
27-
propertyGrid.RegisterProperty("连接超时", "", () => options.ConnectionTimeout, t => options.ConnectionTimeout = t);
28-
propertyGrid.RegisterProperty("传输超时", "", () => options.TransportTimeout, t => options.TransportTimeout = t);
27+
propertyGrid.RegisterProperty("连接超时", "单位:秒", () => options.ConnectionTimeout, t => options.ConnectionTimeout = t);
28+
propertyGrid.RegisterProperty("传输超时", "单位:秒", () => options.TransportTimeout, t => options.TransportTimeout = t);
2929
propertyGrid.RegisterProperty("加密", "", () => options.EnableEncrypt, t => options.EnableEncrypt = t);
3030
propertyGrid.RegisterProperty("压缩", "", () => options.EnableCompress, t => options.EnableCompress = t);
31-
propertyGrid.RegisterProperty("最大包大小", "", () => options.MaxPackageSize, t => options.MaxPackageSize = t);
31+
propertyGrid.RegisterProperty("最大包大小", "单位:字节", () => options.MaxPackageSize, t => options.MaxPackageSize = t);
3232
propertyGrid.RegisterProperty("网络统计", "", () => options.EnableNetstat, t => options.EnableNetstat = t);
3333
propertyGrid.RegisterProperty("通知接收事件", "", () => options.RaiseNoticePackageReceivedEvent, t => options.RaiseNoticePackageReceivedEvent = t);
3434
}

Quick.Protocol.SerialPort/QpSerialPortClientOptions.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.ComponentModel;
43
using System.IO;
54
using System.IO.Ports;
65
using System.Text.Json;
@@ -19,32 +18,22 @@ public class QpSerialPortClientOptions : QpClientOptions
1918
/// <summary>
2019
/// 端口名称
2120
/// </summary>
22-
[DisplayName("端口名称")]
23-
[Category("常用")]
2421
public string PortName { get; set; } = "COM1";
2522
/// <summary>
2623
/// 波特率
2724
/// </summary>
28-
[DisplayName("波特率")]
29-
[Category("常用")]
3025
public int BaudRate { get; set; } = 9600;
3126
/// <summary>
3227
/// 奇偶校验位
3328
/// </summary>
34-
[DisplayName("奇偶校验位")]
35-
[Category("常用")]
3629
public Parity Parity { get; set; } = Parity.None;
3730
/// <summary>
3831
/// 数据位
3932
/// </summary>
40-
[DisplayName("数据位")]
41-
[Category("常用")]
4233
public int DataBits { get; set; } = 8;
4334
/// <summary>
4435
/// 停止位
4536
/// </summary>
46-
[DisplayName("停止位")]
47-
[Category("常用")]
4837
public StopBits StopBits { get; set; } = StopBits.One;
4938

5039
public override void Check()

Quick.Protocol.WebSocket.Client/QpWebSocketClientOptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ public class QpWebSocketClientOptions : QpClientOptions
2121
/// <summary>
2222
/// WebSocket的URL地址
2323
/// </summary>
24-
[DisplayName("WebSocket地址")]
25-
[Category("常用")]
2624
public string Url { get; set; } = "qp.ws://127.0.0.1:3011/qp_test";
2725

2826
public override void Check()

0 commit comments

Comments
 (0)