Skip to content

Commit

Permalink
Merge branch 'features/SquirrelInstaller'
Browse files Browse the repository at this point in the history
# Conflicts:
#	StartLauncher.App/App.xaml.cs
  • Loading branch information
matthiaslischka committed Sep 11, 2017
2 parents 0ca62ba + 0d309ee commit 1920d88
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions StartLauncher.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace StartLauncher.App
public partial class App
{
public static ManualResetEvent UpdateCheckResetEvent = new ManualResetEvent(false);

private static readonly Mutex SingleInstanceApplicationMutex = new Mutex(true,
"{333499E4-B949-48F2-8C7C-6DFBF11ED9E1}");

Expand Down Expand Up @@ -84,33 +83,26 @@ private static async Task EnsureAppUpToDate()

var updated = false;

try
using (var mgr = UpdateManager
.GitHubUpdateManager("https://github.com/matthiaslischka/StartLauncher").Result)
{
using (var mgr = UpdateManager
.GitHubUpdateManager("https://github.com/matthiaslischka/StartLauncher").Result)
{
var updateInfo = await mgr.CheckForUpdate();
if (updateInfo.ReleasesToApply.Any())
{
Console.Out.WriteLine($"Found Update {updateInfo.FutureReleaseEntry.Version}.");
await mgr.UpdateApp(i => Console.Out.WriteLine($"Updating: {i}"));
Console.Out.WriteLine("Update Finished.");
updated = true;
}
}

if (updated)
var updateInfo = await mgr.CheckForUpdate();
if (updateInfo.ReleasesToApply.Any())
{
Console.Out.WriteLine("Restarting to launch new Version.");
UpdateManager.RestartApp();
System.Console.Out.WriteLine($"Found Update {updateInfo.FutureReleaseEntry.Version}.");
await mgr.UpdateApp(i => System.Console.Out.WriteLine($"Updating: {i}"));
System.Console.Out.WriteLine("Update Finished.");
updated = true;
}
}
catch (Exception e)

if (updated)
{
UpdateCheckResetEvent.Set();
Console.Error.WriteLine(e);
throw;
System.Console.Out.WriteLine("Restarting to launch new Version.");
UpdateManager.RestartApp();
}

UpdateCheckResetEvent.Set();
}

private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
Expand Down

0 comments on commit 1920d88

Please sign in to comment.