Skip to content

Commit 2c911d0

Browse files
Merge pull request #125 from erikdarlingdata/dev
Release v1.2.4
2 parents fe0ff35 + 7fa816a commit 2c911d0

6 files changed

Lines changed: 69 additions & 7 deletions

File tree

src/PlanViewer.App/AboutWindow.axaml.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,18 @@ private async void CheckUpdate_Click(object? sender, RoutedEventArgs e)
132132
CheckUpdateButton.IsEnabled = true;
133133
}
134134

135+
private bool _updateDownloaded;
136+
135137
private async void UpdateLink_Click(object? sender, PointerPressedEventArgs e)
136138
{
137-
// Velopack download + apply
139+
// Step 3: User clicks "Restart now" after download
140+
if (_updateDownloaded && _velopackMgr != null && _velopackUpdate != null)
141+
{
142+
_velopackMgr.ApplyUpdatesAndRestart(_velopackUpdate.TargetFullRelease);
143+
return;
144+
}
145+
146+
// Step 2: User clicks to download
138147
if (_velopackMgr != null && _velopackUpdate != null)
139148
{
140149
try
@@ -144,8 +153,10 @@ private async void UpdateLink_Click(object? sender, PointerPressedEventArgs e)
144153

145154
await _velopackMgr.DownloadUpdatesAsync(_velopackUpdate);
146155

147-
UpdateStatusText.Text = "Update downloaded — restarting...";
148-
_velopackMgr.ApplyUpdatesAndRestart(_velopackUpdate.TargetFullRelease);
156+
_updateDownloaded = true;
157+
UpdateStatusText.Text = "Update downloaded.";
158+
UpdateLink.Text = "Restart now to apply";
159+
UpdateLink.IsVisible = true;
149160
}
150161
catch (Exception ex)
151162
{

src/PlanViewer.App/MainWindow.axaml.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public MainWindow()
4848

4949
InitializeComponent();
5050

51+
// Check for updates on startup (non-blocking)
52+
_ = CheckForUpdatesOnStartupAsync();
53+
5154
// Build the Recent Plans submenu from saved state
5255
RebuildRecentPlansMenu();
5356

@@ -1359,4 +1362,52 @@ private void ShowError(string message)
13591362
};
13601363
dialog.ShowDialog(this);
13611364
}
1365+
1366+
private async Task CheckForUpdatesOnStartupAsync()
1367+
{
1368+
try
1369+
{
1370+
await Task.Delay(5000); // Don't slow down startup
1371+
1372+
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
1373+
System.Runtime.InteropServices.OSPlatform.Windows))
1374+
{
1375+
try
1376+
{
1377+
var mgr = new Velopack.UpdateManager(
1378+
new Velopack.Sources.GithubSource(
1379+
"https://github.com/erikdarlingdata/PerformanceStudio", null, false));
1380+
1381+
var update = await mgr.CheckForUpdatesAsync();
1382+
if (update != null)
1383+
{
1384+
await Dispatcher.UIThread.InvokeAsync(() =>
1385+
{
1386+
Title = $"Performance Studio — Update v{update.TargetFullRelease.Version} available (Help > About)";
1387+
});
1388+
return;
1389+
}
1390+
}
1391+
catch
1392+
{
1393+
// Velopack not available — fall through
1394+
}
1395+
}
1396+
1397+
var currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
1398+
?? new Version(0, 0, 0);
1399+
var result = await UpdateChecker.CheckAsync(currentVersion);
1400+
if (result.UpdateAvailable)
1401+
{
1402+
await Dispatcher.UIThread.InvokeAsync(() =>
1403+
{
1404+
Title = $"Performance Studio — Update {result.LatestVersion} available (Help > About)";
1405+
});
1406+
}
1407+
}
1408+
catch
1409+
{
1410+
// Never crash on update check
1411+
}
1412+
}
13621413
}

src/PlanViewer.App/PlanViewer.App.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ApplicationManifest>app.manifest</ApplicationManifest>
77
<ApplicationIcon>EDD.ico</ApplicationIcon>
88
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
9-
<Version>1.2.3</Version>
9+
<Version>1.2.4</Version>
1010
<Authors>Erik Darling</Authors>
1111
<Company>Darling Data LLC</Company>
1212
<Product>Performance Studio</Product>

src/PlanViewer.Cli/PlanViewer.Cli.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Nullable>enable</Nullable>
1212
<RootNamespace>PlanViewer.Cli</RootNamespace>
1313
<AssemblyName>planview</AssemblyName>
14-
<Version>1.2.3</Version>
14+
<Version>1.2.4</Version>
1515
<Authors>Erik Darling</Authors>
1616
<Company>Darling Data LLC</Company>
1717
<Product>Performance Studio</Product>

src/PlanViewer.Core/PlanViewer.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>PlanViewer.Core</RootNamespace>
8-
<Version>1.2.3</Version>
8+
<Version>1.2.4</Version>
99
<Authors>Erik Darling</Authors>
1010
<Company>Darling Data LLC</Company>
1111
<Product>SQL Performance Studio</Product>

src/PlanViewer.Ssms.Installer/PlanViewer.Ssms.Installer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<AssemblyName>InstallSsmsExtension</AssemblyName>
77
<RootNamespace>PlanViewer.Ssms.Installer</RootNamespace>
88
<ApplicationManifest>app.manifest</ApplicationManifest>
9-
<Version>1.2.3</Version>
9+
<Version>1.2.4</Version>
1010
<Authors>Erik Darling</Authors>
1111
<Company>Darling Data LLC</Company>
1212
<Product>SQL Performance Studio</Product>

0 commit comments

Comments
 (0)