Skip to content

Commit 6608678

Browse files
author
Antoine Aflalo
committed
Installer is not set to restart SoundSwitch
When run on silent mode Fixes #76
1 parent df264af commit 6608678

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Installer/setup.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppSetupName}}"; Filename: "{uninstallex
8080
Name: "{commondesktop}\{#MyAppSetupName}"; Filename: "{app}\SoundSwitch.exe"; Tasks: desktopicon
8181

8282
[Run]
83-
Filename: "{app}\SoundSwitch.exe"; Description: "{cm:LaunchProgram,{#MyAppSetupName}}"; Flags: nowait postinstall skipifsilent
83+
Filename: "{app}\SoundSwitch.exe"; Description: "{cm:LaunchProgram,{#MyAppSetupName}}"; Flags: nowait postinstall
8484

8585
[CustomMessages]
8686
win_sp_title=Windows %1 Service Pack %2

SoundSwitch/Framework/Updater/AutoUpdater.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using System.IO;
17+
using System.Threading;
1718
using System.Windows.Forms;
1819

1920
namespace SoundSwitch.Framework.Updater
@@ -23,6 +24,7 @@ namespace SoundSwitch.Framework.Updater
2324
/// </summary>
2425
public class AutoUpdater
2526
{
27+
private readonly SynchronizationContext _context = SynchronizationContext.Current ?? new SynchronizationContext();
2628
public string InstallerParameters { get; }
2729
public string InstallerFilePath { get; }
2830

@@ -48,7 +50,7 @@ public void Update(Release release, bool closeApp)
4850
file.Start(InstallerParameters);
4951
if (closeApp)
5052
{
51-
Application.Exit();
53+
_context.Send(s => { Application.Exit(); }, null);
5254
}
5355
};
5456
file.DownloadFile();

SoundSwitch/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private static void Main()
110110
{
111111
return;
112112
}
113-
new AutoUpdater("/VERYSILENT /RESTARTAPPLICATIONS /NOCANCEL", ApplicationPath.Default).Update(@event.Release, false);
113+
new AutoUpdater("/VERYSILENT /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /NOCANCEL", ApplicationPath.Default).Update(@event.Release, false);
114114
};
115115
if (AppConfigs.Configuration.FirstRun)
116116
{

0 commit comments

Comments
 (0)