Progress bars.

This commit is contained in:
Paul Chote
2011-01-20 13:01:07 +13:00
parent 421058866d
commit 775ccc112b
4 changed files with 49 additions and 2 deletions

View File

@@ -81,8 +81,13 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
var status = window.GetWidget<LabelWidget>("STATUS");
status.GetText = () => "Initializing...";
var progress = window.GetWidget<ProgressBarWidget>("PROGRESS");
var dl = DownloadUrl(Info.PackageURL, Info.PackagePath,
(_,i) => status.GetText = () => "{0}% {1}/{2} bytes".F(i.ProgressPercentage, i.BytesReceived, i.TotalBytesToReceive),
(_,i) => {
status.GetText = () => "Downloading {1}/{2} kB ({0}%)".F(i.ProgressPercentage, i.BytesReceived/1024, i.TotalBytesToReceive/1024);
progress.Percentage = i.ProgressPercentage;
},
(_,i) => status.GetText = () => "Download Complete");
window.GetWidget("CANCEL").OnMouseUp = mi => { CancelDownload(dl); ShowInstallMethodDialog(); return true; };