diff --git a/SCTools/SCTool_Redesigned/Pages/updatePatcher.xaml.cs b/SCTools/SCTool_Redesigned/Pages/updatePatcher.xaml.cs index 0439c1e..b0891b9 100644 --- a/SCTools/SCTool_Redesigned/Pages/updatePatcher.xaml.cs +++ b/SCTools/SCTool_Redesigned/Pages/updatePatcher.xaml.cs @@ -32,8 +32,10 @@ public updatePatcher() { InitializeComponent(); //Progressbar_demo(); - if(!ChkUpdated()) + if (!ChkUpdated()) TryUpdate(); + else + CleanUpdate(); } private DispatcherTimer timer1; private void Progressbar_demo() @@ -55,15 +57,12 @@ private void timer1_Tick(object sender, EventArgs e) } } - private bool ChkUpdated() //checks if this program launched by updater + private bool ChkUpdated() => _updater.ChkUpdateScript(); //checks if this program launched by updater + + private void CleanUpdate() { - if (_updater.ChkUpdateScript()) - { - _updater.RemoveUpdateScript(); - return true; - } - else - return false; + _updater.RemoveUpdateScript(); + Windows.MainWindow.UI.Phase++; } private async void TryUpdate() { @@ -99,7 +98,7 @@ private async void TryUpdate() } finally { - ((Windows.MainWindow)Application.Current.MainWindow).Phase++; + Windows.MainWindow.UI.Phase++; } }