Fixed the progress bar from instantly closing

This commit is contained in:
ZestyTS 2022-08-10 08:34:01 -07:00
parent b5c85b227d
commit 6ab47c1882
2 changed files with 10 additions and 14 deletions

View file

@ -1139,7 +1139,6 @@ namespace UWUVCI_AIO_WPF
Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter();
Progress += Convert.ToInt32(stuff);
}
Progress = 100;
});
DownloadWait dw = new DownloadWait("Downloading needed Data - Please Wait", "", this);
@ -1181,7 +1180,6 @@ namespace UWUVCI_AIO_WPF
Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter();
Progress += Convert.ToInt32(stuff);
}
Progress = 100;
});
DownloadWait dw = new DownloadWait("Downloading needed Data - Please Wait", "", this);
@ -1732,10 +1730,9 @@ namespace UWUVCI_AIO_WPF
}
private void ThreadDownload(List<MissingTool> missingTools)
{
var percentage = 100 / missingTools.Count;
var thread = new Thread(() =>
{
double l = 100 / missingTools.Count;
foreach (MissingTool m in missingTools)
{
if (m.Name == "blank.ini")
@ -1745,10 +1742,8 @@ namespace UWUVCI_AIO_WPF
}
else
Task.Run(() => DownloadToolAsync(m.Name, this)).GetAwaiter();
Progress += Convert.ToInt32(l);
Progress += percentage;
}
Progress = 100;
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
@ -1773,7 +1768,6 @@ namespace UWUVCI_AIO_WPF
{
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
{
Task.Run(() => ThreadDownload(missingTools)).GetAwaiter();
DownloadWait dw = new DownloadWait("Downloading Tools - Please Wait", "", this);
try
{
@ -1783,9 +1777,8 @@ namespace UWUVCI_AIO_WPF
{
}
ThreadDownload(missingTools);
dw.ShowDialog();
Thread.Sleep(200);
//Download Tools
Progress = 0;
toolCheckAsync();
}
@ -2143,7 +2136,7 @@ namespace UWUVCI_AIO_WPF
public bool checkKey(string key)
{
var hashCode = GetDeterministicHashCode(key.ToLower());
if (GbTemp.KeyHash == hashCode)
if (GbTemp.KeyHash != hashCode)
{
UpdateKeyInFile(key, $@"bin\keys\{GetConsoleOfBase(gbTemp).ToString().ToLower()}.vck", GbTemp, GetConsoleOfBase(gbTemp));
return true;
@ -2230,7 +2223,7 @@ namespace UWUVCI_AIO_WPF
ValidatePathsStillExist();
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
{
Task.Run(() => Injection.Download(this)).GetAwaiter();
Task.Run(() => Injection.Download(this)).GetAwaiter().GetResult();
DownloadWait dw = new DownloadWait("Downloading Base - Please Wait", "", this);
try

View file

@ -62,13 +62,16 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{
msgT.Text = mvm.msg;
pb.Value = mvm.Progress;
if(Key.Text.Contains("Downloading Base"))
if (Key.Text.Contains("Downloading Base"))
{
if(mvm.Progress < 70)
if (mvm.Progress < 70)
{
mvm.Progress += 1;
}
}
else
mvm.Progress += 1;
if(mvm.Progress >= 100)
{
timer.Stop();