From 797358fee56a79b8c783aebb87b275f2e8ad1334 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 08 三月 2021 09:21:07 +0800
Subject: [PATCH] Merge branch 'CJL' into temp-wxr

---
 HDL_ON/Common/HDLCommon.cs |   91 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 87 insertions(+), 4 deletions(-)

diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 6e8b865..a19d240 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -278,7 +278,7 @@
                             ShowAlarmPushMessage(jpushMessageInfo);
                             //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
                         }
-                       
+
                     });
                     return;
                 }
@@ -384,8 +384,9 @@
             {
                 //Dialog
                 alarmPushConfirmDialog = null;
-                Action backAction = () => {
-                   
+                Action backAction = () =>
+                {
+
                 };
                 var skipPage = new MessageCenterPage();
                 MainPage.BasePageView.AddChidren(skipPage);
@@ -480,7 +481,7 @@
             {
                 MainPage.InternetStatus = 1;
                 Control.Ins.SearchLoaclGateway();
-                
+
             }
             else if (internetStatus == 2)//WiFi缃戠粶
             {
@@ -489,5 +490,87 @@
             }
         }
         #endregion
+
+        #region 璺宠浆鎵撳紑钀ょ煶浜戞柟娉�
+
+        /// <summary>
+        /// 鑾峰彇瀛愯处鍙穞oken骞惰烦杞澶囧垪琛ㄩ〉闈�
+        /// </summary>
+        /// <param name="bodyView"></param>
+        public void Go2EZvizMonitor(FrameLayout bodyView)
+        {
+            var waitPage = new Loading();
+            bodyView.AddChidren(waitPage);
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
+
+            new Thread(() =>
+            {
+                try
+                {
+                    //鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken
+                    var result = new HttpServerRequest().EZGetChildToken();
+                    if (result.Code == StateCode.SUCCESS)
+                    {
+                        var ezChildAccessToken = Newtonsoft.Json.JsonConvert.DeserializeObject<EZChildAccessToken>(result.Data.ToString());
+                        Application.RunOnMainThread(() =>
+                        {
+                            if (!string.IsNullOrEmpty(ezChildAccessToken.accessToken))
+                            {
+#if __IOS__
+                                //iOS
+
+                                //1.璁剧疆鎵�闇�娌充笢鐨凙ccessToken鍜孯efreshToken銆佸煙鍚嶅湴鍧�
+                                EZSDK.IOS.EZSDK.SetHDlAccessToken(UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken);
+                                EZSDK.IOS.EZSDK.SetRequestHttpsHost(OnAppConfig.Instance.RequestHttpsHost);
+                                //2.璁剧疆钀ょ煶瀛愯处鍙风殑AccessToken鍒癝DK
+                                EZSDK.IOS.EZSDK.SetEZAccessToken(ezChildAccessToken.accessToken);
+                                //3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈�
+                                EZSDK.IOS.EZSDK.Go2EZvizMonitor();
+
+#else
+                                //Android
+                                //1.璁剧疆鎵�闇�娌充笢鐨則oken銆佸煙鍚嶅湴鍧�
+                                //2.璁剧疆钀ょ煶瀛愯处鍙风殑token
+                                //3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈�
+                                ((BaseActivity)Shared.Application.Activity).SetCamera(b =>
+                                {
+                                    if (b)
+                                    {
+                                        Android.Content.Intent intent = new Android.Content.Intent();
+                                        intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity"));
+                                        Shared.Application.Activity.StartActivity(intent);
+                                    }
+                                });
+#endif
+
+
+                            }
+
+                        });
+                    }
+                    else
+                    {
+                        IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
+                    }
+                }
+                catch (Exception ex)
+                {
+                }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        if (waitPage != null)
+                        {
+                            waitPage.RemoveFromParent();
+                            waitPage = null;
+                        }
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0