-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathConfirmSupervisorDialog.cs
128 lines (116 loc) · 3.14 KB
/
ConfirmSupervisorDialog.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
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace DigitalPlatform.Forms
{
/// <summary>
/// 为了确认超级用户身份而登录的对话框
/// </summary>
public partial class ConfirmSupervisorDialog : Form
{
// const int WM_MOVE_FOCUS = API.WM_USER + 201;
public ConfirmSupervisorDialog()
{
InitializeComponent();
}
private void ConfirmSupervisorDialog_Load(object sender, EventArgs e)
{
// API.PostMessage(this.Handle, WM_MOVE_FOCUS, 0, 0);
this.BeginInvoke(new Action(MoveFocus));
}
#if NO
/// <summary>
/// 缺省窗口过程
/// </summary>
/// <param name="m">消息</param>
protected override void DefWndProc(ref Message m)
{
switch (m.Msg)
{
case WM_MOVE_FOCUS:
// 2008/7/1
if (this.textBox_userName.Text == "")
this.textBox_userName.Focus();
else if (this.textBox_password.Text == "")
this.textBox_password.Focus();
else
this.button_OK.Focus();
return;
}
base.DefWndProc(ref m);
}
#endif
void MoveFocus()
{
if (this.textBox_userName.Text == "")
this.textBox_userName.Focus();
else if (this.textBox_password.Text == "")
this.textBox_password.Focus();
else
this.button_OK.Focus();
}
private void button_OK_Click(object sender, EventArgs e)
{
if (this.textBox_userName.Text == "")
{
MessageBox.Show(this, "尚未指定用户名");
return;
}
this.DialogResult = DialogResult.OK;
this.Close();
}
private void button_cancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
public string UserName
{
get
{
return this.textBox_userName.Text;
}
set
{
this.textBox_userName.Text = value;
}
}
public string Password
{
get
{
return this.textBox_password.Text;
}
set
{
this.textBox_password.Text = value;
}
}
public string ServerUrl
{
get
{
return this.textBox_serverAddr.Text;
}
set
{
this.textBox_serverAddr.Text = value;
}
}
public string Comment
{
get
{
return this.textBox_comment.Text;
}
set
{
this.textBox_comment.Text = value;
}
}
}
}