示例#1
0
文件: main.cs 项目: bzhu3216/FTPtool
 /// //////////////////
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void main_Load(object sender, EventArgs e)
 {
     System.DateTime currentTime = DateTime.Now;
     label1.Text     = "";
     button2.Enabled = false;
     button3.Enabled = false;
     if (ConfigurationManager.AppSettings["exam"].ToString().Equals("1"))
     {
         Dnshelp.setDNS("8.6.6.6");
     }
     if (Directory.Exists(@"c:\" + userid + username + "-" + currentTime.ToString("m") + @"上传文件夹"))
     {
         button1.Enabled = false;
         button2.Enabled = true;
         button3.Enabled = true;
     }
 }
示例#2
0
文件: main.cs 项目: bzhu3216/FTPtool
        private void button3_Click(object sender, EventArgs e)
        {
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;

            Dnshelp.setDNS("202.121.241.8");

            string   message = "确定要退出吗?";
            string   caption = "退出";
            abnormal ab      = new abnormal();

            result = MessageBox.Show(message, caption, buttons);
            System.DateTime currentTime = DateTime.Now;
            UploadFileFTP   up          = new UploadFileFTP();

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {      // if (up.CheckDirectoryExist2("ftp://192.168." + ConfigurationManager.AppSettings["ftpip"] + teacher + @"/upload/", userid + username + "-" + currentTime.ToString("m") + @"上传文件夹"))
                    if (ab.CompareDir(@"c:\", "ftp://192.168." + ConfigurationManager.AppSettings["ftpip"] + teacher + @"/upload/", userid + username + "-" + currentTime.ToString("m") + @"上传文件夹"))
                    {
                        label1.Text = "正在退出。。。";

                        Application.Exit();
                    }
                    else
                    {
                        MessageBox.Show("文件有更新请上传文件后退出");
                    }
                }
                catch (Exception ex)
                {
                    // MessageBox.Show(ex.Message+"异常,请联系老师 ");

                    // Application.Exit();
                    MessageBox.Show("文件有更新请上传文件后退出");
                }
            }
        }