Added a minimal GUI based on Avalonia UI library for C#

This commit is contained in:
2022-05-22 16:27:37 +03:00
parent 9f656d5f3f
commit 96b681bbda
24 changed files with 2099 additions and 21 deletions

View File

@@ -30,7 +30,7 @@ namespace PluginManager.Online
/// <param name="location">The location where to store the downloaded data</param>
/// <param name="progress">The <see cref="IProgress{T}"/> to track the download</param>
/// <returns></returns>
public static async Task DownloadFileAsync(string URL, string location, IProgress<float> progress, IProgress<long> downloadedBytes)
public static async Task DownloadFileAsync(string URL, string location, IProgress<float> progress, IProgress<long>? downloadedBytes = null)
{
using (var client = new System.Net.Http.HttpClient())
{
@@ -54,8 +54,6 @@ namespace PluginManager.Online
bool isDownloading = true;
int c_progress = 0;
//long m_dwBytes = 0;
Others.Console_Utilities.ProgressBar pbar = new Others.Console_Utilities.ProgressBar(100, "");
IProgress<float> progress = new Progress<float>(percent =>
@@ -63,11 +61,6 @@ namespace PluginManager.Online
c_progress = (int)percent;
});
IProgress<long> progress_downloaded = new Progress<long>(downloadedBytes =>
{
//m_dwBytes = downloadedBytes;
});
Task updateProgressBarTask = new Task(() =>
{
while (isDownloading)
@@ -80,11 +73,13 @@ namespace PluginManager.Online
});
new System.Threading.Thread(updateProgressBarTask.Start).Start();
await DownloadFileAsync(URL, location, progress, progress_downloaded);
await DownloadFileAsync(URL, location, progress);
isDownloading = false;
c_progress = 100;
pbar.Update(100);
isDownloading = false;
}
}