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

View file

@ -62,13 +62,16 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{ {
msgT.Text = mvm.msg; msgT.Text = mvm.msg;
pb.Value = mvm.Progress; 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; mvm.Progress += 1;
} }
} }
else
mvm.Progress += 1;
if(mvm.Progress >= 100) if(mvm.Progress >= 100)
{ {
timer.Stop(); timer.Stop();