Added instant progress updates where necessary

This commit is contained in:
pointfeev 2021-07-27 03:13:24 -05:00
parent 17144f313a
commit c6b3cbd3fc
3 changed files with 10 additions and 2 deletions

View file

@ -20,7 +20,7 @@ namespace CreamInstaller
public void UpdateProgress(int progress) public void UpdateProgress(int progress)
{ {
userProgressBar.Value = progress; Program.UpdateProgressInstantly(userProgressBar, progress);
} }
public void UpdateUser(string text, bool log = true) public void UpdateUser(string text, bool log = true)

View file

@ -99,8 +99,8 @@ namespace CreamInstaller
Progress<double> progress = new Progress<double>(); Progress<double> progress = new Progress<double>();
progress.ProgressChanged += new EventHandler<double>(delegate (object sender, double _progress) progress.ProgressChanged += new EventHandler<double>(delegate (object sender, double _progress)
{ {
progressBar1.Value = (int)_progress;
label1.Text = $"Updating . . . {(int)_progress}%"; label1.Text = $"Updating . . . {(int)_progress}%";
Program.UpdateProgressInstantly(progressBar1, (int)_progress);
}); });
label1.Text = "Updating . . . "; label1.Text = "Updating . . . ";

View file

@ -52,6 +52,14 @@ namespace CreamInstaller
public static Task OutputTask; public static Task OutputTask;
public static string OutputFile; public static string OutputFile;
public static void UpdateProgressInstantly(ProgressBar progressBar, int progress)
{
progressBar.Maximum++;
progressBar.Value = progress + 1;
progressBar.Value = progress;
progressBar.Maximum--;
}
private static void UpdateProgress(int progress) private static void UpdateProgress(int progress)
{ {
if (InstallForm != null) if (InstallForm != null)