Simplify example infrastructure with Create(example) parameter

- Added bool example parameter to Application.Create()
- Added static ObservableCollection<IApplication> Apps for external observers
- When example=true, metadata is collected and demo keys are sent when first TopRunnable is modal
- Removed ExampleContextInjector complexity
- Examples now use Application.Create(example: isExample)
- Key injection happens via SessionBegun event monitoring TopRunnable.IsModal
- Clean, simple architecture that allows external observers to subscribe to Apps collection

This addresses @tig's feedback to simplify the approach.

Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-02 13:51:11 +00:00
parent 215d76645b
commit 401db78b45
6 changed files with 130 additions and 16 deletions

View File

@@ -23,18 +23,16 @@ ConfigurationManager.Enable (ConfigLocations.All);
// Check for test context to determine driver
string? contextJson = Environment.GetEnvironmentVariable (ExampleContext.ENVIRONMENT_VARIABLE_NAME);
string? driverName = null;
var isExample = false;
if (!string.IsNullOrEmpty (contextJson))
{
ExampleContext? context = ExampleContext.FromJson (contextJson);
driverName = context?.DriverName;
isExample = true;
}
IApplication app = Application.Create ();
// Setup automatic key injection for testing
ExampleContextInjector.SetupAutomaticInjection (app);
IApplication app = Application.Create (example: isExample);
app.Init (driverName);
app.Run<ExampleWindow> ();