This commit is contained in:
熊玮 2024-11-15 14:49:29 +08:00
parent 10cceedd23
commit c0ad2ca12a
5 changed files with 35 additions and 12 deletions

View File

@ -38,7 +38,7 @@ public class App : Application
Locator.CurrentMutable.Register(() => new DetectTaskProgressService(), typeof(DetectTaskProgressService));
Locator.CurrentMutable.Register(() => new DetectLogService(), typeof(DetectLogService));
Locator.CurrentMutable.Register(() => new DeviceClientService(), typeof(DeviceClientService));
Locator.CurrentMutable.Register(DeviceClientService.Instance, typeof(DeviceClientService));
Locator.Current.GetService<DeviceClientService>();
new MainView { DataContext = Locator.Current.GetService<IScreen>() }.Show();

View File

@ -19,7 +19,17 @@ public class DeviceClientService
public DeviceClientService()
{
ConnectAllDevices();
Log.Warning("DeviceClientService Initializing...");
Log.Information("DeviceClientService Initialize Done.");
}
private static DeviceClientService? _instance;
public static DeviceClientService Instance()
{
if (_instance == null)
{
_instance = new DeviceClientService();
}
return _instance;
}
/// <summary>

View File

@ -1,5 +1,4 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using detect.gui.Commons;

View File

@ -1,13 +1,10 @@
using System.Threading;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Platform;
using Avalonia.ReactiveUI;
using Avalonia.Threading;
using Avalonia.VisualTree;
using detect.gui.Services;
using detect.gui.ViewModels;
using ReactiveUI;
using Serilog;
using Splat;
namespace detect.gui.Views;
@ -28,6 +25,20 @@ public partial class WebBrowserWindow : Window
ShowInTaskbar = false;
Topmost = true;
CanResize = false;
Opened += (sender, args) =>
{
var service = Locator.Current.GetService<DeviceClientService>();
if (WebView != null)
{
WebView.RegisterJavascriptObject("DeviceClientService", service);
}
else
{
Log.Warning("WebView is null!");
}
};
}
private void InitializeComponent()

View File

@ -1,6 +1,9 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005Cxwd_005Ccnnc_005Cdetect_005Cdetect_002Egui_005CLibs_005Cxwd_002Eutils_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControl_002Ecs_002Fl_003AC_0021_003FUsers_003Fxiongwei_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ff963a2a29ea2bb2d4ad8737293b45c4edbd94e55219dc42cf68343d6d91d9_003FControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADependencyResolverMixins_002Ecs_002Fl_003AC_0021_003FUsers_003FNick_0020Wang_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fca0d4592dc494bbaa872fd9db942335922638_003Ff9_003Fb0105fc3_003FDependencyResolverMixins_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AReactiveUserControl_002Ecs_002Fl_003AC_0021_003FUsers_003FNick_0020Wang_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F4d7c93652a64ddcaeff466d4c6bae2d847fe753565401deac6d1e5995386b1_003FReactiveUserControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AReactiveWindow_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Fxiongwei_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe4ef1a6c8fbf4ab1a0360a42a1854b208c00_003F5d_003Fbfa2c6a3_003FReactiveWindow_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARxApp_002Ecs_002Fl_003AC_0021_003FUsers_003FNick_0020Wang_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F4c75a39152c6ea672be27a386dbf424c0f2d222d51114dffb436ecd6b570ce_003FRxApp_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskAwaiter_002Ecs_002Fl_003AC_0021_003FUsers_003FNick_0020Wang_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F74e4c72cd3922ed61496931f33baf4a9b5950edddb6b78bc296241285f25c3_003FTaskAwaiter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskAwaiter_002Ecs_002Fl_003AC_0021_003FUsers_003FNick_0020Wang_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F74e4c72cd3922ed61496931f33baf4a9b5950edddb6b78bc296241285f25c3_003FTaskAwaiter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AWindow_002Ecs_002Fl_003AC_0021_003FUsers_003Fxiongwei_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fb430e084ab33d5b318f28876dedabb8aa879f7f7b6e60df3a5da1dd196ecda2_003FWindow_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>