From 62a98626f3f53b061e2f5181a805a5409f056d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=BD=87=E9=98=B3?= Date: Wed, 10 Jul 2024 09:58:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=85=B3=E9=97=AD=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CPF_Cef/AksVideoPlayer.cs | 33 ++++---- CPF_Cef/AksWebBrowser.csproj | 2 + CPF_Cef/Image/close.png | Bin 0 -> 1765 bytes CPF_Cef/MainModel.cs | 150 ++++++++++++++++++++--------------- 4 files changed, 101 insertions(+), 84 deletions(-) create mode 100644 CPF_Cef/Image/close.png 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 0000000000000000000000000000000000000000..d6fae3078f6b4b434d349bb8842db2b360ca9728 GIT binary patch literal 1765 zcmV#)l@gNo|z2D9T;XCfZ9{DOE5Q5>p?Vlm{P7lbW1kN4RxDf?=MH%4R0Dqh?IxaI_8d}DR>=gLOtk1^i^ZbB z2?Q5mV{kU_ck`X&`OZ0`qhsjk=t5W5HN?fmVArk>-2u;@Igk7I|H1X^H*|s5He?_u zI0%7(ff|%MJI(vmnBbt$CZVetr7mfPsMlcr`IWgfoSTisR_+?!mW5PO6Zyv(sU-*>pGjd2{If z&V&f%#pX5~JzA&9L`O#2t4hJ$frk1f`1$!G zGc#F~7@~pAc*7wZIVJ^{F14es?hG7`eo?v|x$nItb5m6LoI_1$K+4w7&rjqZhIQ*w zb--tzeknrg!Qt{_lKm_;Y{(RN!!&^5%&2l=!iBch4oS2^bTA^~2||HzmX(z*aN87S zmIs@Kg-=KrlxmxrnufmwZ*A+q!IHxgv|IVi&(D!$l2wVUOE%UW1=7~~1B#2wbYY4w zf7`pr$VisbaBqZ2untLq@5j#W4LkF{Z`<%&!+4D*KSIYvEQQ{Ec9KJK!2c-@m~><`xREBQj-yXhEv5{2Lj8NzkoauPE=H+ zN2QUG5y;Jb6A3RbSBQ-;y!Bw#V+>Cna%b~7G~(eqzq5}MHTqm*(Al|yr&>t?`v@t6 zvhLXU&M|Z>4akMO)#QB|SS&s|m_=PtQH?PvaLZiKhYttTk!Z|WS!pU9O+w}y9T+Fl zWX%p4nH}5-KN=2c<|8AcXm9US0~nS6dCU|R=BbKH#Cv;sdNmR5CQobqQlBvMqX z32yav4pS@B)8ueQCp3#U9xgwQk?L%D(v)ePU%L#pMbsztL$Z z&iSW_qQ=7K!rU1-qcd=)JgpngHS5ViyP|{a*s%@Ca)S6;-Py*+Kdt?L{&7pk-xhNq zyfg=*PJ`gi$e~M;)AQBa?M*f`f~Ka6sI6^KBc>SgWM@3a?DlXEhvY0(c9bW_563vf z@M}-jU$?|xS z6a@uau{L>?PVnZ#@NDYTsGN;s)6&krJtk&dGQdf&JMY;oCZtE0*)MHrq zi;a!J&Yjzlv?fspG8j1{eB_vmn>&s1N@mVvIF`4LOgUv}7^S6^V)zaB8wUxzSJ0d8wxkpH%x7Fb*bB=7Scy00000NkvXX Hu0mjfXK7Wk literal 0 HcmV?d00001 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 ""; } ///