forked from Trevor3000/RemoteControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrmSendMessage.cs
More file actions
69 lines (63 loc) · 2.24 KB
/
Copy pathFrmSendMessage.cs
File metadata and controls
69 lines (63 loc) · 2.24 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
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using RemoteControl.Protocals;
namespace RemoteControl.Server
{
public partial class FrmSendMessage : FrmOkCancelBase
{
public RequestMessageBox Request;
public FrmSendMessage()
{
InitializeComponent();
}
private void FrmSendMessage_Load(object sender, EventArgs e)
{
UIUtil.BindTextBoxCtrlA(this.textBox1);
UIUtil.BindTextBoxCtrlA(this.textBox2);
// 初始化按钮类型
string[] buttonTypeNames = Enum.GetNames(typeof(MessageBoxButtons));
foreach (var item in buttonTypeNames)
{
RadioButton rb = new RadioButton();
rb.Text = item;
this.flowLayoutPanel1.Controls.Add(rb);
}
(this.flowLayoutPanel1.Controls[0] as RadioButton).Checked = true;
// 初始化图标类型
string[] iconTypeNames = Enum.GetNames(typeof(MessageBoxIcon));
foreach (var item in iconTypeNames)
{
this.comboBox2.Items.Add(item);
}
this.comboBox2.Text = MessageBoxIcon.Information.ToString();
}
private void buttonOk_Click(object sender, EventArgs e)
{
this.Request = new RequestMessageBox();
this.Request.Title = this.textBox1.Text;
this.Request.Content = this.textBox2.Text;
string buttonTypeStr = string.Empty;
foreach (var item in this.flowLayoutPanel1.Controls)
{
RadioButton rb = item as RadioButton;
if (rb.Checked)
{
buttonTypeStr = rb.Text;
}
}
this.Request.MessageBoxButtons = (int)Enum.Parse(typeof(MessageBoxButtons), buttonTypeStr);
this.Request.MessageBoxIcons = (int)Enum.Parse(typeof(MessageBoxIcon), this.comboBox2.Text);
this.Close();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Request = null;
this.Close();
}
}
}