@@ -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}
0 commit comments