wxr
2021-03-08 797358fee56a79b8c783aebb87b275f2e8ad1334
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>
        /// 获取子账号token并跳转设备列表页面
        /// </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
                {
                    //先获取萤石云子账号token
                    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.设置所需河东的AccessToken和RefreshToken、域名地址
                                EZSDK.IOS.EZSDK.SetHDlAccessToken(UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken);
                                EZSDK.IOS.EZSDK.SetRequestHttpsHost(OnAppConfig.Instance.RequestHttpsHost);
                                //2.设置萤石子账号的AccessToken到SDK
                                EZSDK.IOS.EZSDK.SetEZAccessToken(ezChildAccessToken.accessToken);
                                //3.打开摄像头设备列表页面
                                EZSDK.IOS.EZSDK.Go2EZvizMonitor();
#else
                                //Android
                                //1.设置所需河东的token、域名地址
                                //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
    }
}