From 03d8399009aacc15efde15f08e37893e47dc2427 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 07 十二月 2022 10:45:20 +0800
Subject: [PATCH] 大华摄像头,金茂科技系统

---
 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs |   95 +++++++++++++++++++++++++++--------------------
 1 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
index 78a0c6a..3a74f8e 100644
--- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
+++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -234,65 +234,78 @@
                         break;
                     case SPK.IpCam_Imou:
                         FunctionList.List.GetIpCamImouList();
-
-                        var waitPage = new Loading();
-                        MainPage.BaseView.AddChidren(waitPage);
-                        waitPage.Start("");
-                        new System.Threading.Thread(() =>
+                        if (string.IsNullOrEmpty(Com.Utils.HdlToLcUtils.Instance.SubAccessToken))
                         {
-                            try
+                            var waitPage = new Loading();
+                            MainPage.BaseView.AddChidren(waitPage);
+                            waitPage.Start("");
+                            new System.Threading.Thread(() =>
                             {
-                                var http = new HttpServerRequest();
-                                var pack = http.GetLcSubAccountToken();
-                                if (pack.Code == StateCode.SUCCESS)
+                                try
                                 {
-                                    if (pack.Data == null || string.IsNullOrEmpty(pack.Data.ToString()))
+                                    var http = new HttpServerRequest();
+                                    var pack = http.GetLcSubAccountToken();
+                                    if (pack.Code == StateCode.SUCCESS)
+                                    {
+                                        if (pack.Data == null || string.IsNullOrEmpty(pack.Data.ToString()))
+                                        {
+                                            Application.RunOnMainThread(() =>
+                                            {
+                                                new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao));
+                                            });
+                                        }
+#if __ANDROID__
+                                    Application.RunOnMainThread(() =>
+                                        {
+                                            try
+                                            {
+                                                Com.Utils.HdlToLcUtils.Instance.SubAccessToken = pack.Data.ToString();
+                                                Com.Utils.HdlToLcUtils.Instance.Play(function.extDevId, function.name);
+                                            }
+                                            catch (Exception ex)
+                                            {
+
+                                            }
+                                        });
+#endif
+                                }
+                                    else
                                     {
                                         Application.RunOnMainThread(() =>
                                         {
-                                            new PublicAssmebly().TipMsg("", $"鑾峰彇涔愭鏁版嵁澶辫触");
+                                            new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao) + $"({pack.Code})");
                                         });
                                     }
-#if __ANDROID__
-                                    Application.RunOnMainThread(() =>
-                                    {
-                                        try
-                                        {
-                                            Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
-                                            Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken;
-                                            Com.Utils.HdlToLcUtils.Instance.SubAccessToken = pack.Data.ToString();
-                                            Com.Utils.HdlToLcUtils.Instance.Play(function.extDevId, function.name);
-                                        }
-                                        catch (Exception ex)
-                                        {
-
-                                        }
-                                    });
-#endif
                                 }
-                                else
+                                catch (Exception ex)
+                                {
+                                    MainPage.Log("鍔犺浇涔愭鎽勫儚澶村紓甯�");
+                                }
+                                finally
                                 {
                                     Application.RunOnMainThread(() =>
                                     {
-                                        new PublicAssmebly().TipMsg("", $"鑾峰彇涔愭鏁版嵁澶辫触({pack.Code})");
+                                        if (waitPage != null)
+                                        {
+                                            waitPage.RemoveFromParent();
+                                            waitPage = null;
+                                        }
                                     });
                                 }
-                            }catch(Exception ex)
+                            })
+                            { IsBackground = true }.Start();
+                        }
+                        else
+                        {
+                            try
                             {
-                                MainPage.Log("鍔犺浇涔愭鎽勫儚澶村紓甯�");
+                                Com.Utils.HdlToLcUtils.Instance.Play(function.extDevId, function.name);
                             }
-                            finally
+                            catch (Exception ex)
                             {
-                                Application.RunOnMainThread(() => {
-                                    if (waitPage != null)
-                                    {
-                                        waitPage.RemoveFromParent();
-                                        waitPage = null;
-                                    }
-                                });
+
                             }
-                        })
-                        { IsBackground = true }.Start();
+                        }
                         break;
                 }
             };

--
Gitblit v1.8.0