From e66503d70f26a3109fbadf47abcb8ba31d619e3c Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 10 三月 2023 16:56:03 +0800 Subject: [PATCH] 2023年03月10日16:56:00 --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs | 46 ++++ HDL-ON_iOS/HDL-ON_iOS.csproj | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 27 ++ HDL_ON/Common/ApiUtlis.cs | 2 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs | 194 +++++++++++++++++++++ HDL_ON/HDL_ON.projitems | 3 HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs | 5 HDL-ON_Android/HDL-ON_Android.csproj | 1 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs | 5 /dev/null | 80 -------- HDL_ON/DAL/Server/NewAPI.cs | 36 ++++ HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png | 0 HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 4 HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png | 0 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs | 25 ++ HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs | 56 ++++++ 17 files changed, 385 insertions(+), 104 deletions(-) diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png new file mode 100644 index 0000000..eeba7ab --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 21024b9..891aed0 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -428,6 +428,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\VideoDoorLockOpen.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\History.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Cell.png" /> + <AndroidAsset Include="Assets\Phone\FunctionIcon\FunctionBg\VideoDoorLockFunctionBg.png" /> </ItemGroup> <ItemGroup> <AndroidResource Include="Resources\values\colors.xml" /> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index c7a31ee..226894e 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1571,6 +1571,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\VideoDoorLockClose.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\VideoDoorLockOpen.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\Cell.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\FunctionBg\VideoDoorLockFunctionBg.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png new file mode 100644 index 0000000..eeba7ab --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/VideoDoorLockFunctionBg.png Binary files differ diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 333788e..d2d8544 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -229,7 +229,7 @@ foreach (var newFunction in deviceList.list) { newFunction.AssembleStatus(); - newFunction.SaveFunctionFile(); + newFunction.SaveFunctionFile(); FunctionList.List.IniFunctionList(newFunction.savePath,true); MainPage.Log($"============璁惧============{iiii++}"); } diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index e7e96bd..4400e7a 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -462,6 +462,42 @@ /// 璁惧娑堟伅瑙勫垯閰嶇疆 /// </summary> public const string Api_Post_DeviceMessageRulesSet = "/home-wisdom/app/device/deviceMessageRulesSet"; + + #endregion + + #region Kaede -- 钀ょ煶瑙嗛闂ㄩ攣鎺ュ彛____________________________ + /// <summary> + /// 鍒犻櫎璁惧锛堣悿鐭宠棰戦棬閿侊級 + /// </summary> + public const string Api_Post_DeleteDevice = "home-wisdom/platform/yingshi/child/deleteDevice"; + /// <summary> + /// 鐢垫睜璇︽儏锛堣悿鐭宠棰戦棬閿侊級 + /// </summary> + public const string Api_Post_Details = "/home-wisdom/platform/yingshi/lock/battery/details"; + /// <summary> + /// 闂ㄩ攣鐢ㄦ埛鍒楄〃锛堣悿鐭宠棰戦棬閿侊級 + /// </summary> + public const string Api_Post_UserList = "/home-wisdom/platform/yingshi/lock/user/list"; + /// <summary> + /// 闂ㄩ攣鐘舵�侊紙钀ょ煶瑙嗛闂ㄩ攣锛� + /// </summary> + public const string Api_Post_Lockstatus = "/home-wisdom/platform/yingshi/lock/status"; + /// <summary> + /// 鑾峰彇鎶ヨ鍒楄〃锛堣悿鐭宠棰戦棬閿侊級 + /// </summary> + public const string Api_Post_Records = "/home-wisdom/platform/yingshi/alarm/records"; + /// <summary> + /// 鍒犻櫎鎶ヨ璁板綍锛堣悿鐭宠棰戦棬閿侊級 + /// </summary> + public const string Api_Post_AlarmDelet= "/home-wisdom/platform/yingshi/alarm/delete"; + /// <summary> + /// 杩滅▼寮�閿侊紙钀ょ煶瑙嗛闂ㄩ攣锛� + /// </summary> + public const string Api_Post_OpenDoor = "/home-wisdom/platform/yingshi/lock/remote/open/door"; + + + + #endregion #region Kaede -- 鍦烘櫙鎺ュ彛____________________________ diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 4018e42..3ddba4a 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -531,7 +531,8 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorLockListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorLockPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\CommonMethod.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\Send.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\ObjectClass.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideDoorLockSend.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index 3e8e461..6ad66c0 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -1061,7 +1061,7 @@ { try { - var faceIDList = Send.Current.GetListHomeFace(device.deviceId,true); + var faceIDList = Send.Current.GetListHomeFace(device.deviceId, true); List<string> faceNameList = new List<string>(); for (int i = 0; i < faceIDList.Count; i++) { @@ -1086,13 +1086,20 @@ }); } catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + }); + } }); } /// <summary> - /// 钀ょ煶瑙嗛闂ㄩ攣涓撶敤(浜岀骇鐣岄潰) + /// 钀ょ煶瑙嗛闂ㄩ攣涓撶敤 /// </summary> /// <param name="frame">褰撳墠鐣岄潰</param> /// <param name="device">褰撳墠璁惧</param> @@ -1107,31 +1114,37 @@ { try { - var userList = Send.Current.GetVideoDoorLockUserIdList(device.deviceId, true); + var userList =FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockUserListInfo(device); List<string> userIdList = new List<string>(); for (int i = 0; i < userList.Count; i++) { var user = userList[i]; - userIdList.Add(user.userName); + userIdList.Add(user.extUserId); } Application.RunOnMainThread(() => { loading.Hide(); - PublicInterface publicInterface = new PublicInterface(); + PublicInterface publicInterface = new PublicInterface();//鐢ㄦ埛鐣岄潰 publicInterface.FrameOrVv(this, userIdList, new List<string> { btnState.Text }, device.name, (index) => { var userId = userIdList[index]; //鐣岄潰鏄剧ず閫変腑鍊� btnState.Text = userId; //鏁版嵁灏佽 - AddDictionary("open_type", "1", "integer"); - AddDictionary("user_id", userId, "string"); + AddDictionary("open_user", userId, "string"); }, false); }); } catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + }); + } }); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 6cf8458..fbf8818 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -463,11 +463,11 @@ } /// <summary> - /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鐢ㄦ埛鍒楄〃 + /// 鑾峰彇浣忓畢宸插綍鍏ヤ汉鑴镐俊鎭� /// </summary> /// <param name="deviceId">鍙瀵硅璁惧id</param> /// <returns></returns> - public List<Face> GetVideoDoorLockUserIdList(string deviceId, bool isTip) + public List<Face> GetHomeFaceList(string deviceId, bool isTip) { var jObject = new JObject(); jObject.Add("homeId", LogicMethod.Current.HomeId); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs index 802c094..fc25046 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs @@ -180,6 +180,11 @@ this.RemoveFromParent(); }; break; + case SPK.VideoDoorLock: { + //璺宠浆鍒癮ndroid閭h竟鍘� + HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.SkipActivity(); + } + break; } }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs index 3c791b7..ff4c689 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs @@ -89,7 +89,7 @@ { new HDL_ON.UI.Music.View.TipView().TipBox(-1, StringId.AreYouSureToDeleteThisDevice, () => { - UI2.FuntionControlView.VideoDoorLock.Send.Currnet.DelDevice(this.function, (isBool) => + UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.DelDevice(this.function, (isBool) => { Application.RunOnMainThread(() => { @@ -104,7 +104,7 @@ return; } //鍒犻櫎鏈湴鏂囦欢 - FunctionList.List.DeleteFunction(this.function); + UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DeleteFunction(this.function); this.RemoveFromParent(); this.actionDel?.Invoke(); }); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs index d61186b..7aed7ce 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs @@ -282,10 +282,11 @@ /// </summary> /// <param name="responsePackNew">鍥炲鏁版嵁瀵硅薄</param> /// <returns></returns> - public bool DataChecking(ResponsePackNew responsePackNew) + private bool DataChecking(ResponsePackNew responsePackNew) { - if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") + if (responsePackNew.Data == null||responsePackNew.Code != "0" || responsePackNew.Data.ToString() == "") { + return false; } return true; diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs index 2abf7ac..ac956de 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs @@ -27,6 +27,13 @@ } /// <summary> + /// 璺宠浆鍒癆ndroid閭h竟鍘� + /// </summary> + public void SkipActivity() + { + //鏈疄鐜� + } + /// <summary> /// 钀ょ煶瑙嗛闂ㄩ攣鐨勫浘鏍� /// </summary> public string GetVideoDoorLockIcon(Comerom comerom) @@ -41,6 +48,31 @@ } } + /// <summary> + /// 淇濆瓨鏈湴鏂囦欢 + /// </summary> + /// <param name="function">褰撳墠璁惧</param> + public void SaveFunctionFile(Function function) + { + if (function == null) return; + function.AssembleStatus(); + function.SaveFunctionFile(); + FunctionList.List.IniFunctionList(function.savePath, true); + MainPage.Log($"鏂囦欢淇濆瓨->{function.name}-->{function.spk}"); + } + + /// <summary> + /// 鍒犻櫎鏈湴鏂囦欢 + /// </summary> + /// <param name="function">褰撳墠璁惧</param> + public void DeleteFunction(Function function) + { + if (function == null) return; + FunctionList.List.DeleteFunction(function); + MainPage.Log($"鏂囦欢鍒犻櫎->{function.name}-->{function.spk}"); + } + + /// <summary> /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鍒楄〃 @@ -50,10 +82,20 @@ { var list = FunctionList.List.GetVideoDoorLockList(); #if DEBUG - list.Add(new Function { name = "瑙嗛闂ㄩ攣涓�", sid = "23456789", spk = SPK.VideoDoorLock }); - list.Add(new Function { name = "瑙嗛闂ㄩ攣浜�", sid = "2345678922", spk = SPK.VideoDoorLock }); + //list.Add(new Function { name = "瑙嗛闂ㄩ攣涓�", sid = "23456789", spk = SPK.VideoDoorLock }); + //list.Add(new Function { name = "瑙嗛闂ㄩ攣浜�", sid = "2345678922", spk = SPK.VideoDoorLock }); #endif return list; } + + /// <summary> + /// 寮规绫诲瀷 + /// </summary> + public enum TipType + { + none,//鏃犳彁绀� + flicker,//闂儊妗� + confirmation//纭妗� + } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs new file mode 100644 index 0000000..6da1bd7 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs @@ -0,0 +1,56 @@ +锘縰sing System; +namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock +{ + public class ObjectClass + { + + + } + /// <summary> + /// 鐢ㄦ埛淇℃伅(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + public class UserInfo + { + /// <summary> + /// 鐢ㄦ埛id + /// </summary> + public string extUserId = string.Empty; + /// <summary> + /// 鐢ㄦ埛鍚嶇О + /// </summary> + public string extUserName = string.Empty; + + } + /// <summary> + /// 闂ㄩ攣鐘舵��(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + public class VideoDoorLockInfo + { + /// <summary> + /// 閿佺姸鎬侊紙lock:閿侊紱unlock:瑙i攣锛� + /// </summary> + public string lockStatus = string.Empty; + /// <summary> + /// 闂ㄧ姸鎬侊紙open锛氬紑锛沜lose锛氬叧锛� + /// </summary> + public string doorStatus = string.Empty; + + } + + /// <summary> + /// 鐢垫睜璇︽儏(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + public class CellInfo + { + /// <summary> + /// 鐢甸噺 + /// </summary> + public string remain = string.Empty; + /// <summary> + /// 鐢垫睜鍚嶇О + /// </summary> + public string name = string.Empty; + + } + +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/Send.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/Send.cs deleted file mode 100644 index 0f57e71..0000000 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/Send.cs +++ /dev/null @@ -1,80 +0,0 @@ -锘縰sing System; -using System.Threading; -using HDL_ON.Entity; - -namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock -{ - public class Send - { - public Send() - { - } - - private static Send send = null; - - public static Send Currnet - { - get - { - if (send == null) - { - send = new Send(); - } - - return send; - } - } - - /// <summary> - /// 瑙g粦璁惧 - /// </summary> - /// <param name="function">褰撳墠鐨勮澶�</param> - /// <param name="action">鍥炶皟缁撴灉</param> - public void DelDevice(Function function, Action<bool> action) - { - new Thread(() => - { - try - { - //HDL_ON.UI.Music.SendMethod.Current.RequestServerhomeId(); - - if (function != null) - { - action?.Invoke(false); - } - } - catch(Exception s) { - } - }) - { IsBackground = true }.Start(); - - } - - - /// <summary> - /// 鑾峰彇鐢垫睜鐢甸噺 - /// </summary> - /// <param name="function">褰撳墠鐨勮澶�</param> - /// <param name="action">鍥炶皟缁撴灉</param> - public void GetCellValue(Function function, Action<int> action) - { - new Thread(() => - { - try - { - //HDL_ON.UI.Music.SendMethod.Current.RequestServerhomeId(); - - if (function != null) - { - action?.Invoke(8); - } - } - catch (Exception s) - { - } - }) - { IsBackground = true }.Start(); - - } - } -} diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs new file mode 100644 index 0000000..3fccd09 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs @@ -0,0 +1,194 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Threading; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using Shared; +using static HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod; + + +namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock +{ + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣鏁版嵁鍙戦�� + /// </summary> + public class VideDoorLockSend + { + + private static VideDoorLockSend send = null; + /// <summary> + /// 鑾峰彇褰撳墠鐨勫璞� + /// </summary> + public static VideDoorLockSend Current + { + get + { + if (send == null) + { + send = new VideDoorLockSend(); + } + + return send; + } + } + /// <summary> + /// 瑙g粦璁惧(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + /// <param name="function">褰撳墠鐨勮澶�</param> + /// <param name="action">鍥炶皟缁撴灉</param> + public void DelDevice(Function function, Action<bool> action) + { + new Thread(() => + { + try + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); + 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)) + { + return; + } + + if (function != null) + { + action?.Invoke(false); + } + } + catch (Exception s) + { + } + }) + { IsBackground = true }.Start(); + + } + /// <summary> + /// 鑾峰彇闂ㄩ攣鐘舵��(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + /// <param name="function">褰撳墠鐨勮澶�</param> + /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> + public VideoDoorLockInfo GetVideoDoorLockState(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_Lockstatus, "鍒犻櫎钀ょ煶瑙嗛闂ㄩ攣鐘舵��"); + if (!this.DataChecking(responsePackNew)) + { + return new VideoDoorLockInfo(); + } + + var videoDoorLockInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<VideoDoorLockInfo>(responsePackNew.Data.ToString()); + if (videoDoorLockInfo == null) + { + return new VideoDoorLockInfo(); + } + return videoDoorLockInfo; + + + + } + /// <summary> + /// 鑾峰彇鐢垫睜鐢甸噺(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + /// <param name="function">褰撳墠鐨勮澶�</param> + /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> + public CellInfo GetCellValue(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_Details, "鑾峰彇钀ょ煶闂ㄩ攣璁惧鐢甸噺"); + if (!this.DataChecking(responsePackNew)) + { + return new CellInfo(); + } + var cellInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<CellInfo>(responsePackNew.Data.ToString()); + if (cellInfo == null) + { + return new CellInfo(); + } + + return cellInfo; + + } + /// <summary> + /// 鑾峰彇闂ㄩ攣鐢ㄦ埛鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + /// <param name="function">褰撳墠鐨勮澶�</param> + /// /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param> + public List<UserInfo> 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)) + { + return new List<UserInfo>(); + } + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserInfo>>(responsePackNew.Data.ToString()); + if (list == null) + { + return new List<UserInfo>(); + } + return list; + } + /// <summary> + /// 鑾峰彇闂ㄩ攣璁惧鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣) + /// </summary> + /// <param name="spk">鎸囧畾spk鑾峰彇</param> + /// <returns></returns> + public List<Function> GetVideoDoorLockDeviceList(string spk) + { + + 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)) + { + return new List<Function>(); + } + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(responsePackNew.Data.ToString()); + if (list == null) + { + return new List<Function>(); + } + return list; + } + /// <summary> + /// 妫�楠屾暟鎹洖澶嶆垚鍔熸垨鑰呭け璐� + /// </summary> + /// <param name="responsePackNew">鍥炲鏁版嵁瀵硅薄</param> + /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> + /// <returns></returns> + private bool DataChecking(ResponsePackNew responsePackNew, TipType tipType = TipType.flicker) + { + if (responsePackNew.Data == null || responsePackNew.Code != "0" || responsePackNew.Data.ToString() == "") + { + if (TipType.flicker == tipType) + { + 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)); + } + return false; + } + return true; + } + + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs index 1a58e4d..6e73d35 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs @@ -339,23 +339,34 @@ /// </summary> private void ReadData() { + Loading loading = new Loading(); + this.AddChidren(loading); + loading.Start(); new System.Threading.Thread(() => { - HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.Send.Currnet.GetCellValue(this.device, (value) => + try { + var videoDoorLockInfo = UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockState(this.device); + var cellInfo =UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetCellValue(this.device); Application.RunOnMainThread(() => { //this.cellDiyArcSeekBar.Progress = i; //鏇存柊鐢甸噺鍊� - this.btnCell.Text = value + "%"; + this.btnCell.Text = cellInfo.remain + "%"; + this.btnDoorLockIcon.IsSelected = videoDoorLockInfo.doorStatus == "open"; }); - - }); - + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + }); + } }) - { IsBackground = true }.Start(); + { IsBackground = true }.Start() ; } - } /// <summary> /// 鑷繁寮勪竴涓狥rameLayout -- Gitblit v1.8.0