日期:2014-05-17 浏览次数:21125 次
//声明全局变量
private string ftpUristring = null;
private NetworkCredential networkCredential;
private string currentDir = "/";
//设置按钮事件
private void setBtn_Click(object sender, EventArgs e)
{
try
{
if (FTPIpTxt.Text == string.Empty || FTPUsernameTxt.Text == string.Empty)
{
MessageBox.Show("FTP服务器IP或者用户名不能为空", "提示");
return;
}
ftpUristring = "ftp://" + FTPIpTxt.Text;
networkCredential = new NetworkCredential(FTPUsernameTxt.Text, FTPPasswordTxt.Text);
if (ShowFtpFileAndDirectory() == true)
{
listReports.Enabled = true;
listStatus.Enabled = true;
loginStatusLabel.Visible = true;
loginStatusLabel.Text = "登录成功";
}
else
{
listStatus.Enabled = true;
loginStatusLabel.Visible = true;
loginStatusLabel.Text = "登录失败";
&