public void RefreshUI(OneConfigJsonVO vo)
 {
     GrpConfig.Text     = vo.Remark;
     LblServerPath.Text = vo.GetServerUploadFolderPath();
     if (string.IsNullOrEmpty(vo.LocalFolderPath) == false)
     {
         TxtLocalFolderPath.Text = vo.LocalFolderPath;
     }
 }
        private void BtnUpload_Click(object sender, EventArgs e)
        {
            string inputLocalFolderPath = GetLocalFolderPath();

            if (string.IsNullOrEmpty(inputLocalFolderPath))
            {
                MessageBox.Show(this, "未指定本地文件夹路径", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Directory.Exists(inputLocalFolderPath) == false)
            {
                MessageBox.Show(this, "指定的本地文件夹不存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SftpClient client = null;

            try
            {
                client = new SftpClient(_CurrentConfigJsonVO.Host, _CurrentConfigJsonVO.Username, _CurrentConfigJsonVO.Password);
                client.Connect();
            }
            catch
            {
                MessageBox.Show(this, "连接服务器失败,请确认配置是否正确,服务器是否开启等", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (client.Exists(_CurrentConfigJsonVO.ServerFolderPath) == false)
            {
                MessageBox.Show(this, $"服务器中不存在要上传至的根目录{_CurrentConfigJsonVO.ServerFolderPath},请检查路径是否正确以及该根目录是否已经建立", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            BtnUpload.Text    = "上传中";
            BtnUpload.Enabled = false;
            _ParentForm.AppendTextToConsoleForOtherThread($"开始执行上传任务“{_CurrentConfigJsonVO.Remark}”:");
            _ParentForm.AppendTextToConsoleForOtherThread($"服务器路径为:{_CurrentConfigJsonVO.GetServerUploadFolderPath()}");
            _ParentForm.AppendTextToConsoleForOtherThread($"本地路径为:{_CurrentConfigJsonVO.LocalFolderPath}");
            _Upload(client, _CurrentConfigJsonVO.ServerFolderPath, inputLocalFolderPath);
        }