From 4af1ae3bf3d4454bb03459b4c2b17fe869ef40b2 Mon Sep 17 00:00:00 2001 From: ASNiVOR Date: Wed, 28 Jun 2017 11:08:20 +0100 Subject: [PATCH] Finally fixed update tab --- MedLaunch/MainWindow.xaml.cs | 44 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/MedLaunch/MainWindow.xaml.cs b/MedLaunch/MainWindow.xaml.cs index ccf3975..b22aa47 100644 --- a/MedLaunch/MainWindow.xaml.cs +++ b/MedLaunch/MainWindow.xaml.cs @@ -81,6 +81,8 @@ public partial class MainWindow public App _App { get; set; } public int UpdateStatus { get; set; } + public bool UpdateStatusML { get; set; } + public bool UpdateStatusMF { get; set; } public MainWindow() { @@ -3396,8 +3398,7 @@ private async void UpdateCheck(bool isStartup) if (upgradeNeeded == true) { output = "A New MedLaunch Release is Now Available"; - //UpdatedHeader.Header = "**UPDATE AVAILABLE**"; - UpdateStatus += 1; + UpdateStatusML = true; ChangeUpdateStatus(); //await Task.Delay(1000); controller.SetMessage("Downloading release information"); @@ -3412,7 +3413,7 @@ private async void UpdateCheck(bool isStartup) else { output = "Your Version of MedLaunch is up to date"; - UpdateStatus -= 1; + UpdateStatusML = false; ChangeUpdateStatus(); //UpdatedHeader.Header = "Updates"; } @@ -3529,35 +3530,36 @@ public void UpdateCheckMednafen() if (upgradeNeeded == true) { - //UpdatedHeader.Header = "**MEDNAFEN UPDATE AVAILABLE**"; - UpdateStatus += 2; + UpdateStatusMF = true; } else { - //UpdatedHeader.Header = "Updates"; - UpdateStatus -= 2; + UpdateStatusMF = false; } ChangeUpdateStatus(); } public void ChangeUpdateStatus() { - switch (UpdateStatus) + if (UpdateStatusMF == false && UpdateStatusML == false) { - case 1: // medlaunch update - UpdatedHeader.Header = "**MEDLAUNCH UPDATE AVAILABLE**"; - break; - case 2: // mednafen update - UpdatedHeader.Header = "**MEDNAFEN UPDATE AVAILABLE**"; - break; - case 3: // medlaunch & mednafen updates - UpdatedHeader.Header = "**2 UPDATES AVAILABLE**"; - break; - - default: // no updates - UpdatedHeader.Header = "Updates"; - break; + UpdatedHeader.Header = "Updates"; } + + if (UpdateStatusMF == true && UpdateStatusML == false) + { + UpdatedHeader.Header = "**MEDNAFEN UPDATE AVAILABLE**"; + } + + if (UpdateStatusMF == false && UpdateStatusML == true) + { + UpdatedHeader.Header = "**MEDLAUNCH UPDATE AVAILABLE**"; + } + + if (UpdateStatusMF == true && UpdateStatusML == true) + { + UpdatedHeader.Header = "**2 UPDATES AVAILABLE**"; + } } private void btnCheckForUpdates_Click(object sender, RoutedEventArgs e)