This commit is contained in:
熊玮 2024-11-15 15:01:03 +08:00
parent c0ad2ca12a
commit e3e26b2b6c

View File

@ -1,4 +1,5 @@
using Avalonia.Controls; using System;
using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Avalonia.Platform; using Avalonia.Platform;
using detect.gui.Services; using detect.gui.Services;
@ -25,20 +26,21 @@ public partial class WebBrowserWindow : Window
ShowInTaskbar = false; ShowInTaskbar = false;
Topmost = true; Topmost = true;
CanResize = false; CanResize = false;
}
Opened += (sender, args) => protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
var service = Locator.Current.GetService<DeviceClientService>();
if (WebView != null)
{ {
var service = Locator.Current.GetService<DeviceClientService>(); WebView.RegisterJavascriptObject("DeviceClientService", service);
if (WebView != null) }
{ else
WebView.RegisterJavascriptObject("DeviceClientService", service); {
} Log.Warning("WebView is null!");
else }
{
Log.Warning("WebView is null!");
}
};
} }
private void InitializeComponent() private void InitializeComponent()