From dbc23459fdf4e8b74a5f955fbb9fc631b4babc70 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 17 三月 2021 11:56:16 +0800
Subject: [PATCH] Merge branch 'temp-wxr' into WJC

---
 HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 99 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs
new file mode 100644
index 0000000..b4af0db
--- /dev/null
+++ b/HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs
@@ -0,0 +1,99 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HDL_ON.Stan
+{
+    /// <summary>
+    /// WiFi鐨勯�昏緫
+    /// </summary>
+    public class HdlWifiLogic
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// WiFi鐨勯�昏緫
+        /// </summary>
+        private static HdlWifiLogic m_Current = null;
+        /// <summary>
+        /// WiFi鐨勯�昏緫
+        /// </summary>
+        public static HdlWifiLogic Current
+        {
+            get
+            {
+                if (m_Current == null)
+                {
+                    m_Current = new HdlWifiLogic();
+                }
+                return m_Current;
+            }
+        }
+
+        /// <summary>
+        /// 褰撳墠wifi鐨凷SID,涔熷彨Wifi鐨勫悕瀛�(鍙栦笉鍒版椂,浼氳繑鍥瀗ull)
+        /// </summary>
+        public string SSID
+        {
+            get
+            {
+#if __IOS__
+                string ssiD = Shared.WiimuUPnP.SSID;
+                if (string.IsNullOrEmpty(ssiD) == false && ssiD.StartsWith("\"") && ssiD.EndsWith("\""))
+                {
+                    ssiD = ssiD.Substring(1, ssiD.Length - 2);
+                }
+                return ssiD;
+#endif
+#if __Android__
+                string ssiD = null;
+                HdlThreadLogic.Current.RunThread(() =>
+                {
+                    Shared.Net.NetWiFi.GetWIFISSID((strId) =>
+                    {
+                        ssiD = strId;
+                    });
+                }, ShowErrorMode.NO);
+                int count = 0;
+                while (ssiD == null)
+                {
+                    System.Threading.Thread.Sleep(50);
+                    count++;
+                    if (count == 20)
+                    {
+                        //1绉掕秴鏃�
+                        return null;
+                    }
+                }
+                if (string.IsNullOrEmpty(ssiD) == false && ssiD.StartsWith("\"") && ssiD.EndsWith("\""))
+                {
+                    ssiD = ssiD.Substring(1, ssiD.Length - 2);
+                }
+                return ssiD;
+#endif
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鎵撳紑鎵嬫満wifi璁剧疆鐣岄潰
+        /// </summary>
+        public void OpenAppWifiSettion()
+        {
+            if (Shared.Application.DeviceType == Shared.Device.Android)
+            {
+                ///鎵撳紑WI-IF鐣岄潰
+                Shared.CommonClass.OpenAction("android.settings.WIFI_SETTINGS");
+            }
+            else
+            {
+                Shared.CommonClass.OpenAction("App-Prefs:root=WIFI");
+            }
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0