private void btnOpenText_Click(object sender, EventArgs e) { try { DataGridViewSelectedRowCollection selectedRows = this.gvData.SelectedRows; if (selectedRows.Count == 0) { MessageBox.Show("请选择!"); return; } else if (selectedRows.Count > 1) { MessageBox.Show("只能选择一行!"); return; } String type = Util.Util.ConvertObjToString(selectedRows[0].Cells[objTypeStr].Value); if (type.Equals(this.directoryType)) { MessageBox.Show("选择的是文件夹!"); return; } String bosUri = Util.Util.ConvertObjToString(selectedRows[0].Cells[this.keyStr].Value); String selectedBucketName = lbSelectedBucket.Text.Replace("选中的Bucket:", ""); ReadForm readForm = new ReadForm(); readForm.Key = bosUri; readForm.SelectedBucket = selectedBucketName; readForm.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnUpload_Click(object sender, EventArgs e) { String filePath = label1.Text; ReadForm readForm = new ReadForm(); BosUtil bosUtil = new BosUtil(); //Boolean isOk = bosUtil.uploadFile(filePath, _BucketName, _SelectedPath); Boolean isOk = bosUtil.uploadFile(filePath, _BucketName, _SelectedPath, toolStripProgressBar1); if (isOk) { MessageBox.Show("OK!"); } }