fix(send): 修复文件上传进度计算错误
- 修正了进度计算公式,将乘以100移到分子位置避免整数除法精度丢失 - 在上传完成事件中添加了进度计算的条件判断防止除零错误 - 增加了控制台输出用于调试当前上传进度 - 统一了进度计算逻辑确保数值准确性dev2.0
parent
71194a02b6
commit
0718a29850
|
|
@ -562,7 +562,7 @@ namespace HeBianGu.App.Disk
|
|||
FileCount = (CompleteItems.Count) + "/" + (UpLoadItems.Count + CompleteItems.Count);
|
||||
// 避免除零错误
|
||||
var progress = UpLoadItems.Count > 0
|
||||
? Math.Round((decimal)(CompleteItems.Count / (UpLoadItems.Count + CompleteItems.Count)) * 100, 2)
|
||||
? Math.Round((decimal)(CompleteItems.Count * 100/ (UpLoadItems.Count + CompleteItems.Count)) , 2)
|
||||
: 0;
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
|
|
@ -831,7 +831,11 @@ namespace HeBianGu.App.Disk
|
|||
|
||||
// 触发上传完成事件
|
||||
FileUploadCompleted?.Invoke(CurrentMinIOPath);
|
||||
Progress = (CompleteItems.Count) / (UpLoadItems.Count + CompleteItems.Count);
|
||||
Progress = UpLoadItems.Count > 0
|
||||
? Math.Round((decimal)(CompleteItems.Count * 100/ (UpLoadItems.Count + CompleteItems.Count)) ,
|
||||
2)
|
||||
: 0;
|
||||
Console.WriteLine($"当前上传进度:{Progress}%");
|
||||
// 更新网盘空间页面状态
|
||||
/*if (_explorerBehavior != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue