2024-11-13 17:09:15 +08:00
|
|
|
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;
|
2024-11-26 11:24:25 +08:00
|
|
|
using detect.gui.VWMS;
|
|
|
|
// using detect.gui.Views;
|
|
|
|
using detect.gui.VWS;
|
2024-11-13 17:09:15 +08:00
|
|
|
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();
|
|
|
|
|
2024-11-26 11:24:25 +08:00
|
|
|
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));
|
2024-11-13 17:09:15 +08:00
|
|
|
|
2024-11-15 14:49:29 +08:00
|
|
|
Locator.CurrentMutable.Register(DeviceClientService.Instance, typeof(DeviceClientService));
|
2024-11-13 17:09:15 +08:00
|
|
|
Locator.Current.GetService<DeviceClientService>();
|
2024-11-26 11:24:25 +08:00
|
|
|
|
|
|
|
Locator.CurrentMutable.Register( MainWindow.Instance, typeof(MainWindow));
|
|
|
|
Locator.CurrentMutable.Register(MainWindowModel.Instance, typeof(MainWindowModel));
|
|
|
|
Locator.CurrentMutable.Register(LoginControlModel.Instance, typeof(LoginControlModel));
|
2024-11-13 17:09:15 +08:00
|
|
|
|
2024-11-26 11:24:25 +08:00
|
|
|
Locator.Current.GetService<MainWindow>()!.Show();
|
2024-11-13 17:09:15 +08:00
|
|
|
|
|
|
|
base.OnFrameworkInitializationCompleted();
|
|
|
|
}
|
|
|
|
}
|