Skip to content

Commit

Permalink
Fixed issue with updates not auto-showing in tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Asnivor committed Jun 28, 2017
1 parent 6cc4cc0 commit dc1321c
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions MedLaunch/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ public partial class MainWindow

public App _App { get; set; }

public int UpdateStatus { get; set; }

public MainWindow()
{
InitializeComponent();

UpdateStatus = 0;

_App = ((App)Application.Current);

MainWindow mw = this;
Expand Down Expand Up @@ -3392,7 +3396,9 @@ private async void UpdateCheck(bool isStartup)
if (upgradeNeeded == true)
{
output = "A New MedLaunch Release is Now Available";
UpdatedHeader.Header = "**UPDATE AVAILABLE**";
//UpdatedHeader.Header = "**UPDATE AVAILABLE**";
UpdateStatus += 1;
ChangeUpdateStatus();
//await Task.Delay(1000);
controller.SetMessage("Downloading release information");
await Task.Delay(500);
Expand All @@ -3406,7 +3412,9 @@ private async void UpdateCheck(bool isStartup)
else
{
output = "Your Version of MedLaunch is up to date";
UpdatedHeader.Header = "Updates";
UpdateStatus -= 1;
ChangeUpdateStatus();
//UpdatedHeader.Header = "Updates";
}
controller.SetMessage(output);
if (isStartup == false)
Expand Down Expand Up @@ -3521,12 +3529,35 @@ public void UpdateCheckMednafen()

if (upgradeNeeded == true)
{
UpdatedHeader.Header = "**MEDNAFEN UPDATE AVAILABLE**";
//UpdatedHeader.Header = "**MEDNAFEN UPDATE AVAILABLE**";
UpdateStatus += 2;
}
else
{
UpdatedHeader.Header = "Updates";
}
//UpdatedHeader.Header = "Updates";
UpdateStatus -= 2;
}
ChangeUpdateStatus();
}

public void ChangeUpdateStatus()
{
switch (UpdateStatus)
{
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;
}
}

private void btnCheckForUpdates_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit dc1321c

Please sign in to comment.