Browse Source

设置关闭按钮

master
胡超1 1 year ago
parent
commit
62a98626f3
  1. 33
      CPF_Cef/AksVideoPlayer.cs
  2. 2
      CPF_Cef/AksWebBrowser.csproj
  3. BIN
      CPF_Cef/Image/close.png
  4. 144
      CPF_Cef/MainModel.cs

33
CPF_Cef/AksVideoPlayer.cs

@ -43,7 +43,7 @@ namespace AksWebBrowser
{ {
base.OnInitialized(); base.OnInitialized();
//@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4" //@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4"
vplayer.Play(new Uri(url));//播放 vplayer.Play(new Uri(@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4"));//播放
} }
protected override void InitializeComponent() protected override void InitializeComponent()
{ {
@ -54,16 +54,14 @@ namespace AksWebBrowser
Background = "#2c2c2c"; Background = "#2c2c2c";
ZIndex = 100; ZIndex = 100;
//WindowState = WindowState = WindowState.FullScreen; //WindowState = WindowState = WindowState.FullScreen;
Children.Add(new TextBlock Children.Add(new Picture
{ {
MarginRight = 12f, MarginRight = 12f,
MarginTop = 10f, MarginBottom = 10f,
Classes = "imgAndText", Classes = "imgAndText",
FontFamily = "微软雅黑",//Alibaba PuHuiTi
Text = "X",
FontSize = 16,
Cursor = CPF.Cursors.Hand, Cursor = CPF.Cursors.Hand,
Foreground = Color.White, Stretch = Stretch.Fill,
Source= "res://AksWebBrowser/Image/close.png",
ZIndex = 101, ZIndex = 101,
Commands = Commands =
{ {
@ -82,17 +80,16 @@ namespace AksWebBrowser
} }
} }
}); });
//Children.Add(new TextBlock
Children.Add(new TextBlock //{
{ // FontSize = 16f,
FontSize = 16f, // MarginLeft = 12.6f,
MarginLeft = 12.6f, // MarginTop = 9.6f,
MarginTop = 9.6f, // Classes = "imgAndText",
Classes = "imgAndText", // Foreground = Color.White,
Foreground = Color.White, // Text = videoTitle,
Text = videoTitle, // FontFamily = "微软雅黑",
FontFamily = "微软雅黑", //});
});
Children.Add(vplayer); Children.Add(vplayer);
} }

2
CPF_Cef/AksWebBrowser.csproj

@ -27,6 +27,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="Image\close.png" />
<None Remove="msyh.ttc" /> <None Remove="msyh.ttc" />
<None Remove="StyleSheet.css" /> <None Remove="StyleSheet.css" />
</ItemGroup> </ItemGroup>
@ -36,6 +37,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Image\close.png" />
<EmbeddedResource Include="msyh.ttc" /> <EmbeddedResource Include="msyh.ttc" />
<EmbeddedResource Include="StyleSheet.css" /> <EmbeddedResource Include="StyleSheet.css" />
</ItemGroup> </ItemGroup>

BIN
CPF_Cef/Image/close.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

144
CPF_Cef/MainModel.cs

