@@ -20,6 +20,7 @@ public partial class SimulateViewModel : ViewModelBase
2020
2121 [ ObservableProperty ] private bool _isRunning ;
2222 [ ObservableProperty ] private string _status ;
23+ [ ObservableProperty ] private string _startButtonText ;
2324 [ ObservableProperty ] private ObservableCollection < string > _log = new ( ) ;
2425
2526 public ObservableCollection < PlatformItem > Platforms { get ; } = new ( )
@@ -37,6 +38,7 @@ public partial class SimulateViewModel : ViewModelBase
3738 public SimulateViewModel ( )
3839 {
3940 _status = _loc [ "Patch.Ready" ] ;
41+ _startButtonText = _loc [ "Sim.Start" ] ;
4042 }
4143
4244 /// <summary>
@@ -90,23 +92,33 @@ async Task StartSimulation()
9092 if ( string . IsNullOrWhiteSpace ( Config . PatchFilePath ) ) { Status = _loc [ "Sim.ValidateDirs" ] ; return ; }
9193 if ( string . IsNullOrWhiteSpace ( Config . OutputDirectory ) ) { Status = _loc [ "Sim.ValidateDirs" ] ; return ; }
9294
93- IsRunning = true ; Log . Clear ( ) ; Status = _loc [ "Sim.Starting" ] ;
95+ IsRunning = true ; StartButtonText = "⏳ Running..." ; Log . Clear ( ) ; Status = _loc [ "Sim.Starting" ] ;
9496 try
9597 {
9698 var progress = new Progress < string > ( L ) ;
9799 var result = await _sim . RunAsync ( Config , progress ) ;
98100 if ( result . Success )
99101 {
100102 Status = _loc . T ( "Sim.Completed" , result . Elapsed . TotalSeconds ) ;
101- L ( $ "Result: { ( result . Success ? "PASS" : "FAIL" ) } ") ;
102- foreach ( var note in result . Notes ) L ( $ " Note: { note } ") ;
103- var reportPath = await _report . GenerateAsync ( Config , result , Config . OutputDirectory ) ;
104- L ( _loc . T ( "Sim.Report" , reportPath ) ) ;
105103 }
106- else { Status = _loc . T ( "Sim.Failed" , result . ErrorMessage ?? "unknown" ) ; }
104+ else
105+ {
106+ Status = _loc . T ( "Sim.Failed" , result . ErrorMessage ?? "unknown" ) ;
107+ }
108+ L ( $ "Result: { ( result . Success ? "PASS" : "FAIL" ) } ") ;
109+ foreach ( var note in result . Notes ) L ( $ " Note: { note } ") ;
110+ var reportPath = await _report . GenerateAsync ( Config , result , Config . OutputDirectory ) ;
111+ L ( _loc . T ( "Sim.Report" , reportPath ) ) ;
112+ }
113+ catch ( Exception ex )
114+ {
115+ Status = $ "Error: { ex . Message } ";
116+ L ( $ "FATAL: { ex } ") ;
117+ var failResult = new SimulationResult { Success = false , ErrorMessage = ex . Message } ;
118+ var reportPath = await _report . GenerateAsync ( Config , failResult , Config . OutputDirectory ) ;
119+ L ( _loc . T ( "Sim.Report" , reportPath ) ) ;
107120 }
108- catch ( Exception ex ) { Status = $ "Error: { ex . Message } "; L ( $ "FATAL: { ex } ") ; }
109- finally { IsRunning = false ; }
121+ finally { IsRunning = false ; StartButtonText = _loc [ "Sim.Start" ] ; }
110122 }
111123
112124 void L ( string msg ) => Log . Add ( $ "[{ DateTime . Now : HH:mm:ss} ] { msg } ") ;
0 commit comments