diff --git a/CPF_Cef/AksVideoPlayer.cs b/CPF_Cef/AksVideoPlayer.cs index 622548d..640f66a 100644 --- a/CPF_Cef/AksVideoPlayer.cs +++ b/CPF_Cef/AksVideoPlayer.cs @@ -43,7 +43,7 @@ namespace AksWebBrowser { base.OnInitialized(); //@"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() { @@ -54,16 +54,14 @@ namespace AksWebBrowser Background = "#2c2c2c"; ZIndex = 100; //WindowState = WindowState = WindowState.FullScreen; - Children.Add(new TextBlock + Children.Add(new Picture { MarginRight = 12f, - MarginTop = 10f, + MarginBottom = 10f, Classes = "imgAndText", - FontFamily = "微软雅黑",//Alibaba PuHuiTi - Text = "X", - FontSize = 16, Cursor = CPF.Cursors.Hand, - Foreground = Color.White, + Stretch = Stretch.Fill, + Source= "res://AksWebBrowser/Image/close.png", ZIndex = 101, Commands = { @@ -82,17 +80,16 @@ namespace AksWebBrowser } } }); - - Children.Add(new TextBlock - { - FontSize = 16f, - MarginLeft = 12.6f, - MarginTop = 9.6f, - Classes = "imgAndText", - Foreground = Color.White, - Text = videoTitle, - FontFamily = "微软雅黑", - }); + //Children.Add(new TextBlock + //{ + // FontSize = 16f, + // MarginLeft = 12.6f, + // MarginTop = 9.6f, + // Classes = "imgAndText", + // Foreground = Color.White, + // Text = videoTitle, + // FontFamily = "微软雅黑", + //}); Children.Add(vplayer); } diff --git a/CPF_Cef/AksWebBrowser.csproj b/CPF_Cef/AksWebBrowser.csproj index 9edbc2e..bc731e1 100644 --- a/CPF_Cef/AksWebBrowser.csproj +++ b/CPF_Cef/AksWebBrowser.csproj @@ -27,6 +27,7 @@ + @@ -36,6 +37,7 @@ + diff --git a/CPF_Cef/Image/close.png b/CPF_Cef/Image/close.png new file mode 100644 index 0000000..d6fae30 Binary files /dev/null and b/CPF_Cef/Image/close.png differ diff --git a/CPF_Cef/MainModel.cs b/CPF_Cef/MainModel.cs index d85d8aa..6cd6eea 100644 --- a/CPF_Cef/MainModel.cs +++ b/CPF_Cef/MainModel.cs @@ -3,6 +3,7 @@ using AksWebBrowser.Devices; using AKSWebBrowser.Commen; using CPF.Cef; using Fleck; +using LibVLCSharp.Shared; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -98,6 +99,11 @@ namespace AksWebBrowser result = StopSn(keycode); //Log.Info("打开高拍仪并且进行快速扫描文件关闭:" + result); break; + //打开高拍仪并且进行快速扫描文件打开{"code":"aks100122"} + case "aks100122": + result = OpenSn(keycode); + //Log.Info("打开高拍仪并且进行快速扫描文件打开:" + result); + break; //aks100105 //打开签字版 {"code":"aks100105"} case "aks100105": @@ -509,29 +515,29 @@ namespace AksWebBrowser { try { - //if (Parame.isGPY) - //{ - // //拍照 - // 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; - // } - //} + 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 //{ // //打开高拍仪 @@ -570,42 +576,42 @@ namespace AksWebBrowser //} - 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; - } - } + //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) { @@ -1413,36 +1419,48 @@ namespace AksWebBrowser /// 打开高拍仪 /// /// - public static string OpenSn(string dev_idx) + public static string OpenSn(string code) { 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)); @event6.WaitOne(); 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 { JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr); 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 { - 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) { - //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 ""; } ///