Compare commits
No commits in common. "821658b06aa802bbfa957c61ec0633e35a3f498e" and "4ed33ee6e75feeaabe87e2993e5914b245704aa0" have entirely different histories.
821658b06a
...
4ed33ee6e7
|
|
@ -371,7 +371,7 @@ namespace HeBianGu.App.Disk
|
||||||
UploadCommand = new AsyncRelayCommand(async () => await UploadFile());
|
UploadCommand = new AsyncRelayCommand(async () => await UploadFile());
|
||||||
UploadCommand1 = new AsyncRelayCommand(async () => await UploadFile1());
|
UploadCommand1 = new AsyncRelayCommand(async () => await UploadFile1());
|
||||||
|
|
||||||
// 初始化Timer
|
// 初始化Timer
|
||||||
_progressTimer = new System.Timers.Timer(1000);
|
_progressTimer = new System.Timers.Timer(1000);
|
||||||
_progressTimer.Elapsed += UpdateProgress;
|
_progressTimer.Elapsed += UpdateProgress;
|
||||||
}
|
}
|
||||||
|
|
@ -444,7 +444,7 @@ namespace HeBianGu.App.Disk
|
||||||
var ut = CreateUploadItem(filePath, System.IO.Path.GetFileName(filePath));
|
var ut = CreateUploadItem(filePath, System.IO.Path.GetFileName(filePath));
|
||||||
_sendViewModel.UpLoadItems.Add(ut);
|
_sendViewModel.UpLoadItems.Add(ut);
|
||||||
}
|
}
|
||||||
MessageBox.Show("传输列表中可查看进度");
|
|
||||||
// 如果没有上传任务在运行,则启动上传
|
// 如果没有上传任务在运行,则启动上传
|
||||||
if (!_isUploading)
|
if (!_isUploading)
|
||||||
{
|
{
|
||||||
|
|
@ -464,7 +464,6 @@ namespace HeBianGu.App.Disk
|
||||||
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
||||||
{
|
{
|
||||||
string folderPath = dialog.FileName;
|
string folderPath = dialog.FileName;
|
||||||
string folderName = new DirectoryInfo(folderPath).Name; // 获取选中的文件夹名称
|
|
||||||
var files = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories)
|
var files = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories)
|
||||||
.Where(filePath => !_sendViewModel.UpLoadItems.Any(item =>
|
.Where(filePath => !_sendViewModel.UpLoadItems.Any(item =>
|
||||||
item.Value5.Equals(filePath, StringComparison.OrdinalIgnoreCase)))
|
item.Value5.Equals(filePath, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
|
@ -478,11 +477,11 @@ namespace HeBianGu.App.Disk
|
||||||
|
|
||||||
foreach (string filePath in files)
|
foreach (string filePath in files)
|
||||||
{
|
{
|
||||||
string relativePath = folderName + "/" + filePath.Substring(folderPath.Length + 1).Replace('\\', '/');
|
string relativePath = filePath.Substring(folderPath.Length + 1).Replace('\\', '/');
|
||||||
var ut = CreateUploadItem(filePath, relativePath);
|
var ut = CreateUploadItem(filePath, relativePath);
|
||||||
_sendViewModel.UpLoadItems.Add(ut);
|
_sendViewModel.UpLoadItems.Add(ut);
|
||||||
}
|
}
|
||||||
MessageBox.Show("传输列表中可查看进度");
|
|
||||||
// 如果没有上传任务在运行,则启动上传
|
// 如果没有上传任务在运行,则启动上传
|
||||||
if (!_isUploading)
|
if (!_isUploading)
|
||||||
{
|
{
|
||||||
|
|
@ -496,8 +495,8 @@ namespace HeBianGu.App.Disk
|
||||||
{
|
{
|
||||||
FileInfo fileInfo = new FileInfo(filePath);
|
FileInfo fileInfo = new FileInfo(filePath);
|
||||||
string sizeText = fileInfo.Length < 1024 * 1024 ?
|
string sizeText = fileInfo.Length < 1024 * 1024 ?
|
||||||
$"{Math.Ceiling((decimal)fileInfo.Length / 1024)}KB" :
|
$"{Math.Round((double)(fileInfo.Length / 1024), 2)}KB" :
|
||||||
$"{Math.Ceiling((decimal)fileInfo.Length / (1024 * 1024))}MB";
|
$"{Math.Round((double)(fileInfo.Length / (1024 * 1024)), 2)}MB";
|
||||||
|
|
||||||
return new UpLoadItems
|
return new UpLoadItems
|
||||||
{
|
{
|
||||||
|
|
@ -584,6 +583,25 @@ namespace HeBianGu.App.Disk
|
||||||
{
|
{
|
||||||
string bucketName = "test";
|
string bucketName = "test";
|
||||||
|
|
||||||
|
//// 检查文件是否已存在
|
||||||
|
//var statArgs = new StatObjectArgs()
|
||||||
|
// .WithBucket(bucketName)
|
||||||
|
// .WithObject(ut.Value6);
|
||||||
|
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
// await client.StatObjectAsync(statArgs);
|
||||||
|
// // 文件已存在,跳过上传
|
||||||
|
// ut.Value3 = "已存在";
|
||||||
|
// ut.Bool1 = true;
|
||||||
|
// ut.Double2 = ut.Double1; // 设置已传输大小为总大小
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//catch (Exception)
|
||||||
|
//{
|
||||||
|
// // 文件不存在,继续上传
|
||||||
|
//}
|
||||||
|
|
||||||
// 确保桶存在
|
// 确保桶存在
|
||||||
var beArgs = new BucketExistsArgs().WithBucket(bucketName);
|
var beArgs = new BucketExistsArgs().WithBucket(bucketName);
|
||||||
bool found = await client.BucketExistsAsync(beArgs).ConfigureAwait(false);
|
bool found = await client.BucketExistsAsync(beArgs).ConfigureAwait(false);
|
||||||
|
|
@ -604,20 +622,11 @@ namespace HeBianGu.App.Disk
|
||||||
int slashIndex = ut.Value1.IndexOf('/');
|
int slashIndex = ut.Value1.IndexOf('/');
|
||||||
string sizePart = ut.Value1.Substring(slashIndex);
|
string sizePart = ut.Value1.Substring(slashIndex);
|
||||||
string transferredPart = trans < 1024 * 1024 ?
|
string transferredPart = trans < 1024 * 1024 ?
|
||||||
$"{Math.Ceiling((decimal)trans / 1024)}KB" :
|
$"{Math.Round((double)(trans / 1024), 0)}KB" :
|
||||||
$"{Math.Ceiling((decimal)trans / (1024 * 1024))}MB";
|
$"{Math.Round((double)(trans / (1024 * 1024)), 2)}MB";
|
||||||
|
|
||||||
ut.Value1 = $"{transferredPart}{sizePart}";
|
ut.Value1 = $"{transferredPart}{sizePart}";
|
||||||
if (progressReport.Percentage == 100)
|
ut.Value3 = "上传中...";
|
||||||
{
|
|
||||||
ut.Value3 = "已完成";
|
|
||||||
//_sendViewModel.UpLoadItems.Remove(ut);
|
|
||||||
//_sendViewModel.CompleteItems.Add(ut);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ut.Value3 = "上传中...";
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -627,7 +636,9 @@ namespace HeBianGu.App.Disk
|
||||||
.WithFileName(ut.Value5)
|
.WithFileName(ut.Value5)
|
||||||
.WithProgress(progress);
|
.WithProgress(progress);
|
||||||
|
|
||||||
await client.PutObjectAsync(putObjectArgs);
|
await client.PutObjectAsync(putObjectArgs);
|
||||||
|
ut.Value3 = "已完成";
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
using HeBianGu.Base.WpfBase;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Hopetry.ViewModel.Send
|
|
||||||
{
|
|
||||||
internal class CompleteItems : TestViewModel
|
|
||||||
{
|
|
||||||
#region - 属性 -
|
|
||||||
private ObservableCollection<TreeNodeBase<TestViewModel>> _items = new ObservableCollection<TreeNodeBase<TestViewModel>>();
|
|
||||||
/// <summary> 说明 </summary>
|
|
||||||
public ObservableCollection<TreeNodeBase<TestViewModel>> Items
|
|
||||||
{
|
|
||||||
get { return _items; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_items = value;
|
|
||||||
RaisePropertyChanged("Items");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region - 命令 -
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -46,18 +46,6 @@ namespace HeBianGu.App.Disk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObservableCollection<UpLoadItems> _completeItems = new ObservableCollection<UpLoadItems>();
|
|
||||||
/// <summary> 说明 </summary>
|
|
||||||
public ObservableCollection<UpLoadItems> CompleteItems
|
|
||||||
{
|
|
||||||
get { return _completeItems; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_completeItems = value;
|
|
||||||
RaisePropertyChanged("CompleteItems");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double _progress;
|
private double _progress;
|
||||||
|
|
||||||
public double Progress
|
public double Progress
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue