Skip to content

Commit

Permalink
Fix the cache update thrown an exception (Issue: #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-nyan committed Sep 23, 2022
1 parent be42265 commit acd1968
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CollapseLauncher/Classes/CachesManagement/CachesCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ private void CleanUpCaches(DataProperties prop, string cachesLocalPath)
}
}

private void DataFetchingProgress(object sender, DownloadEvent e) => CachesTotalStatus.Text = string.Format(Lang._Misc.Speed, SummarizeSizeSimple(e.Speed));
private void DataFetchingProgress(object sender, DownloadEvent e)
{
DispatcherQueue.TryEnqueue(() => { CachesTotalStatus.Text = string.Format(Lang._Misc.Speed, SummarizeSizeSimple(e.Speed)); });
}
}
}
11 changes: 7 additions & 4 deletions CollapseLauncher/Classes/CachesManagement/CachesUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,13 @@ private void CachesDownloadProgress(object sender, DownloadEvent e)
timeLeftString = string.Format(Lang._Misc.TimeRemainHMSFormat, TimeSpan.FromSeconds((cachesTotalSize - cachesRead) / Unzeroed((long)(cachesRead / SpeedStopwatch.Elapsed.TotalSeconds))));
}

CachesTotalStatus.Text = string.Format(Lang._Misc.Downloading + ": {0}/{1} ", cachesCount, cachesTotalCount)
+ string.Format($"({Lang._Misc.SpeedPerSec})", SummarizeSizeSimple(e.Speed))
+ $" | {timeLeftString}";
CachesTotalProgressBar.Value = GetPercentageNumber(cachesRead, cachesTotalSize);
DispatcherQueue.TryEnqueue(() =>
{
CachesTotalStatus.Text = string.Format(Lang._Misc.Downloading + ": {0}/{1} ", cachesCount, cachesTotalCount)
+ string.Format($"({Lang._Misc.SpeedPerSec})", SummarizeSizeSimple(e.Speed))
+ $" | {timeLeftString}";
CachesTotalProgressBar.Value = GetPercentageNumber(cachesRead, cachesTotalSize);
});
}
}
}
2 changes: 1 addition & 1 deletion Hi3Helper.Core/Classes/Shared/ClassStruct/StructsEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum CachesType

public enum CachesDataStatus
{
Missing = 0,
New = 0,
Obsolete = 1,
Unecessary = 2
}
Expand Down

0 comments on commit acd1968

Please sign in to comment.