From d6578b10542226650e263815dea75e598a7090f9 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 17 八月 2022 13:22:02 +0800
Subject: [PATCH] tcp状态更新,iOS扫描

---
 HDL-ON_iOS/Scan.cs |  101 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 64 insertions(+), 37 deletions(-)

diff --git a/HDL-ON_iOS/Scan.cs b/HDL-ON_iOS/Scan.cs
index 9bc60b9..8f159ad 100644
--- a/HDL-ON_iOS/Scan.cs
+++ b/HDL-ON_iOS/Scan.cs
@@ -2,7 +2,7 @@
 using HDL_ON_iOS;
 using Shared;
 using ZXing.Mobile;
-
+using HDL.Shared.IOS.ScanQRCode;
 namespace HDL_ON
 {
     public class Scan
@@ -27,51 +27,78 @@
 
         }
 
-        static MobileBarcodeScanner scanner;
-        public async void OpenScan(Action<string> action)
+        void ScanResult(string result)
         {
-            string cancel = "鍙栨秷";
-            string flashText = "";
-            string titleText = "浜岀淮鐮佹壂鎻�";
-            if (Language.CurrentLanguage != "Chinese")
-            {
-                cancel = "Cancel";
-                flashText = "";
-                titleText = "Scan";
-            }
-
-            if (scanner == null)
-            {
-                var mZXingOverlayView = new ZXingOverlayView(cancel, flashText, titleText);
-                scanner = new MobileBarcodeScanner(AppDelegate.rootViewController) { FlashButtonText = flashText, TopText = titleText, BottomText = "", CancelButtonText = cancel };
-                scanner.UseCustomOverlay = true;
-
-                scanner.CustomOverlay = mZXingOverlayView;
-                var bOn = false;
-                mZXingOverlayView.OnCancel += () =>
-                {
-                    scanner?.Cancel();
-                };
-
-                mZXingOverlayView.OnTorch += () =>
-                {
-                    bOn = !bOn;
-                    scanner?.Torch(bOn);
-                };
-
-            }
-
-            var result = await scanner.Scan();
-
             if (result != null)
             {
-                action?.Invoke(result.Text);
+                action?.Invoke(result);
             }
             else
             {
                 action?.Invoke(null);
                 Console.WriteLine("浜岀淮鐮佽繑鍥炲�间负null");
             }
+
+        }
+
+        static MobileBarcodeScanner scanner;
+
+
+        Action<string> action;
+
+        public void OpenScan(Action<string> action)
+        {
+            this.action = action;
+
+            string cancel = "鍙栨秷";
+            //string flashText = "";
+            string titleText = "浜岀淮鐮佹壂鎻�";
+            if (Language.CurrentLanguage != "Chinese")
+            {
+                cancel = "Cancel";
+                //flashText = "";
+                titleText = "Scan";
+            }
+            var d1 = new HDLQRCodeScanFinish(ScanResult);
+            HDL.Shared.IOS.ScanQRCode.HDLScanQRCodeSDK.SharedInstance().ScanQRCodeWith(cancel, titleText, d1);
+
+
+
+            //if (scanner == null)
+            //{
+            //    var mZXingOverlayView = new ZXingOverlayView(cancel, flashText, titleText);
+            //    scanner = new MobileBarcodeScanner(AppDelegate.rootViewController) { FlashButtonText = flashText, TopText = titleText, BottomText = "", CancelButtonText = cancel };
+            //    scanner.UseCustomOverlay = true;
+
+            //    scanner.CustomOverlay = mZXingOverlayView;
+            //    var bOn = false;
+            //    mZXingOverlayView.OnCancel += () =>
+            //    {
+            //        scanner?.Cancel();
+            //    };
+
+            //    mZXingOverlayView.OnTorch += () =>
+            //    {
+            //        bOn = !bOn;
+            //        scanner?.Torch(bOn);
+            //    };
+
+            //}
+
+            //var result = await scanner.Scan();
+
+            //if (result != null)
+            //{
+            //    action?.Invoke(result.Text);
+            //}
+            //else
+            //{
+            //    action?.Invoke(null);
+            //    Console.WriteLine("浜岀淮鐮佽繑鍥炲�间负null");
+            //}
+
+
+
         }
 
         public static byte[] BytesFromText(string text, int width = 300, int height = 300)

--
Gitblit v1.8.0