private void skinButton1_Click(object sender, EventArgs e) { var userName = skinWaterTextBox1.Text; if (string.IsNullOrWhiteSpace(userName)) { MessageBox.Show("名称不能为空!"); return; } var password = skinWaterTextBox2.Text; if (string.IsNullOrWhiteSpace(password)) { MessageBox.Show("password不能为空!"); return; } var dataPort = 39654; var dataPortStr = skinWaterTextBox3.Text; if (string.IsNullOrWhiteSpace(dataPortStr)) { MessageBox.Show("dataPort不能为空!"); return; } if (!int.TryParse(dataPortStr, out dataPort)) { MessageBox.Show("dataPort不是数字!"); return; } if (dataPort < 20 || dataPort > 65536) { MessageBox.Show("dataPort必须在20-63536之间!"); return; } var root = skinWaterTextBox4.Text; if (string.IsNullOrWhiteSpace(root)) { MessageBox.Show("名称不能为空!"); return; } this.FtpServerUser = new FtpServerUser() { UserName = userName, Password = password, DataPort = dataPort, Root = root }; this.DialogResult = DialogResult.OK; this.Close(); }
public CreateUserForm(FtpServerUser ftpServerUser) : this() { skinWaterTextBox1.Text = ftpServerUser.UserName; skinWaterTextBox2.Text = ftpServerUser.Password; skinWaterTextBox3.Text = ftpServerUser.DataPort.ToString(); skinWaterTextBox4.Text = ftpServerUser.Root; }
private void skinButton1_Click(object sender, EventArgs e) { var userName = skinWaterTextBox1.Text; if (string.IsNullOrWhiteSpace(userName)) { MessageBox.Show("名称不能为空!"); return; } var password = skinWaterTextBox2.Text; if (string.IsNullOrWhiteSpace(password)) { MessageBox.Show("password不能为空!"); return; } var root = skinWaterTextBox4.Text; if (string.IsNullOrWhiteSpace(root)) { MessageBox.Show("名称不能为空!"); return; } this.FtpServerUser = new FtpServerUser() { UserName = userName, Password = password, Root = root }; this.DialogResult = DialogResult.OK; this.Close(); }