@ -3,6 +3,7 @@ using AksWebBrowser.Devices;
using AKSWebBrowser.Commen; using AKSWebBrowser.Commen;
using CPF.Cef; using CPF.Cef;
using Fleck; using Fleck;
using LibVLCSharp.Shared;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
@ -98,6 +99,11 @@ namespace AksWebBrowser
result = StopSn(keycode); result = StopSn(keycode);
//Log.Info("打开高拍仪并且进行快速扫描文件关闭:" + result); //Log.Info("打开高拍仪并且进行快速扫描文件关闭:" + result);
break; break;
//打开高拍仪并且进行快速扫描文件打开{"code":"aks100122"}
case "aks100122":
result = OpenSn(keycode);
//Log.Info("打开高拍仪并且进行快速扫描文件打开:" + result);
break;
//aks100105 //aks100105
//打开签字版 {"code":"aks100105"} //打开签字版 {"code":"aks100105"}
case "aks100105": case "aks100105":
@ -509,10 +515,44 @@ namespace AksWebBrowser
{ {
try try
{ {
//if (Parame.isGPY) if (true)
{
//拍照
string param = getFrame();
//Log.Info("img2" + (param));
if (string.IsNullOrEmpty(param))
{
//关闭
//StopSn("0");
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
else
{
param = Utils.ImagesByRotate(param, 90);
//关闭
//StopSn("0");
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
}
//else
//{ //{
// //打开高拍仪
// string param = OpenSn(Parame.gpydevIndex);
// if (string.IsNullOrEmpty(param))
// {
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}";
// SubmitLogs(result, "openCamera");
// return result;
// }
// else
// {
// Task.Delay(1000).Wait();
// //拍照 // //拍照
// string param = getFrame(); // param = getFrame();
// //Log.Info("img2" + (param)); // //Log.Info("img2" + (param));
// if (string.IsNullOrEmpty(param)) // if (string.IsNullOrEmpty(param))
// { // {
@ -524,88 +564,54 @@ namespace AksWebBrowser
// } // }
// else // else
// { // {
// param = Utils.ImagesByRotate(param, 90); // string base64 = Utils.ImagesByRotate(param, 90);
// //关闭 // //关闭
// //StopSn("0"); // //StopSn("0");
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; // string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
// SubmitLogs(result, "openCamera"); // SubmitLogs(result, "openCamera");
// return result; // return result;
// } // }
// }
//} //}
//else
//string devindex = GetSnIndex();
//if (string.IsNullOrEmpty(devindex))
//{
// devindex = Parame.gpydevIndex;
//}
////打开高拍仪
//string param = OpenSn(devindex);
//if (string.IsNullOrEmpty(param))
//{ //{
// //打开高拍仪
// string param = OpenSn(Parame.gpydevIndex);
// if (string.IsNullOrEmpty(param))
// {
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; // string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}";
// SubmitLogs(result, "openCamera"); // SubmitLogs(result, "openCamera");
// return result; // return result;
// } //}
// else //else
// { //{
// Task.Delay(1000).Wait(); // Task.Delay(1000).Wait();
// //拍照 // //拍照
// param = getFrame(); // param = getFrame();
// //Log.Info("img2" + (param)); // Task.Delay(1000).Wait();
// //Log.Info("拍照结果img2:" + (param));
// if (string.IsNullOrEmpty(param)) // if (string.IsNullOrEmpty(param))
// { // {
// //关闭 // //关闭
// //StopSn("0"); // StopSn(devindex);
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; // string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描失败,请重新扫描" + "\"}";
// SubmitLogs(result, "openCamera"); // SubmitLogs(result, "openCamera");
// return result; // return result;
// } // }
// else // else
// { // {
// string base64 = Utils.ImagesByRotate(param, 90); // string base64 = Utils.ImagesByRotate(param, 90);
// //关闭
// //StopSn("0");
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; // string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
// SubmitLogs(result, "openCamera"); // SubmitLogs(result, "openCamera");
// return result; // return result;
// } // }
// }
//} //}
string devindex = GetSnIndex();
if (string.IsNullOrEmpty(devindex))
{
devindex = Parame.gpydevIndex;
}
//打开高拍仪
string param = OpenSn(devindex);
if (string.IsNullOrEmpty(param))
{
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
else
{
Task.Delay(1000).Wait();
//拍照
param = getFrame();
Task.Delay(1000).Wait();
//Log.Info("拍照结果img2:" + (param));
if (string.IsNullOrEmpty(param))
{
//关闭
StopSn(devindex);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描失败,请重新扫描" + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
else
{
string base64 = Utils.ImagesByRotate(param, 90);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1413,36 +1419,48 @@ namespace AksWebBrowser
/// 打开高拍仪 /// 打开高拍仪
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static string OpenSn(string dev_idx) public static string OpenSn(string code)
{ {
try try
{ {
string devindex = GetSnIndex();
if (string.IsNullOrEmpty(devindex))
{
devindex = Parame.gpydevIndex;
}
//获取设备信息 //获取设备信息
string param = "/StartPreview?dev_idx=" + dev_idx + "&res_id=0"; string param = "/StartPreview?dev_idx=" + devindex + "&res_id=0";
Task.Run(() => HttpResponse(param)); Task.Run(() => HttpResponse(param));
@event6.WaitOne(); @event6.WaitOne();
if (string.IsNullOrEmpty(gpyStr)) if (string.IsNullOrEmpty(gpyStr))
{ {
return ""; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "打开高拍仪失败" + "\"}";
SubmitLogs(result, "openCamera");
return result;
} }
else else
{ {
JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr); JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
if (jo["returnCode"].ToString() == "0" || jo["returnCode"].ToString() == "2") if (jo["returnCode"].ToString() == "0" || jo["returnCode"].ToString() == "2")
{ {
return "200"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "打开高拍仪成功" + "\"}";
SubmitLogs(result, "openCamera");
return result;
} }
else else
{ {
return ""; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "打开高拍仪失败" + "\"}";
SubmitLogs(result, "openCamera");
return result;
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
//Log.Error("打开高拍仪异常:" + ex.Message); string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "openCamera");
return result;
} }
return "";
} }
/// <summary> /// <summary>

Loading…
Cancel
Save