wxr
2022-12-01 8301df084faa8f43f4b9cb7f92088e5fd9e64524
HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using Shared;
@@ -231,6 +232,68 @@
                        var doorLockPage = new DoorLockPage();
                        doorLockPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor);
                        break;
                    case SPK.IpCam_Imou:
                        FunctionList.List.GetIpCamImouList();
                        var waitPage = new Loading();
                        MainPage.BaseView.AddChidren(waitPage);
                        waitPage.Start("");
                        new System.Threading.Thread(() =>
                        {
                            try
                            {
                                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("", $"获取乐橙数据失败");
                                        });
                                    }
#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
                                {
                                    Application.RunOnMainThread(() =>
                                    {
                                        new PublicAssmebly().TipMsg("", $"获取乐橙数据失败({pack.Code})");
                                    });
                                }
                            }catch(Exception ex)
                            {
                                MainPage.Log("加载乐橙摄像头异常");
                            }
                            finally
                            {
                                Application.RunOnMainThread(() => {
                                    if (waitPage != null)
                                    {
                                        waitPage.RemoveFromParent();
                                        waitPage = null;
                                    }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                        break;
                }
            };
            return eventHandler;