This commit is contained in:
熊玮 2024-11-15 15:58:09 +08:00
parent e3e26b2b6c
commit 5f2a5fc527
4 changed files with 162 additions and 16 deletions

View File

@ -1 +1,156 @@
<!doctype html><html lang="en" id="htmlRoot"><head><script crossorigin src="./_app.config.js"></script><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="renderer" content="webkit"/><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0"/><title>中核集团预埋件检测系统</title><link rel="icon" href="./favicon.ico"/><style>#app{background-color:#0d1540}</style><script type="module" crossorigin src="./assets/index.js"></script><link rel="modulepreload" crossorigin href="./assets/vue-08ef39cb.js"><link rel="modulepreload" crossorigin href="./assets/antd-fb8ca017.js"><link rel="stylesheet" href="./assets/index-50de0f48.css"></head><body><div id="app"><style>html[data-theme=dark] .app-loading{background-color:transparent}html[data-theme=dark] .app-loading .app-loading-title{color:transparent}.app-loading{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;background-color:transparent}.app-loading .app-loading-wrap{display:flex;position:absolute;top:50%;left:50%;flex-direction:column;align-items:center;justify-content:center;transform:translate3d(-50%,-50%,0)}.app-loading .dots{display:flex;align-items:center;justify-content:center;padding:98px}.app-loading .app-loading-title{display:flex;align-items:center;justify-content:center;margin-top:30px;color:rgb(0 0 0 / 85%);font-size:30px}.app-loading .app-loading-logo{display:block;width:90px;margin:0 auto;margin-bottom:20px}.dot{display:inline-block;position:relative;box-sizing:border-box;width:48px;height:48px;margin-top:30px;transform:rotate(45deg);animation:ant-rotate 1.2s infinite linear;font-size:32px}.dot i{display:block;position:absolute;width:20px;height:20px;transform:scale(.75);transform-origin:50% 50%;animation:ant-spin-move 1s infinite linear alternate;border-radius:100%;opacity:.3;background-color:#0065cc}.dot i:first-child{top:0;left:0}.dot i:nth-child(2){top:0;right:0;animation-delay:.4s}.dot i:nth-child(3){right:0;bottom:0;animation-delay:.8s}.dot i:nth-child(4){bottom:0;left:0;animation-delay:1.2s}@keyframes ant-rotate{to{transform:rotate(405deg)}}@keyframes ant-rotate{to{transform:rotate(405deg)}}@keyframes ant-spin-move{to{opacity:1}}@keyframes ant-spin-move{to{opacity:1}}</style><div class="app-loading"><div class="app-loading-wrap"><img src="./logo.png" class="app-loading-logo" alt="Logo"/></div></div></div></body></html>
<!doctype html>
<html id="htmlRoot" lang="en">
<head>
<script crossorigin src="./_app.config.js"></script>
<meta charset="UTF-8"/>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
<meta content="webkit" name="renderer"/>
<meta content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0" name="viewport"/>
<title>中核集团预埋件检测系统</title>
<link href="./favicon.ico" rel="icon"/>
<style>#app {
background-color: #0d1540
}</style>
<script crossorigin src="./assets/index.js" type="module"></script>
<link crossorigin href="./assets/vue-08ef39cb.js" rel="modulepreload">
<link crossorigin href="./assets/antd-fb8ca017.js" rel="modulepreload">
<link href="./assets/index-50de0f48.css" rel="stylesheet">
</head>
<body>
<div id="app">
<style>html[data-theme=dark] .app-loading {
background-color: transparent
}
html[data-theme=dark] .app-loading .app-loading-title {
color: transparent
}
.app-loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background-color: transparent
}
.app-loading .app-loading-wrap {
display: flex;
position: absolute;
top: 50%;
left: 50%;
flex-direction: column;
align-items: center;
justify-content: center;
transform: translate3d(-50%, -50%, 0)
}
.app-loading .dots {
display: flex;
align-items: center;
justify-content: center;
padding: 98px
}
.app-loading .app-loading-title {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30px;
color: rgb(0 0 0 / 85%);
font-size: 30px
}
.app-loading .app-loading-logo {
display: block;
width: 90px;
margin: 0 auto;
margin-bottom: 20px
}
.dot {
display: inline-block;
position: relative;
box-sizing: border-box;
width: 48px;
height: 48px;
margin-top: 30px;
transform: rotate(45deg);
animation: ant-rotate 1.2s infinite linear;
font-size: 32px
}
.dot i {
display: block;
position: absolute;
width: 20px;
height: 20px;
transform: scale(.75);
transform-origin: 50% 50%;
animation: ant-spin-move 1s infinite linear alternate;
border-radius: 100%;
opacity: .3;
background-color: #0065cc
}
.dot i:first-child {
top: 0;
left: 0
}
.dot i:nth-child(2) {
top: 0;
right: 0;
animation-delay: .4s
}
.dot i:nth-child(3) {
right: 0;
bottom: 0;
animation-delay: .8s
}
.dot i:nth-child(4) {
bottom: 0;
left: 0;
animation-delay: 1.2s
}
@keyframes ant-rotate {
to {
transform: rotate(405deg)
}
}
@keyframes ant-rotate {
to {
transform: rotate(405deg)
}
}
@keyframes ant-spin-move {
to {
opacity: 1
}
}
@keyframes ant-spin-move {
to {
opacity: 1
}
}</style>
<div class="app-loading">
<div class="app-loading-wrap"><img alt="Logo" class="app-loading-logo" src="./logo.png"/></div>
</div>
</div>
<script type="text/javascript">
alert("test")
alert(DeviceClientService)
DeviceClientService.GetDeviceInfo(1).then(info => {
alert(JSON.stringify(info))
})
</script>
</body>
</html>

View File

@ -75,7 +75,7 @@ public class DeviceClientService
/// </summary>
/// <param name="deviceId"></param>
/// <returns></returns>
public IDeviceClient? RefreshDeviceClient(long deviceId)
public IDeviceClient? RefreshDeviceClientById(long deviceId)
{
_deviceClients.TryGetValue(deviceId, out var deviceClient);
deviceClient?.DisConnectAsync();

View File

@ -13,6 +13,6 @@
IsHistoryDisabled="True"
IgnoreCertificateErrors="True"
DisableBuiltinContextMenus="True"
AllowDeveloperTools="False"
AllowDeveloperTools="True"
Address="{Binding Address}"/>
</Window>

View File

@ -6,6 +6,7 @@ using detect.gui.Services;
using detect.gui.ViewModels;
using Serilog;
using Splat;
using WebViewControl;
namespace detect.gui.Views;
@ -27,20 +28,10 @@ public partial class WebBrowserWindow : Window
Topmost = true;
CanResize = false;
}
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
var webview = this.Get<WebView>("WebView");
var service = Locator.Current.GetService<DeviceClientService>();
if (WebView != null)
{
WebView.RegisterJavascriptObject("DeviceClientService", service);
}
else
{
Log.Warning("WebView is null!");
}
webview.RegisterJavascriptObject("DeviceClientService", service);
Log.Information("WebView Initialized.");
}
private void InitializeComponent()