From 372ebbd137d2951a7ac03b964d530d05ad7a5971 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 15 三月 2023 18:17:04 +0800 Subject: [PATCH] 2023年03月15日18:16:54 --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs | 279 +++++++++++++++++++++++++++++----- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 1 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs | 58 +++++++ HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs | 66 +++++-- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs | 27 +-- HDL_ON/HDL_ON.projitems | 1 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs | 1 9 files changed, 352 insertions(+), 87 deletions(-) diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 3ddba4a..c1e834e 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -533,6 +533,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\CommonMethod.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\ObjectClass.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideDoorLockSend.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\StackTraceLog.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs index 42a9fee..4ab77e6 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs @@ -182,7 +182,7 @@ break; case SPK.VideoDoorLock: { //璺宠浆鍒癮ndroid閭h竟鍘� - HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.SkipAddDeviceActivity(); + HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.SkipAddDeviceActivity("K36229010"); } break; } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index f485677..2adb273 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -415,6 +415,7 @@ dialog.Close(); LoadEvent_ChangeCurHome(home); LoadContentView(); + HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.ChangeCurrHome(home); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs index aab55e7..65e7438 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs @@ -36,6 +36,7 @@ { if (dialog != null) { + //闃叉浜岄噸鐣岄潰 dialog.Close(); } dialog = new Dialog() diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs index 458e977..f07cff2 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs @@ -5,12 +5,12 @@ namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock { + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣鍏叡鏂规硶绫� + /// </summary> public class CommonMethod { - public CommonMethod() - { - } - + private Loading loading; private static CommonMethod commonMethod = null; public static CommonMethod Current @@ -27,11 +27,28 @@ } } + + #region --------- 璺宠浆鍒癆ndroid閭h竟鐨勬柟娉�(钀ょ煶瑙嗛闂ㄩ攣) -------- /// <summary> - /// 璺宠浆鍒癆ndroid閭h竟鍘� + /// 娣诲姞璁惧鍒颁簯绔� + /// <paramref name="devSerial"/>璁惧搴忓垪鍙�</param> /// </summary> - public void SkipAddDeviceActivity( ) + public void SkipAddDeviceActivity(string devSerial) { + if (string.IsNullOrEmpty(devSerial)) return; + new System.Threading.Thread(() => + { + var list = VideDoorLockSend.Current.GetVideoDoorLockDeviceList(SPK.VideoDoorLock); + if (list.Count > 0) + { + var function = list.Find((o) => o.sid == devSerial); + if (function != null) + { + this.SaveFunctionFile(function); + } + } + }) + { IsBackground = true }.Start(); //鏈疄鐜� #if __IOS__ @@ -40,9 +57,8 @@ #endif } - /// <summary> - /// 璺宠浆鍒癆ndroid(瀹炴椂瑙嗛)閭h竟鍘� + /// 鎵撳紑瀹炴椂瑙嗛鐢婚潰 /// </summary> /// <param name="deviceSerial">璁惧搴忓垪鍙�</param> /// <param name="deviceId">璁惧id(浜戠涓奷eviceId)</param> @@ -62,21 +78,121 @@ //jumpToEZRealPlayActivity(Shared.Application.Activity, deviceId, deviceSerial, spk) } /// <summary> - /// 璺宠浆鍒癆ndroid(鍘嗗彶璁板綍)閭h竟鍘� + /// 娴忚鍘嗗彶璁板綍 /// </summary> public void SkipRecordActivity() { //鏈疄鐜� + //this.InitializationAndroidData(); + // } /// <summary> - /// 璺宠浆鍒癆ndroid(涓存椂瀵嗙爜)閭h竟鍘� + /// 涓存椂瀵嗙爜寮�闂� /// </summary> public void SkipPSWActivity() { //jumpTempPasswordActivity(Application.Activity, deviceId); } + + /// <summary> + /// 鍒濆鍖栬悿鐭砈DK(瀹為檯灏辨槸浼犲弬鏁�,澶氭璋冪敤涔熸病鏈夊奖鍝�) + /// </summary> + public void InitializationAndroidData(Action<bool> action) + { + bool isBool = true; + this.SunThread(() => + { + try + { + //鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken + var ezChildAccessToken = VideDoorLockSend.Current.GetEZGetChildToken(); + this.MainThread(() => + { + if (string.IsNullOrEmpty(ezChildAccessToken)) + { + //Token + isBool = false; + return; + } + Application.RunOnMainThread(() => + { +#if __IOS__ + //iOS + //鍒濆鍖栬悿鐭充簯SDK锛屼腑鏂囧浗鍐卥ey銆佽嫳鏂囨捣澶杒ey 寮�鍙戣�呰处鍙蜂娇鐢ㄥ簲鐢ㄥ寘鍚嶇敵璇风殑APPKEY锛屼笉鍚屽寘鍚嶅簲鐢ㄩ渶閰嶇疆涓嶅悓鐨凙PPKEY + EZSDK.IOS.EZSDK.SharedInstance().InitLibWithAppKey("1aa98a90489b4838b966b57018b4b04b", "1aa98a90489b4838b966b57018b4b04b"); + //1.璁剧疆鎵�闇�娌充笢鐨凙ccessToken鍜孯efreshToken銆佸煙鍚嶅湴鍧� + EZSDK.IOS.EZSDK.SharedInstance().SetHDlAccessToken(UserVideoDoorLockInfo.Current.LoginTokenString, UserVideoDoorLockInfo.Current.RefreshToken); + EZSDK.IOS.EZSDK.SharedInstance().SetRequestHttpsHostAndPlatform(OnAppConfig.Instance.RequestHttpsHost, 1, DB_ResidenceData.Instance.CurrentRegion.id); + //2.璁剧疆钀ょ煶瀛愯处鍙风殑AccessToken鍒癝DK + EZSDK.IOS.EZSDK.SharedInstance().SetEZAccessToken(ezChildAccessToken); + ////3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈� + EZSDK.IOS.EZSDK.SharedInstance().Go2EZvizMonitor(); + //EZSDK.IOS.EZDeviceInfo info = new EZSDK.IOS.EZDeviceInfo(); + //info.de + //EZSDK.IOS.EZSDK.Play(info); +#else + //Android + //1.璁剧疆鎵�闇�娌充笢鐨則oken銆佸煙鍚嶅湴鍧� + //2.璁剧疆钀ょ煶瀛愯处鍙风殑token + //3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈� + ((BaseActivity)Shared.Application.Activity).SetCamera(b => + { + if (b) + { + ((BaseActivity)Shared.Application.Activity).SetPermission(result => + { + if (result) + { + Android.Content.Intent intent = new Android.Content.Intent(); + var bundle = new Android.OS.Bundle(); + //浼犻�抧ame鍙傛暟涓簍inyphp + bundle.PutString("EzChildAccessToken", ezChildAccessToken); + bundle.PutString("HdlToken", UserInfo.Current.LoginTokenString); + bundle.PutString("HdlrefreshToken", UserInfo.Current.RefreshToken); + bundle.PutString("Url", OnAppConfig.Instance.RequestHttpsHost); + bundle.PutString("EzvizAppKey", "1aa98a90489b4838b966b57018b4b04b"); + bundle.PutInt("Platform", 1); + bundle.PutString("HomeId", DB_ResidenceData.Instance.CurrentRegion.id); + intent.PutExtras(bundle); + //intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity")); + //Shared.Application.Activity.StartActivity(intent); + } + }, "android.permission.RECORD_AUDIO"); + + } + }); +#endif + }); + + }); + + } + catch (Exception e) + { + } + finally + { + this.MainThread(() => + { + action?.Invoke(isBool); + }); + } + }); + } + /// <summary> + /// 鏇存崲浣忓畢 + /// </summary> + /// <param name="home">瀵硅薄</param> + public void ChangeCurrHome(RegionInfoRes home) + { + if (DB_ResidenceData.Instance.CurrentRegion.id == home.id || string.IsNullOrEmpty(home.id)) return; + + } + #endregion + /// <summary> /// 钀ょ煶瑙嗛闂ㄩ攣鐨勫浘鏍� + /// <param name="comerom">鏉ヨ嚜閭i噷</param> /// </summary> public string GetVideoDoorLockIcon(Comerom comerom) { @@ -90,6 +206,7 @@ } } + #region --------- 鍔熻兘鏂囦欢淇濆瓨锛屽垹闄� -------- /// <summary> /// 淇濆瓨鏈湴鏂囦欢 /// </summary> @@ -113,47 +230,35 @@ FunctionList.List.DeleteFunction(function); MainPage.Log($"鏂囦欢鍒犻櫎->{function.name}-->{function.spk}"); } + #endregion /// <summary> - /// 闂儊妗� + /// 鑾峰彇Loading瀵硅薄 /// </summary> - /// <param name="frame">鐖惰鍥�</param> - /// <param name="tipText">鎻愮ず鏂囨湰</param> - /// <param name="closeTime">鏄剧ず鏃堕棿,榛樿鏄�1s</param> - public void ShowTip(FrameLayout frame, string tipText, int closeTime = 1) + /// <returns></returns> + public Loading Loading { - Application.RunOnMainThread(() => + get { - new Tip() + if (loading == null) { - CloseTime = closeTime, - Text = tipText, - Direction = AMPopTipDirection.None, - }.Show(frame); - }); - } + loading = new Loading(); + } + if (MainPage.BasePageView.ChildrenCount < 1) + { + return loading; + } + View view = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1); + if (view is FrameLayout) + { + ((FrameLayout)view).AddChidren(loading); + } + else if (view is PageLayout) + { + ((PageLayout)view).AddChidren(loading); + } + return loading; + } - - - /// <summary> - /// 淇℃伅鎻愮ず绐楀彛锛岃嚜鍔ㄥ叧闂� - /// </summary> - /// <param name="msg">鎻愮ず閿欒鏂囨湰</param> - public void ShowTip(string msg, int time = 2) - { - Application.RunOnMainThread(() => - { - new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000); - }); - } - /// <summary> - /// 瀵硅瘽妗� - /// </summary> - public void ShowAlert() - { - Application.RunOnMainThread(() => - { - new Alert("", "瑙嗛闂ㄩ攣涓�", "鍙栨秷", "纭畾").Show(); - }); } /// <summary> /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鍒楄〃 @@ -168,7 +273,90 @@ #endif return list; } + #region ---------鑷畾涔夌嚎绋�(瀛愮嚎绋嬶紝涓荤嚎绋�)-------- + /// <summary> + /// 瀛愮嚎绋� + /// </summary> + /// <paramref name="tipType"/>鏄惁瑕佹彁绀洪敊璇俊鎭�(榛樿鏄剧ず)<paramref> + /// <param name="action"></param> + public void SunThread(Action action, TipType tipType = TipType.confirmation) + { + new System.Threading.Thread(() => + { + try + { + action?.Invoke(); + } + catch (Exception e) + { + this.ShowAlert(e, tipType); + } + }) + { IsBackground = true }.Start(); + } + /// <summary> + /// 涓荤嚎绋�(UI鏇存柊) + /// </summary> + /// <paramref name="tipType"/>鏄惁瑕佹彁绀洪敊璇俊鎭�(榛樿鏄剧ず)<paramref> + /// <param name="action"></param> + public void MainThread(Action action, TipType tipType = TipType.confirmation) + { + Application.RunOnMainThread(() => + { + try + { + action?.Invoke(); + } + catch (Exception e) + { + this.ShowAlert(e, tipType); + } + }); + + } + #endregion + #region --------- 鎻愮ず妗嗭紝纭妗� -------- + /// <summary> + /// 瀵硅瘽妗�(鍙绋嬪簭鎶ラ敊鐨勬椂鍊欐墠鐢ㄥ埌) + /// </summary> + /// <paramref name="e"/>寮傚父瀵硅薄<paramref> + /// <paramref name="tipType"/>鏄惁瑕佹彁绀洪敊璇俊鎭�(榛樿鏄剧ず)<paramref> + private void ShowAlert(Exception e, TipType tipType) + { + + if (tipType != TipType.confirmation) + { + return; + } + Application.RunOnMainThread(() => + { + string msg = e.Message + "\r\n" + e.StackTrace; + Alert alert = new Alert("鎶辨瓑绋嬪簭鍑洪敊浜�.", "鎸塡"纭畾\"鑳借幏鍙栨洿璇︾粏鐨勯敊璇俊鎭�.", "鍙栨秷", "纭畾"); + alert.Show(); + alert.ResultEventHandler += (alerts, isBool) => + { + alert.Dismiss(); + if (isBool) + { + StackTraceLog stackTraceLog = new StackTraceLog(msg); + stackTraceLog.Show(); + } + }; + }); + } + /// <summary> + /// 淇℃伅鎻愮ず绐楀彛锛岃嚜鍔ㄥ叧闂� + /// </summary> + /// <param name="msg">鎻愮ず閿欒鏂囨湰</param> + public void ShowTip(string msg, int time = 2) + { + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000); + }); + } + #endregion /// <summary> /// 寮规绫诲瀷 /// </summary> @@ -186,6 +374,7 @@ function,//鍔熻兘 collect,//鏀惰棌 room,//鎴块棿 + push,//鎺ㄩ�� } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs index 686afe8..5aa77bb 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs @@ -7,9 +7,9 @@ } /// <summary> - /// 鐢ㄦ埛淇℃伅(钀ょ煶瑙嗛闂ㄩ攣) + /// 鐢ㄦ埛淇℃伅(钀ょ煶瑙嗛闂ㄩ攣) /// </summary> - public class UserInfo + public class UserVideoDoorLockInfo { /// <summary> /// 鐢ㄦ埛id diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs new file mode 100644 index 0000000..05ad631 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs @@ -0,0 +1,58 @@ +锘縰sing System; +using HDL_ON.UI.CSS; +using HDL_ON.UI.Music; +using Shared; + +namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock +{ + public class StackTraceLog + { + /// <summary> + /// 鍫嗗彔璺熻釜鏃ュ織 + /// </summary> + public string msg; + + public StackTraceLog(string msg) + { + this.msg = msg; + } + public void Show() + { + + Dialog dialog = new Dialog() + { + BackgroundColor = CSS_Color.textWhiteColor, + }; + dialog.Show(); + TopView topView = new TopView(); + topView.topNameBtn.Text="閿欒鏃ュ織淇℃伅"; + dialog.AddChidren(topView.TopFLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (sen, e) => + { + dialog.Close(); + }; + + var middleFl = new FrameLayout + { + Y = topView.fLayout.Bottom, + Height = Application.GetRealHeight(H_W.H - H_W.T_Height), + }; + dialog.AddChidren(middleFl); + + Button btnLogText = new Button + { + //TextSize = TextSize.Text14, + TextColor = MusicColor.Text18Color, + Width = Application.GetRealWidth(H_W.W - 16 - 16), + Height = middleFl.Height, + X = Application.GetRealWidth(16), + Text = this.msg, + TextAlignment = TextAlignment.TopLeft, + IsMoreLines = true, + }; + middleFl.AddChidren(btnLogText); + + + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs index 223108b..fe1a0f0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs @@ -36,7 +36,8 @@ /// </summary> /// <param name="function">褰撳墠鐨勮澶�</param> /// <param name="action">鍥炶皟缁撴灉</param> - public void DelDevice(Function function, Action<bool> action) + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> + public void DelDevice(Function function, Action<bool> action, TipType tipType = TipType.flicker) { new Thread(() => { @@ -47,7 +48,7 @@ d.Add("deviceSerial", function.sid);//绛夊悓闂ㄩ攣搴忓垪鍙� d.Add("platform", 1);//骞冲彴 var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_DeleteDevice, "鍒犻櫎钀ょ煶闂ㄩ攣璁惧"); - if (!this.DataChecking(responsePackNew)) + if (!this.DataChecking(responsePackNew, tipType)) { return; } @@ -68,6 +69,7 @@ /// 鑾峰彇闂ㄩ攣鐘舵��(钀ょ煶瑙嗛闂ㄩ攣) /// </summary> /// <param name="function">褰撳墠鐨勮澶�</param> + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> public VideoDoorLockInfo GetVideoDoorLockState(Function function, TipType tipType = TipType.flicker) { @@ -76,7 +78,7 @@ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceId", function.deviceId); var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_Lockstatus, "鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鐘舵��"); - if (!this.DataChecking(responsePackNew)) + if (!this.DataChecking(responsePackNew,tipType)) { return new VideoDoorLockInfo(); } @@ -95,6 +97,7 @@ /// 鑾峰彇鐢垫睜鐢甸噺(钀ょ煶瑙嗛闂ㄩ攣) /// </summary> /// <param name="function">褰撳墠鐨勮澶�</param> + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> public CellInfo GetCellValue(Function function, TipType tipType = TipType.flicker) { @@ -102,7 +105,7 @@ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceId", function.deviceId); var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_Details, "鑾峰彇钀ょ煶闂ㄩ攣璁惧鐢甸噺"); - if (!this.DataChecking(responsePackNew)) + if (!this.DataChecking(responsePackNew,tipType)) { return new CellInfo(); } @@ -119,21 +122,22 @@ /// 鑾峰彇闂ㄩ攣鐢ㄦ埛鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣) /// </summary> /// <param name="function">褰撳墠鐨勮澶�</param> - /// /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> - public List<UserInfo> GetVideoDoorLockUserListInfo(Function function, TipType tipType = TipType.flicker) + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> + /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> + public List<UserVideoDoorLockInfo> GetVideoDoorLockUserListInfo(Function function, TipType tipType = TipType.flicker) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceId", function.deviceId); var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_UserList, "鑾峰彇钀ょ煶闂ㄩ攣鐢ㄦ埛鍒楄〃"); - if (!this.DataChecking(responsePackNew)) + if (!this.DataChecking(responsePackNew, tipType)) { - return new List<UserInfo>(); + return new List<UserVideoDoorLockInfo>(); } - var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserInfo>>(responsePackNew.Data.ToString()); + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserVideoDoorLockInfo>>(responsePackNew.Data.ToString()); if (list == null) { - return new List<UserInfo>(); + return new List<UserVideoDoorLockInfo>(); } return list; } @@ -141,15 +145,16 @@ /// 鑾峰彇闂ㄩ攣璁惧鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣) /// </summary> /// <param name="spk">鎸囧畾spk鑾峰彇</param> - /// <returns></returns> - public List<Function> GetVideoDoorLockDeviceList(string spk) + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> + /// <returns>杩斿洖缁撴灉涓嶄細涓簄ull</returns> + public List<Function> GetVideoDoorLockDeviceList(string spk, TipType tipType = TipType.flicker) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("spk", spk); var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_UserList, "鑾峰彇钀ょ煶闂ㄩ攣璁惧鍒楄〃"); - if (!this.DataChecking(responsePackNew)) + if (!this.DataChecking(responsePackNew, tipType)) { return new List<Function>(); } @@ -161,12 +166,26 @@ return list; } /// <summary> + /// 鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken + /// </summary> + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> + public string GetEZGetChildToken(TipType tipType = TipType.flicker) + { + //鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken + var responsePackNew = new HttpServerRequest().EZGetChildToken(); + if (!this.DataChecking(responsePackNew, tipType)) + { + return ""; + } + return responsePackNew.Data.ToString(); + } + /// <summary> /// 妫�楠屾暟鎹洖澶嶆垚鍔熸垨鑰呭け璐� /// </summary> /// <param name="responsePackNew">鍥炲鏁版嵁瀵硅薄</param> - /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> + /// <param name="tipType">鏄惁闇�瑕佹彁绀�</param> /// <returns></returns> - private bool DataChecking(ResponsePackNew responsePackNew, TipType tipType = TipType.flicker) + private bool DataChecking(ResponsePackNew responsePackNew, TipType tipType) { if (responsePackNew.Data == null || responsePackNew.Code != "0" || responsePackNew.Data.ToString() == "") { @@ -175,14 +194,17 @@ if (responsePackNew == null) { responsePackNew = new ResponsePackNew { message = "娌″洖澶�,璇风‘璁ょ綉缁滄槸鍚︽甯�.", Code = "-1", }; - } - //new Tip() - //{ - // CloseTime = 1, - // Text = responsePackNew.message + "(" + responsePackNew.Code + ")", - // Direction = AMPopTipDirection.None, - //}.Show(MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1)); + Application.RunOnMainThread(() => + { + //new Tip() + //{ + // CloseTime = 1, + // Text = responsePackNew.message + "(" + responsePackNew.Code + ")", + // Direction = AMPopTipDirection.None, + //}.Show(MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1)); + CommonMethod.Current.ShowTip(responsePackNew.message + "(" + responsePackNew.Code + ")"); + }); } return false; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs index d324778..087a854 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs @@ -76,7 +76,7 @@ /// <summary> /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰 /// </summary> - private UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom Comerom; + private CommonMethod.Comerom comerom; /// <summary> /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟 /// </summary> @@ -90,12 +90,12 @@ /// <param name="function">璁惧</param> /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢</param> /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢</param> - public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom comerom, Action action) + public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, CommonMethod.Comerom comerom, Action action) { this.device = function; this.btnDeviceName = btnDeviceName; this.btnRoomName = btnRoomName; - this.Comerom = comerom; + this.comerom = comerom; this.action = action; } @@ -108,8 +108,6 @@ this.EventListener(); //璇诲彇鏁版嵁 this.ReadData(); - - } @@ -277,8 +275,6 @@ this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); - - }; //璁剧疆 this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) => @@ -336,16 +332,14 @@ /// </summary> private void ReadData() { - Loading loading = new Loading(); - this.AddChidren(loading); - loading.Start(); - new System.Threading.Thread(() => + CommonMethod.Current.Loading.Start(); + CommonMethod.Current.SunThread(() => { try { - var videoDoorLockInfo = UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockState(this.device); - var cellInfo = UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetCellValue(this.device); - Application.RunOnMainThread(() => + var videoDoorLockInfo = VideDoorLockSend.Current.GetVideoDoorLockState(this.device); + var cellInfo = VideDoorLockSend.Current.GetCellValue(this.device); + CommonMethod.Current.MainThread(() => { //this.cellDiyArcSeekBar.Progress = i; //鏇存柊鐢甸噺鍊� @@ -358,11 +352,10 @@ { Application.RunOnMainThread(() => { - loading.Hide(); + CommonMethod.Current.Loading.Hide(); }); } - }) - { IsBackground = true }.Start(); + }); } /// <summary> -- Gitblit v1.8.0