1.7 KiB
Entry point Program.Main builds an AppBuilder configured with UsePlatformDetect, LogToTrace, and UseReactiveUI; App.OnFrameworkInitializationCompleted creates the root MainWindow with a MainWindowViewModel and wires it into Assistant.Engine.MainWindow. The module is loaded as a plugin by the core engine: Engine.Install (in the Assistant namespace) loads ClassicAssist.Shared.dll via Assembly.LoadFile, subscribes to Options.SaveEvent/LoadEvent to serialize/deserialize every BaseViewModel implementing ISettingProvider, then calls LoadUI. LoadUI branches on SEngine.GetPlatformType(): on Unix it starts the Avalonia app on a background thread; otherwise it calls SetupWithoutStarting() so the core can set SEngine.Dispatcher = new AvaloniaDispatcher(Dispatcher.UIThread) and SEngine.UIInvoker = new AvaloniaUIInvoker(...) before showing windows. AvaloniaUIInvoker implements IUIInvoker using reflection to construct Window subclasses by name, exposing Invoke, InvokeDialog<T>, GetHueAsync, and clipboard access through IClipboard. Views live under Views/ (root windows plus Agents/ tabbed sub-views), each paired with a .axaml.cs code-behind; reusable widgets are in Controls/ (e.g. GroupBox extending HeaderedContentControl with a XAML theme); shared helpers (Misc/) provide behaviors, value converters, and the AvaloniaMessageBoxProvider. Dependencies flow one-way: this module depends on ClassicAssist.Shared, ClassicAssist.Data, ClassicAssist.Misc, and ClassicAssist.UI.ViewModels; the core never references Avalonia types directly — it only sees the IDispatcher/IUIInvoker/IMessageBoxProvider abstractions.