fix Appscape install bugs

This commit is contained in:
Michael 2017-04-25 12:24:44 -04:00
parent cd29d582d9
commit 91c6b3bf1c
2 changed files with 21 additions and 10 deletions

View file

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
using System.Threading;
namespace ShiftOS.WinForms.Applications
{
@ -29,21 +30,21 @@ namespace ShiftOS.WinForms.Applications
pnlselectfile.Hide();
install.ProgressReported += (p) =>
{
this.Invoke(new Action(() =>
Desktop.InvokeOnWorkerThread(new Action(() =>
{
pginstall.Value = p;
}));
};
install.StatusReported += (s) =>
{
this.Invoke(new Action(() =>
Desktop.InvokeOnWorkerThread(new Action(() =>
{
lbprogress.Text = s;
}));
};
install.InstallCompleted += () =>
{
this.Invoke(new Action(() =>
Desktop.InvokeOnWorkerThread(new Action(() =>
{
lbtitle.Text = "Select file";
pnlselectfile.Show();
@ -51,6 +52,10 @@ namespace ShiftOS.WinForms.Applications
isInstalling = false;
InstallCompleted?.Invoke();
};
while (!this.Visible)
{
}
isInstalling = true;
install.Install();
}

View file

@ -336,22 +336,28 @@ namespace ShiftOS.WinForms.ShiftnetSites
int i = 0;
while (i <= Size)
{
SetProgress((i / Size) * 100);
i++;
Thread.Sleep(100);
double progress = ((i / Size) * 100);
SetProgress((int)progress);
i += Applications.DownloadManager.GetDownloadSpeed();
Thread.Sleep(1000);
}
SetProgress(0);
SetStatus("Installing...");
i = 0;
while (i <= Size)
{
SetProgress((i / Size) * 100);
i++;
Thread.Sleep(50);
double progress = ((i / Size) * 100);
SetProgress((int)progress);
i+=1024;
Thread.Sleep(1000);
}
Shiftorium.Buy(ShiftoriumId, 0);
Desktop.InvokeOnWorkerThread(() =>
{
Shiftorium.Buy(ShiftoriumId, 0);
Infobox.Show("Install complete!", "The installation of " + Name + " has completed.");
SaveSystem.SaveGame();
});