using Avalonia; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using detect.gui.Drivers; using detect.gui.Services; using detect.gui.Services.Detect; using detect.gui.ViewModels; using detect.gui.VWMS; // using detect.gui.Views; using detect.gui.VWS; using ReactiveUI; using Splat; namespace detect.gui; public class App : Application { public override void Initialize() => AvaloniaXamlLoader.Load(this); public override void OnFrameworkInitializationCompleted() { var suspension = new AutoSuspendHelper(ApplicationLifetime!); RxApp.SuspensionHost.CreateNewAppState = () => new MainViewModel(); RxApp.SuspensionHost.SetupDefaultSuspendResume(new NewtonsoftJsonSuspensionDriver("app.state.json")); suspension.OnFrameworkInitializationCompleted(); Locator.CurrentMutable.Register(DetectUserService.Instance, typeof(DetectUserService)); Locator.CurrentMutable.Register(DetectAuthorityService.Instance, typeof(DetectAuthorityService)); Locator.CurrentMutable.Register(DetectDeviceService.Instance, typeof(DetectDeviceService)); Locator.CurrentMutable.Register( DetectTaskService.Instance, typeof(DetectTaskService)); Locator.CurrentMutable.Register(DetectTaskLogService.Instance, typeof(DetectTaskLogService)); Locator.CurrentMutable.Register(DetectTaskProgressService.Instance, typeof(DetectTaskProgressService)); Locator.CurrentMutable.Register(DetectLogService.Instance, typeof(DetectLogService)); Locator.CurrentMutable.Register(DeviceClientService.Instance, typeof(DeviceClientService)); Locator.Current.GetService(); Locator.CurrentMutable.Register( MainWindow.Instance, typeof(MainWindow)); Locator.CurrentMutable.Register(MainWindowModel.Instance, typeof(MainWindowModel)); Locator.CurrentMutable.Register(LoginControlModel.Instance, typeof(LoginControlModel)); Locator.Current.GetService()!.Show(); base.OnFrameworkInitializationCompleted(); } }