private void btnSure_Click(object sender, RoutedEventArgs e) { FileInfoEntity info = new FileInfoEntity(); string path = tbLocalPath.Text; info.FilePath = path.Substring(0, path.LastIndexOf("\\")); info.FileName = path.Substring(info.FilePath.Length + 1, path.Length - info.FilePath.Length - 1); info.NewFilePath = ""; info.NewFileName = tbRomteFile.Text; info.FileType = FileType.File; if (FtpHelper.CheckExistOfRemoteFile("ftp://" + FtpHelper.IP + "/" + (string.IsNullOrEmpty(info.NewFilePath) ? "" : info.NewFilePath + "/") + info.NewFileName)) { System.Windows.MessageBox.Show("目标文件已存在"); } else { this.Close(); FtpHelper.TaskInit(info); FtpTaskUserControl taskControl = new FtpTaskUserControl(info); taskControl.btnRun.Content = info.ResultCode == ResultCode.New ? "Wait" : "Run"; taskControl.mainWindow = mainWindow; mainWindow.lv.Items.Add(taskControl); mainWindow.TaskSum++; mainWindow.ReflashUI(); } }
private void btnSure_Click(object sender, RoutedEventArgs e) { FileInfoEntity info = new FileInfoEntity(); string path = tbLocalPath.Text; info.FilePath = path.Substring(0, path.LastIndexOf("\\")); info.FileName = path.Substring(info.FilePath.Length + 1, path.Length - info.FilePath.Length - 1); info.NewFilePath = ""; info.NewFileName = tbRomteFile.Text; info.FileType = FileType.File; if (FtpHelper.CheckExistOfRemoteFile("ftp://" + FtpHelper.IP + "/" + (string.IsNullOrEmpty(info.NewFilePath) ? "" : info.NewFilePath + "/") + info.NewFileName)) { System.Windows.MessageBox.Show("目标文件已存在"); } else { this.Close(); if (MainWindow.uploadForm == null || MainWindow.uploadForm.IsDisposed) { MainWindow.uploadForm = new FtpUploadListForm(); MainWindow.uploadForm.Done += (s, ex) => { }; MainWindow.uploadForm.Init(); } FtpHelper.TaskInit(info); MainWindow.uploadForm.Add(info); MainWindow.uploadForm.WindowState = System.Windows.Forms.FormWindowState.Normal; MainWindow.uploadForm.Show(); } }