From 462c27c1d2618db2fa383a094afeeb0f8622fdee Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 06 三月 2023 19:11:17 +0800 Subject: [PATCH] 2023年03月06日19:11:01 --- HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 8 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs | 54 +++ HDL-ON_Android/Assets/Language.ini | 35 + HDL_ON/UI/UI2/UserPage.cs | 3 HDL_ON/UI/UI2/2-Classification/RoomPage.cs | 1 HDL_ON/Entity/DB_ResidenceData.cs | 4 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 32 + HDL_ON/HDL_ON.projitems | 4 HDL_ON/Entity/FunctionList.cs | 9 HDL-ON_iOS/Resources/Language.ini | 27 + HDL_ON/Entity/Function/Function.cs | 16 HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 4 HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs | 2 HDL_ON/Entity/Enumerative/MyEnum.cs | 4 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs | 242 +++++++++++++ HDL_ON/UI/UI2/FuntionControlView/Music/View/SizeClass.cs | 85 ++-- HDL_ON/Common/R.cs | 49 ++ HDL_ON/DAL/DriverLayer/Control.cs | 114 +++-- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs | 360 ++++++++++++++++++++ 19 files changed, 941 insertions(+), 112 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 696bd27..10b365a 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -1110,7 +1110,7 @@ 7155=Distress/Normal 7156=Distress 7157=whether to unlock -7158=is +7158=Is 7159=Fall in the alarm 7160=Someone called the police 7161=Warning tone @@ -1118,9 +1118,20 @@ 7163=Video call 7164=Manipulator 7165=Area intrusion alarm -7166=camera -7167=main switch +7166=Camera +7167=Main switch 7168=PM10 + +8501=Video door lock +8502=Electric quantity +8503=The door is now closed +8504=The door is not closed +8505=RVC +8506=One click to open the lock +8507=Temporary password +8508=History +8509=Fluorite video door lock + @@ -2348,6 +2359,24 @@ 7168=PM10 +8501=瑙嗛闂ㄩ攣 +8502=鐢甸噺 +8503=褰撳墠闂ㄥ凡鍏� +8504=褰撳墠闂ㄦ湭鍏� +8505=瀹炴椂瑙嗛 +8506=涓�閿紑閿� +8507=涓存椂瀵嗙爜 +8508=鍘嗗彶璁板綍 +8509=钀ょ煶瑙嗛闂ㄩ攣 + + + + + + + + + 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 60578a8..6fa2769 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -1110,7 +1110,7 @@ 7155=Distress/Normal 7156=Distress 7157=whether to unlock -7158=is +7158=Is 7159=Fall in the alarm 7160=Someone called the police 7161=Warning tone @@ -1118,9 +1118,20 @@ 7163=Video call 7164=Manipulator 7165=Area intrusion alarm -7166=camera -7167=main switch +7166=Camera +7167=Main switch 7168=PM10 + +8501=Video door lock +8502=Electric quantity +8503=The door is now closed +8504=The door is not closed +8505=RVC +8506=One click to open the lock +8507=Temporary password +8508=History +8509=Fluorite video door lock + @@ -2348,6 +2359,16 @@ 7167=鎬绘帶寮�鍏� 7168=PM10 +8501=瑙嗛闂ㄩ攣 +8502=鐢甸噺 +8503=褰撳墠闂ㄥ凡鍏� +8504=褰撳墠闂ㄦ湭鍏� +8505=瀹炴椂瑙嗛 +8506=涓�閿紑閿� +8507=涓存椂瀵嗙爜 +8508=鍘嗗彶璁板綍 +8509=钀ょ煶瑙嗛闂ㄩ攣 + diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index b8519cc..7e139ca 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -2002,11 +2002,11 @@ /// <summary> /// 寰簭寰幆 /// </summary> - public const int orderMode =5048; + public const int orderMode = 5048; /// <summary> /// 鍗曟洸鎾斁 /// </summary> - public const int single =5049; + public const int single = 5049; @@ -3062,7 +3062,50 @@ /// <summary> /// PM210 /// </summary> - public const int pm10= 7168; + public const int pm10 = 7168; + + /// <summary> + /// 瑙嗛闂ㄩ攣 + /// </summary> + public const int shipinmensuo = 8501; + /// <summary> + /// 鐢甸噺 + /// </summary> + public const int dianliang = 8502; + /// <summary> + /// 褰撳墠闂ㄥ凡鍏� + /// </summary> + public const int dangqianmenyiguan = 8503; + /// <summary> + /// 褰撳墠闂ㄦ湭鍏� + /// </summary> + public const int dangqianmenweiguan = 8504; + /// <summary> + /// 瀹炴椂瑙嗛 + /// </summary> + public const int shishishipin = 8505; + /// <summary> + /// 涓�閿紑閿� + /// </summary> + public const int yijiankaisuo = 8506; + /// <summary> + /// 涓存椂瀵嗙爜 + /// </summary> + public const int linshimima1 = 8507; + /// <summary> + /// 鍘嗗彶璁板綍 + /// </summary> + public const int lishijilu = 8508; + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣 + /// </summary> + public const int yingshishipinmensuo = 8509; + + + + + + diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index f464f05..5f1b11b 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -83,8 +83,10 @@ /// <summary> /// 鍒ゆ柇鏄惁鏈湴鍔犲瘑骞朵笖鍔犲瘑key涓嶄负绌� /// </summary> - public bool IsLocalEncryptAndGetAesKey { - get { + public bool IsLocalEncryptAndGetAesKey + { + get + { return IsLocalEncrypt && (!string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.localSecret)); } } @@ -139,7 +141,7 @@ if (_GatewayOnline_Cloud != value) { _GatewayOnline_Cloud = value; - if(GatewayOnline_Local) + if (GatewayOnline_Local) { return; } @@ -249,7 +251,7 @@ public void SearchLoaclGateway() { //2021-01-15 : 浣忓畢娌℃湁缁戝畾缃戝叧鐨勬椂鍊欎笉鐢ㄦ悳绱紝骞朵笖涓嶈兘閾炬帴mqtt - if(DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId)) + if (DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId)) { return; } @@ -308,9 +310,10 @@ /// </summary> public void LoginGateway() { - if(loginGatewayThread== null) + if (loginGatewayThread == null) { - loginGatewayThread = new System.Threading.Thread(() => { + loginGatewayThread = new System.Threading.Thread(() => + { while (!Ins.myTcpClient.isConnected) { if (Ins.GatewayOnline_Local && myTcpClient.isConnected) @@ -337,7 +340,8 @@ try { loginGatewayThread?.Abort(); - }catch (Exception ex) + } + catch (Exception ex) { MainPage.Log($"閲嶅惎鐧诲綍缃戝叧绾跨▼寮傚父:{ex.Message}"); } @@ -347,7 +351,7 @@ LoginGateway(); } } - + } @@ -357,9 +361,9 @@ public void ControlScene(Scene scene) { //浣撻獙妯″紡 - if(MainPage.NoLoginMode) + if (MainPage.NoLoginMode) { - foreach(var sceneFunction in scene.functions) + foreach (var sceneFunction in scene.functions) { var revString = ""; var upDataObj = new AlinkFunctionStatusObj(); @@ -406,7 +410,7 @@ /// <param name="function"></param> /// <param name="useRemote">鏄惁鐩存帴浣跨敤杩滅▼鍙戦��</param> /// <returns></returns> - public bool SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false,int resend = 3) + public bool SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false, int resend = 3) { function.controlCounter++; function.refreshTime = DateTime.Now; @@ -504,7 +508,7 @@ var functionControlDataObj = function.GetGatewayAlinkControlData(commandDictionary); var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson); - new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id,resend); + new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, resend); MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); } } @@ -522,7 +526,7 @@ commandDictionary.Add(FunctionAttributeKey.OnOff, commandDictionary[FunctionAttributeKey.Brightness] == "0" ? "off" : "on"); } } - if(function.spk == SPK.LightCCT) + if (function.spk == SPK.LightCCT) { if (!commandDictionary.ContainsKey(FunctionAttributeKey.CCT)) { @@ -546,10 +550,10 @@ /// <summary> /// 鍏ㄥ紑鍏ㄥ叧鍔熻兘 /// </summary> - public void SwtichFunctions(bool open,List<Function> functions) + public void SwtichFunctions(bool open, List<Function> functions) { //dome妯″紡鎺у埗 - if(MainPage.NoLoginMode) + if (MainPage.NoLoginMode) { new System.Threading.Thread(() => { @@ -557,7 +561,7 @@ { Dictionary<string, string> d1 = new Dictionary<string, string>(); d1.Add(FunctionAttributeKey.OnOff, open ? "on" : "off"); - if (function.spk == SPK.PanelSocket) + if (function.spk == SPK.PanelSocket) { if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null) { @@ -623,16 +627,16 @@ { var pm = new DAL.Server.HttpServerRequest(); var pack = pm.GetDeviceInfoList(functionIds); - if(pack!= null&& pack.Data!=null) + if (pack != null && pack.Data != null) { //寰呮祴璇�2021-03-04 var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlinkStatusData>>(pack.Data.ToString()); - if(ddd!= null) + if (ddd != null) { - foreach(var function in ddd) + foreach (var function in ddd) { var temp = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == function.deviceId); - if(temp!= null) + if (temp != null) { if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(temp.spk)) { @@ -648,7 +652,7 @@ /// 鍙戦�佽鍙栧懡浠� /// 鑷姩鍒ゆ柇鏄惁涓篈鍗忚璁惧 /// </summary> - public void SendReadCommand(Function function ,bool forceRemote = false) + public void SendReadCommand(Function function, bool forceRemote = false) { function.refreshTime = DateTime.Now; if (forceRemote) @@ -732,7 +736,7 @@ { busClient.ReadBusData(function); } - + } catch (Exception ex) { @@ -776,7 +780,7 @@ /// <summary> /// 瀹夐槻鎺у埗 /// </summary> - public void ControlSecurity(SecurityAlarm securityAlarm,string state) + public void ControlSecurity(SecurityAlarm securityAlarm, string state) { if (!Ins.GatewayOnline_Local)//缃戝叧鏈湴涓嶅湪绾� { @@ -834,7 +838,7 @@ }; var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData); var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlScene, aLinkJson); - new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id,0); + new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id, 0); } } @@ -928,10 +932,10 @@ /// 杞崲鎺ユ敹鍒扮殑鏁版嵁 /// </summary> /// <returns></returns> - public void ConvertReceiveData(byte[] receiveBytes,string ip) + public void ConvertReceiveData(byte[] receiveBytes, string ip) { var reString = Encoding.UTF8.GetString(receiveBytes); - AnalysisReceiveData(reString, receiveBytes,ip); + AnalysisReceiveData(reString, receiveBytes, ip); } /// <summary> /// 杞崲鎺ユ敹鍒扮殑鏁版嵁 @@ -939,7 +943,7 @@ /// <param name="receiveString">杞琒tring鍚庣殑鏁版嵁</param> /// <param name="originalReceiveBytes"鍘熷Bytes鏁版嵁</param> /// <returns></returns> - public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes , string sIp = null) + public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes, string sIp = null) { LocalCommunicationData receiveObj = new LocalCommunicationData(); @@ -1118,7 +1122,8 @@ MainPage.Log($"瀹夐槻灞�鍩熺綉寮傚父锛歿ex.Message}"); } } - else if (receiveObj.Topic == $"/user/{GatewayId}/custom/gateway/login_reply") { + else if (receiveObj.Topic == $"/user/{GatewayId}/custom/gateway/login_reply") + { var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(receiveObj.BodyDataString); if (temp.GetValue("objects").ToString().Contains("success")) { @@ -1161,7 +1166,7 @@ } else { - if(processedDataList.Count> 50) + if (processedDataList.Count > 50) { processedDataList.RemoveAt(0); } @@ -1175,7 +1180,7 @@ /// A鍗忚鏁版嵁 /// </summary> /// <param name="updateBytes"></param> - public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false) + public void UpdataFunctionStatus(string revString, byte[] usefulBytes, bool isCloudData = false) { ////test 浜戠杩炴帴鎴愬姛鏃讹紝涓嶉�傜敤鏈湴鏁版嵁鏇存柊 //if (Ins.GatewayOnline_Cloud && !isCloudData) @@ -1218,7 +1223,7 @@ if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞� { - if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk)) + if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains(localFunction.spk)) { //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�........"); @@ -1226,21 +1231,21 @@ } } - //if (SPK.MusicSpkList().Contains(localFunction.spk)) - //{ - // if (updateTemp.status.Count < 3) - // { - // ///鏄煶涔愬姛鑳界殑 - // ///涓婃姤灞炴�у皯3鏉′笉鍋氬鐞� - // return; - // } - //} - MainPage.Log($"闊充箰鏀跺埌鏁版嵁:{revString}"); + if (SPK.MusicSpkList().Contains(localFunction.spk)) + { + MainPage.Log($"闊充箰鏀跺埌鏁版嵁:{revString}"); + + } foreach (var attr in updateTemp.status) { localFunction.time_stamp = temp.time_stamp; localFunction.SetAttrState(attr.key, attr.value); - Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString); + if (SPK.MusicSpkList().Contains(localFunction.spk)) + { + Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString); + + } + } @@ -1256,7 +1261,7 @@ break; case SPK.AirSwitch: AirSwitchPage.UpdataState(localFunction); - if(localFunction.GetAttribute(FunctionAttributeKey.Power)!=null)//濡傛灉鏄甫鐢甸噺鐨勭┖寮�涔熻鏇存柊鑳芥簮鐣岄潰 + if (localFunction.GetAttribute(FunctionAttributeKey.Power) != null)//濡傛灉鏄甫鐢甸噺鐨勭┖寮�涔熻鏇存柊鑳芥簮鐣岄潰 { EnergyMainPage.UpdataStatus(localFunction); } @@ -1295,7 +1300,7 @@ CurtainModulePage.UpdataState(localFunction); break; case SPK.CurtainDream: - if(localFunction.GetAttrState(FunctionAttributeKey.Percent) == "0") + if (localFunction.GetAttrState(FunctionAttributeKey.Percent) == "0") { localFunction.SetAttrState(FunctionAttributeKey.OnOff, "off"); } @@ -1388,7 +1393,7 @@ case SPK.SensorTemperature: case SPK.SensorHumidity: case SPK.SensorHcho: - if(localFunction.spk == SPK.SensorTemperature) + if (localFunction.spk == SPK.SensorTemperature) { HomePage.LoadEvent_RefreshEnvirIndoorTemp(); } @@ -1490,7 +1495,7 @@ case SPK.AvMusic: case SPK.MusicStandard: //UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp); - Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString); + Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�=======" + revString); //wjc break; case SPK.Inverter: @@ -1524,12 +1529,12 @@ /// <summary> /// //涓�閿紙杩滅▼锛夊紑閿� /// </summary> - public void OneKeyUnlocking(Function doorlock,string extStr) + public void OneKeyUnlocking(Function doorlock, string extStr) { if (Ins.GatewayOnline_Local) { Dictionary<string, string> dic = new Dictionary<string, string>(); - var functionControlDataObj = doorlock.GetGatewayAlinkDoorlockData(UserInfo.Current.ID,extStr); + var functionControlDataObj = doorlock.GetGatewayAlinkDoorlockData(UserInfo.Current.ID, extStr); var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); var sendBytes = Ins.ConvertSendBodyData($"/base/{Control.Ins.GatewayId}/thing/service/doorRemoteOpen/down", functionControlDataJson); new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, 0); @@ -1544,7 +1549,7 @@ /// </summary> /// <param name="functionId"></param> /// <param name="pwd"></param> - public void ConfirmUnlocking(string functionId,string pwd) + public void ConfirmUnlocking(string functionId, string pwd) { Loading loading = new Loading(); MainPage.BaseView.AddChidren(loading); @@ -1580,8 +1585,10 @@ //{ // return false; //} - if (pack.Code != StateCode.SUCCESS) { - Application.RunOnMainThread(() => { + if (pack.Code != StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), pack.message); UserInfo.Current.doorPasswordString = "";// UserInfo.Current.LastTimeOpenDoor = DateTime.MinValue; @@ -1590,8 +1597,9 @@ } if (pack.Code != StateCode.SUCCESS) { - Application.RunOnMainThread(() => { - if(string.IsNullOrEmpty(pack.message)) + Application.RunOnMainThread(() => + { + if (string.IsNullOrEmpty(pack.message)) { new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.OperationFailed)); diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs index 3a0e4ee..207a7dc 100644 --- a/HDL_ON/Entity/DB_ResidenceData.cs +++ b/HDL_ON/Entity/DB_ResidenceData.cs @@ -76,7 +76,9 @@ ShowFunction.Sensor,ShowFunction.VideoIntercom, ShowFunction.SecurityCenter,ShowFunction.Acst, ShowFunction.MechanicalArm , - ShowFunction.SecurityMonitoring,}; + ShowFunction.SecurityMonitoring, + ShowFunction.VideoDoorLock, + }; } return dddd; } diff --git a/HDL_ON/Entity/Enumerative/MyEnum.cs b/HDL_ON/Entity/Enumerative/MyEnum.cs index a02276c..2fb5ccc 100644 --- a/HDL_ON/Entity/Enumerative/MyEnum.cs +++ b/HDL_ON/Entity/Enumerative/MyEnum.cs @@ -185,6 +185,10 @@ /// ip鎽勫儚澶� /// </summary> IpCam = 0x25, + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣 + /// </summary> + VideoDoorLock = 0x26, } diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 87f8863..f453869 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1372,8 +1372,20 @@ list.Add(DoorLock); return list; } - - + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣 + /// </summary> + public const string VideoDoorLock= "钀ょ煶瑙嗛闂ㄩ攣"; + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣spk鍒楄〃 + /// </summary> + /// <returns></returns> + public static List<string> GetVideoDoorLockSPKList() + { + var list = new List<string>(); + list.Add(VideoDoorLock); + return list; + } #region 鐏厜 /// <summary> diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index f21e670..12c46f4 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -148,6 +148,15 @@ var spkList = SPK.GetDoorLockSPKList(); return Functions.FindAll((obj) => spkList.Contains(obj.spk)); } + /// <summary> + /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣 + /// </summary> + /// <returns></returns> + public List<Function> GetVideoDoorLockList() + { + var spkList = SPK.GetVideoDoorLockSPKList(); + return Functions.FindAll((obj) => spkList.Contains(obj.spk)); + } /// <summary> /// 鏂伴鍒楄〃 diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 7f41d93..9b36c79 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -528,6 +528,9 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31UsbMusicList.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\CommonMethod.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31FlieList.cs" /> + <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" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> @@ -555,5 +558,6 @@ <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Light\LightScene\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\FaceManagement\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Acst\" /> + <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index 527e504..f3d4922 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -307,6 +307,14 @@ } #endif break; + case SPK.VideoDoorLock: { + //钀ょ煶瑙嗛闂ㄩ攣 + var form = new VideoDoorLockPage(function, btnName, btnFromFloor, Comerom.room); + MainPage.BasePageView.AddChidren(form); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + form.Show(); + } + break; } }; return eventHandler; diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs index b416038..16f00c6 100644 --- a/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs @@ -379,6 +379,8 @@ } } + + /// <summary> /// 鎶凷DK鐨勶紝鎴戜篃涓嶇煡閬撹繖涓槸浠�涔� /// </summary> diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 04ca7f2..4e1db09 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -745,6 +745,14 @@ functionCount = FunctionList.List.GetAcstParentList().Count; functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; break; + case ShowFunction.VideoDoorLock: + functionCount = FunctionList.List.GetVideoDoorLockList().Count; +#if DEBUG + functionCount = 1; +#endif + functionOnCount = 1; + break; + } @@ -1143,16 +1151,32 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; break; - + case ShowFunction.VideoDoorLock: + //钀ょ煶瑙嗛闂ㄩ攣 + btnName.TextID = StringId.yingshishipinmensuo; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var list = HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.GetVideoDoorLockList(); + var form = new UI2.FuntionControlView.VideoDoorLock.VideoDoorLockListPage(); + form.AddForm(list); + }; + break; } - //鐣岄潰璺宠浆--闊充箰璺宠浆鑷繁鐨勭晫闈�--鐜璺宠浆鑷繁鐨勭晫闈� - if (item != ShowFunction.Music && item != ShowFunction.Environmental && item != ShowFunction.SecurityMonitoring && item != ShowFunction.DoorLock - && ShowFunction.EnergyMonitoring != item && ShowFunction.VideoIntercom != item && ShowFunction.SecurityCenter != item + //鐣岄潰璺宠浆--闊充箰璺宠浆鑷繁鐨勭晫闈�--鐜璺宠浆鑷繁鐨勭晫闈�--(钀ょ煶瑙嗛闂ㄩ攣)璺宠浆鑷繁鐨勭晫闈� + if (item != ShowFunction.VideoDoorLock + && item != ShowFunction.Music + && item != ShowFunction.Environmental + && item != ShowFunction.SecurityMonitoring + && item != ShowFunction.DoorLock + && ShowFunction.EnergyMonitoring != item + && ShowFunction.VideoIntercom != item && + ShowFunction.SecurityCenter != item && ShowFunction.Acst != item) { btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new FunctionPage(); MainPage.BasePageView.AddChidren(skipView); skipView.LoadPage(functionPageTitleId); diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index 08772f9..f15644f 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -186,6 +186,10 @@ { btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/DoorLock.png"; } + else if (function.spk == SPK.VideoDoorLock) + { + btnIcon.UnSelectedImagePath = UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.GetVideoDoorLockIcon; + } else if (function.spk == SPK.HvacCac) { var btnHumidityIcon = new Button() diff --git a/HDL_ON/UI/UI2/2-Classification/RoomPage.cs b/HDL_ON/UI/UI2/2-Classification/RoomPage.cs index ab78fd4..c076ac5 100644 --- a/HDL_ON/UI/UI2/2-Classification/RoomPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/RoomPage.cs @@ -78,6 +78,7 @@ }; bodyView.AddChidren(functionListView); + foreach (var function in room.GetRoomFunctions(false)) { if (MainPage.RoomNotSupportFunctionList.Contains( function.spk)) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/SizeClass.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/SizeClass.cs index e2d5c9d..f0eeb8a 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/SizeClass.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/SizeClass.cs @@ -1,93 +1,94 @@ 锘縰sing System; namespace HDL_ON.UI.Music { - public static class TextSize + public class TextSize { - public static int TopLine = 1; - public static int MiddleLine =1; - public static int DownLine = 1; + public const int TopLine = 1; + public const int MiddleLine = 1; + public const int DownLine = 1; - public static int Text24 = 24; - public static int Text20 = 20; - public static int Text18 = 18; - public static int Text16 = 16; - public static int Text14 = 14; - public static int Text12 = 12; - public static int Text10 = 10; + public const int Text24 = 24; + public const int Text20 = 20; + public const int Text18 = 18; + public const int Text16 = 16; + public const int Text14 = 14; + public const int Text12 = 12; + public const int Text10 = 10; } - public static class MusicColor + public class MusicColor { /// <summary> /// 椤堕儴鑳屾櫙棰滆壊 /// </summary> - public static uint TopViewColor = 0xFFF7F7F7; + public const uint TopViewColor = 0xFFF7F7F7; /// <summary> /// 鐣岄潰鑳屾櫙棰滆壊 /// </summary> - public static uint ViewColor = 0xFFF2F3F7; + public const uint ViewColor = 0xFFF2F3F7; /// <summary> /// 鐧借壊鑳屾櫙棰滆壊 /// </summary> - public static uint WhiteColor = 0xFFFFFFFF; + public const uint WhiteColor = 0xFFFFFFFF; /// <summary> /// 绾㈣壊鑳屾櫙棰滆壊 /// </summary> - public static uint RedColor = 0xFFFF4747; - - /// <summary> - /// 绾挎潯棰滆壊 - /// </summary> - public static uint LineColor =0xFFECEDEE; - /// <summary> - /// 寮圭獥鑳屾櫙棰滆壊 - /// </summary> - public static uint PopupBackgroundColor = 0x90000000; + public const uint RedColor = 0xFFFF4747; /// <summary> /// 绾挎潯棰滆壊 /// </summary> - public static uint MusicEditColor = 0xFFFC9C04; + public const uint LineColor = 0xFFECEDEE; /// <summary> /// 寮圭獥鑳屾櫙棰滆壊 /// </summary> - public static uint MusicDelColor = 0xFFFF7474; + public const uint PopupBackgroundColor = 0x90000000; - public static uint Text18Color = 0xFF1B2D4D; - public static uint MusicTxet14SelectedColor = 0xFF4484F4; - public static uint MusicTxet14Color = 0xFF1B2D4D; - public static uint MusicTxet12SelectedColor = 0xFF4484F4; - - public static uint MusicNoTxetColor = 0xFFC0C7D4; - public static uint TextColor = 0xFF1B2D4D; - public static uint SelectedColor = 0xFF4484F4; + /// <summary> + /// 绾挎潯棰滆壊 + /// </summary> + public const uint MusicEditColor = 0xFFFC9C04; + /// <summary> + /// 寮圭獥鑳屾櫙棰滆壊 + /// </summary> + public const uint MusicDelColor = 0xFFFF7474; - public static uint TextTimeColor = 0xFF798394; + public const uint Text18Color = 0xFF1B2D4D; + public const uint MusicTxet14SelectedColor = 0xFF4484F4; + public const uint MusicTxet14Color = 0xFF1B2D4D; + public const uint MusicTxet12SelectedColor = 0xFF4484F4; - public static uint TextCancelColor = 0xFF798394; + public const uint MusicNoTxetColor = 0xFFC0C7D4; + public const uint TextColor = 0xFF1B2D4D; + public const uint SelectedColor = 0xFF4484F4; + + public const uint TextTimeColor = 0xFF798394; + + public const uint TextCancelColor = 0xFF798394; } - public static class H_W { + public class H_W + { /// <summary> /// app楂樺害 /// </summary> - public static int H = 667; + public const int H = 667; /// <summary> /// app瀹藉害 /// </summary> - public static int W = 375; + public const int W = 375; /// <summary> /// 椤堕儴楂樺害 /// </summary> - public static int T_Height = 64; + public const int T_Height = 64; /// <summary> /// 绾块珮搴� /// </summary> - public static int Line = 1; + public const int Line = 1; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs new file mode 100644 index 0000000..b64ff77 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs @@ -0,0 +1,54 @@ +锘縰sing System; +using HDL_ON.Entity; +using System.Collections.Generic; + +namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock +{ + public class CommonMethod + { + public CommonMethod() + { + } + + private static CommonMethod commonMethod = null; + + public static CommonMethod Current + { + get + { + if (commonMethod == null) + { + commonMethod = new CommonMethod(); + } + + return commonMethod; + + } + + } + /// <summary> + /// 钀ょ煶瑙嗛闂ㄩ攣鐨勫浘鏍� + /// </summary> + public string GetVideoDoorLockIcon{ + get { + + return "FunctionIcon/DoorLock/DoorLock.png"; + + } + } + + /// <summary> + /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鍒楄〃 + /// </summary> + /// <returns></returns> + public List<Function> GetVideoDoorLockList() + { + 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 }); +#endif + return list; + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs new file mode 100644 index 0000000..848166f --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs @@ -0,0 +1,242 @@ +锘縰sing Shared; +using HDL_ON.Stan; +using System; +using System.Collections.Generic; +using System.Text; +using HDL_ON.UI.CSS; +using HDL_ON.Entity; + +namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock +{ + /// <summary> + /// 瑙嗛闂ㄩ攣鍒楄〃鐣岄潰 + /// </summary> + public class VideoDoorLockListPage : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 闂ㄩ攣璁惧鍒楄〃 + /// </summary> + private List<Function> listDevice = new List<Function>(); + /// <summary> + /// 鐢垫睜鎺т欢鍒楄〃(key:璁惧鐨剆id) + /// </summary> + private Dictionary<string, BatteryPersentControl> dicBatteryContr = new Dictionary<string, BatteryPersentControl>(); + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_listDevice">闂ㄩ攣璁惧鍒楄〃</param> + public void ShowForm(List<Function> i_listDevice) + { + this.listDevice.AddRange(i_listDevice); + //鏅鸿兘闂ㄩ攣 + base.SetTitleText(Language.StringByID(StringId.shipinmensuo)); + //鍒濆鍖栧ご閮ㄥ巻鍙茶褰曟帶浠� + //this.InitTopHistoryControl(); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + string nowSelectId = string.Empty; + //妤煎眰涓嬫媺鍥炬爣 + var btnFloor = new NormalViewControl(500, Application.GetRealHeight(16), false); + var btnFloorIcon = new IconViewControl(16); + btnFloorIcon.X = HdlControlResourse.XXLeft; + btnFloorIcon.Y = Application.GetRealHeight(18); + btnFloorIcon.UnSelectedImagePath = "Public/DownIcon.png"; + bodyFrameLayout.AddChidren(btnFloorIcon); + btnFloorIcon.ButtonClickEvent += (sender, e) => + { + //鏄剧ず涓嬫媺鍒楄〃 + var form = new FloorRoomSelectPopupView(); + form.ShowDeviceFunctionView(btnFloor, this.listDevice, (selectId, listFunc) => + { + btnFloor.Width = btnFloor.GetRealWidthByText();//閲嶇疆鏂囨湰瀹藉害 + nowSelectId = selectId; + //閲嶆柊鍒濆鍖栭棬閿佸垪琛ㄦ帶浠� + this.InitDoorListControl(listFunc); + + }, nowSelectId); + }; + //妤煎眰 + btnFloor.X = btnFloorIcon.Right + Application.GetRealWidth(2); + btnFloor.TextColor = CSS_Color.FirstLevelTitleColor; + btnFloor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; + btnFloor.Text = DB_ResidenceData.Instance.CurFloor.roomName; + //btnFloor.Width = btnFloor.GetRealWidthByText(); + bodyFrameLayout.AddChidren(btnFloor); + //璁╁畠鐩稿鍥炬爣灞呬腑 + btnFloor.Y = btnFloorIcon.Y + (btnFloorIcon.Height - btnFloor.Height) / 2; + btnFloor.ButtonClickEvent += (sender, e) => + { + btnFloorIcon.ButtonClickEvent(null, null); + }; + + //鍒楄〃鎺т欢 + this.listView = new VerticalListControl(); + listView.Y = Application.GetRealHeight(53); + listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(53); + bodyFrameLayout.AddChidren(listView); + + //鍒濆鍖栭棬閿佸垪琛ㄦ帶浠� + this.InitDoorListControl(this.listDevice); + } + + #endregion + + #region 鈻� 娣诲姞闂ㄩ攣鎺т欢_______________________ + + /// <summary> + /// 鍒濆鍖栭棬閿佸垪琛ㄦ帶浠� + /// </summary> + private void InitDoorListControl(List<Function> i_listDevice) + { + this.listView.RemoveAll(); + this.dicBatteryContr = new Dictionary<string, BatteryPersentControl>(); + + //鐢熸垚闂ㄩ攣鎺т欢 + foreach (var device in i_listDevice) + { + this.AddDoorControl(device); + } + } + + /// <summary> + /// 娣诲姞闂ㄩ攣鎺т欢 + /// </summary> + /// <param name="i_device">闂ㄩ攣瀵硅薄</param> + private void AddDoorControl(Function i_device) + { + //鐧借壊鑳屾櫙瀹瑰櫒 + var frameBack = new FrameLayoutStatuControl(); + frameBack.Width = Application.GetRealWidth(343); + frameBack.Height = Application.GetRealHeight(96); + frameBack.Radius = (uint)Application.GetRealWidth(12); + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; + this.listView.AddChidren(frameBack); + //闂ㄩ攣鍥炬爣 + var btnIcon = new IconViewControl(32); + btnIcon.X = Application.GetRealWidth(10); + btnIcon.Y = Application.GetRealHeight(15); + btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/DoorLock.png"; + frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent); + //璁惧鍚嶅瓧 + var btnName = new Button(); + btnName.X = btnIcon.Right + Application.GetRealWidth(12); + btnName.Y = Application.GetRealHeight(12); + btnName.Width = Application.GetRealWidth(150); + btnName.Height = Application.GetRealHeight(20); + btnName.TextColor = CSS_Color.FirstLevelTitleColor; + btnName.TextAlignment = TextAlignment.CenterLeft; + btnName.Text = i_device.name; + frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent); + //鎴块棿 + var btnRoom = new Button(); + btnRoom.X = btnName.X; + btnRoom.Y = btnName.Bottom + Application.GetRealHeight(4); + btnRoom.Width = Application.GetRealWidth(150); + btnRoom.Height = Application.GetRealHeight(15); + btnRoom.TextColor = CSS_Color.PromptingColor1; + btnRoom.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; + btnRoom.TextAlignment = TextAlignment.CenterLeft; + btnRoom.Text = i_device.GetRoomListName(); + frameBack.AddChidren(btnRoom, ChidrenBindMode.BindEvent); + //鐢垫睜鍥炬爣 + var btnBattery = new BatteryPersentControl(); + btnBattery.Y = Application.GetRealHeight(62); + //frameBack.AddChidren(btnBattery, ChidrenBindMode.BindEvent); + btnBattery.InitControl(); + btnBattery.SetValue(80); + btnBattery.X = frameBack.Width - btnBattery.Width - Application.GetRealWidth(12); + this.dicBatteryContr[i_device.sid] = btnBattery; + frameBack.ButtonClickEvent += (sender, e) => + { + var form = new VideoDoorLockPage(i_device, btnName, btnRoom,Comerom.function); + MainPage.BasePageView.AddChidren(form); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + form.Show(); + //var form = new VideoDoorLockPage(); + //form.AddForm(i_device, new Button(), btnName, btnRoom); + }; + + //搴曢儴鍐嶅姞涓棿璺� + var frameSpace = new FrameLayout(); + frameSpace.Height = Application.GetRealHeight(12); + this.listView.AddChidren(frameSpace); + } + + #endregion + + + public void SkipViewPage(Comerom comerom) { + //var form = new VideoDoorLockPage(i_device, btnName, btnRoom, Comerom.function); + //MainPage.BasePageView.AddChidren(form); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //form.Show(); + } + + #region 鈻� 鍒濆鍖栧ご閮ㄥ巻鍙茶褰曞浘鏍嘷____________ + + /// <summary> + /// 鍒濆鍖栧ご閮ㄥ巻鍙茶褰曟帶浠� + /// </summary> + private void InitTopHistoryControl() + { + //鍘嗗彶璁板綍鍥炬爣 + var btnIcon = new IconViewControl(28); + btnIcon.X = Application.GetRealWidth(337); + btnIcon.Y = Application.GetRealHeight(9); + btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/History.png"; + topFrameLayout.AddChidren(btnIcon); + btnIcon.ButtonClickEvent += (sender, e) => + { + var form = new DoorLockHistoryInfoPage(); + form.AddForm(this.listDevice); + }; + } + + #endregion + + #region 鈻� 璁惧鐘舵�佹帹閫乢______________________ + + /// <summary> + /// 璁惧鐘舵�佹帹閫� + /// </summary> + /// <param name="i_LocalDevice"></param> + public override void DeviceStatuPush(Function i_LocalDevice) + { + //涓嶆槸鐩爣璁惧 + if (this.dicBatteryContr.ContainsKey(i_LocalDevice.sid) == false) + { + return; + } + + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs new file mode 100644 index 0000000..c62b717 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs @@ -0,0 +1,360 @@ +锘縰sing Shared; +using System; +using System.Collections.Generic; +using System.Text; +using HDL_ON.UI.CSS; +using HDL_ON.Entity; +using HDL_ON.DriverLayer; +using HDL_ON.UI.Music; + +namespace HDL_ON.UI +{ + /// <summary> + /// 瑙嗛闂ㄩ攣鐨勬帶鍒剁晫闈� + /// </summary> + public class VideoDoorLockPage : FrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + /// <summary> + /// 璁惧 + /// </summary> + private Function device; + /// <summary> + /// 涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢 + /// </summary> + private Button btnDeviceName; + /// <summary> + /// 涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢 + /// </summary> + private Button btnRoomName; + /// <summary> + /// 澶撮儴甯冨眬 + /// </summary> + private TopView topView; + /// <summary> + ///鏀惰棌鍥炬爣 + /// </summary> + private Button btnCollectIcon; + /// <summary> + /// 闂ㄩ攣鐘舵�� + /// </summary> + private CustomFrameLayout doorLockFL; + /// <summary> + /// 瀹炴椂瑙嗛 + /// </summary> + private CustomFrameLayout rtvFL; + /// <summary> + /// 涓�閿紑閿� + /// </summary> + private CustomFrameLayout openFL; + /// <summary> + /// 涓存椂瀵嗙爜 + /// </summary> + private CustomFrameLayout pswFL; + /// <summary> + /// 鍘嗗彶璁板綍 + /// </summary> + private CustomFrameLayout recordFL; + /// <summary> + /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰 + /// </summary> + private Comerom Comerom; + #endregion + + + /// <summary> + /// 鏋勯�犲嚱鏁� + /// </summary> + /// <param name="function">璁惧</param> + /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢</param> + /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢</param> + public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, Comerom comerom) + { + this.device = function; + this.btnDeviceName = btnDeviceName; + this.btnRoomName = btnRoomName; + this.Comerom = comerom; + + } + + public void Show() + { + //鍒濆鍖朥I + this.InitUI(); + //鍒濆鍖栦簨浠� + this.Events(); + + + } + /// <summary> + /// 鍒濆鍖栫晫闈� + /// </summary> + private void InitUI() + { + #region ---鐣岄潰甯冨眬--- + this.BackgroundColor = MusicColor.ViewColor; + this.topView = new TopView(); + this.topView.setBtn.Visible = true; + this.topView.topNameBtn.Text = this.device.name; + this.AddChidren(topView.TopFLayoutView()); + var middLayout = new FrameLayout + { + Y = topView.fLayout.Bottom, + Height = Application.GetRealHeight(H_W.H - H_W.T_Height), + }; + this.AddChidren(middLayout); + btnCollectIcon = new Button + { + X = Application.GetRealWidth(273), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(40), + Height = Application.GetRealWidth(40), + UnSelectedImagePath = "MusicIcon/collect.png", + SelectedImagePath = "MusicIcon/collectSelected.png", + IsSelected= this.device.collect, + Name = "collect" + }; + middLayout.AddChidren(btnCollectIcon); + //闂ㄩ攣鐘舵�� + doorLockFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + middLayout.AddChidren(doorLockFL); + doorLockFL.X = Application.GetRealWidth(40); + doorLockFL.Y = btnCollectIcon.Bottom + Application.GetRealHeight(20); + doorLockFL.AddImageView(); + doorLockFL.AddTextButtonView(); + doorLockFL.GetTextButton().TextID = StringId.shishishipin; + //瀹炴椂瑙嗛 + rtvFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + middLayout.AddChidren(rtvFL); + rtvFL.X = Application.GetRealWidth(20); + rtvFL.Y = Application.GetRealHeight(300); + rtvFL.AddImageView(); + rtvFL.AddTextButtonView(); + rtvFL.GetTextButton().TextID = StringId.shishishipin; + //涓�閿紑閿� + openFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + middLayout.AddChidren(openFL); + openFL.X = rtvFL.Right + Application.GetRealWidth(20); + openFL.Y = Application.GetRealHeight(300); + openFL.AddImageView(); + openFL.AddTextButtonView(); + openFL.GetTextButton().TextID = StringId.yijiankaisuo; + //涓存椂瀵嗙爜 + pswFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + middLayout.AddChidren(pswFL); + pswFL.X = openFL.Right + Application.GetRealWidth(20); + pswFL.Y = Application.GetRealHeight(300); + pswFL.AddImageView(); + pswFL.AddTextButtonView(); + pswFL.GetTextButton().TextID = StringId.linshimima1; + //鍘嗗彶璁板綍 + recordFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + middLayout.AddChidren(recordFL); + recordFL.X = Application.GetRealWidth(20); + recordFL.Y = Application.GetRealHeight(300 + 100); + recordFL.AddImageView(); + recordFL.AddTextButtonView(); + recordFL.GetTextButton().TextID = StringId.lishijilu; + #endregion + + } + /// <summary> + /// 娉ㄥ唽浜嬩欢 + /// </summary> + private void Events() + { + //杩斿洖 + this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + //璁剧疆 + this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) => + { + //璋冪敤绉�缁曠殑鐣岄潰 + var infoView = new UI.FunctionBaseInfoSetPage(this.device, () => + { + + + if (this.btnDeviceName == null || this.btnRoomName == null) + { + return; + } + ////鍒锋柊鏄剧ず + this.btnDeviceName.Text = this.device.name; + this.btnRoomName.Text = this.device.GetRoomListName(); + this.topView.topNameBtn.Text = this.device.name; + + ////浠庢柊璁$畻瀹藉害 + //this.btnDeviceName.Text = btnDeviceName.Text; + //this.btnDeviceName.Width = this.btnDeviceName.GetTextWidth(); + + //this.btnRoomName.Text = btnRoomName.Text; + //this.btnRoomName.Width = this.btnRoomName.GetTextWidth(); + + ////鍥炶皟浜嬩欢 + //this.SettionFinishEvent?.Invoke(); + }); + MainPage.BasePageView.AddChidren(infoView); + infoView.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + //鏀惰棌 + btnCollectIcon.MouseUpEventHandler += (sender, e) => + { + btnCollectIcon.IsSelected = this.device.collect = !btnCollectIcon.IsSelected; + this.device.CollectFunction(); + }; + //瀹炴椂瑙嗛 + rtvFL.SetClickListener((fl, btnStateImage, btnStateText) => { }); + //涓�閿紑閿� + openFL.SetClickListener((fl, btnStateImage, btnStateText) => { }); + //涓存椂瀵嗙爜 + pswFL.SetClickListener((fl, btnStateImage, btnStateText) => { }); + //鍘嗗彶璁板綍 + recordFL.SetClickListener((fl, btnStateImage, btnStateText) => { }); + + + } + + } + /// <summary> + /// 鑷繁寮勪竴涓狥rameLayout + /// </summary> + class CustomFrameLayout : FrameLayout + { + public const int widthFrameLayout = 100; + public const int heightFrameLayout = 80; + public const int yFrameLayout = 300; + public const int xFrameLayout = 20; + public const int interval = 20;//琛屼腑鐨勫垪闂撮殧鍊� + + public CustomFrameLayout(int width, int height, int x = 0, int y = 0) + { + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); + this.X = Application.GetRealWidth(x); + this.Y = Application.GetRealHeight(y); + + } + Button btnStateImage = new Button + { + Width = Application.GetRealWidth(40), + Height = Application.GetRealWidth(40), + UnSelectedImagePath = "MusicIcon/collect.png", + SelectedImagePath = "MusicIcon/collectSelected.png", + Gravity = Gravity.CenterHorizontal, + Name = "btnStateImage", + + }; + Button btnStateText = new Button + { + Y = Application.GetRealHeight(20), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(20), + TextID = StringId.dangqianmenweiguan, + TextSize = TextSize.Text14, + TextColor = MusicColor.TextColor, + Gravity = Gravity.CenterHorizontal, + Name = "btnStateText" + + + }; + public void AddImageView() + { + this.AddChidren(btnStateImage); + + } + public void AddTextButtonView() + { + btnStateText.Y += btnStateImage.Bottom; + this.AddChidren(btnStateText); + } + public Button GetImageButton() + { + //if (!this.AddWithout(this.btnStateImage)) + //{ + // this.AddImageView(); + //} + return this.btnStateImage; + } + public Button GetTextButton() + { + //if (!this.AddWithout(this.btnStateText)) + //{ + // this.AddTextButtonView(); + //} + return this.btnStateText; + } + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄;绗簩涓槸鍥炬爣瀵硅薄;绗笁涓槸鐘舵�佸璞�</param> + /// <param name="button1">娉ㄦ剰:鍦⊿etClickListener()鍓嶉潰璋冪敤AddImageView()鎵嶆湁鏁�</param> + /// <param name="button2">娉ㄦ剰:鍦⊿etClickListener()鍓嶉潰璋冪敤AddImageView()鎵嶆湁鏁�</param> + public void SetClickListener(Action<FrameLayout, Button, Button> action) + { + EventHandler<MouseEventArgs> click = (sender, e) => + { + if (action == null) + { + return; + } + action(this, btnStateImage, btnStateText); + }; + this.MouseUpEventHandler += click; + btnStateImage.MouseUpEventHandler += click; + btnStateText.MouseUpEventHandler += click; + + } + + + + /// <summary> + /// 鍦ㄧ埗甯冨眬鏌ユ壘瀛愭帶浠舵槸鍚﹀瓨鍦� + /// </summary> + /// <param name="btn">鏌ユ壘瀵硅薄</param> + /// <returns>瀛樺湪涓簍rue,鍚﹀垯涓篺alse</returns> + private bool AddWithout(View btn) + { + + if (this.ChildrenCount <= 0 || btn == null) + { + return false; + } + for (int i = 0; i < this.ChildrenCount; i++) + { + View view = this.GetChildren(i); + if (view == null) + { + continue; + } + if (view is Button) + { + if (view.Name == btn.Name) + { + return true; + } + } + + } + return false; + + } + + + + + } + /// <summary> + /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰 + /// </summary> + public enum Comerom + { + function,//鍔熻兘 + collect,//鏀惰棌 + room,//鎴块棿 + } + +} diff --git a/HDL_ON/UI/UI2/UserPage.cs b/HDL_ON/UI/UI2/UserPage.cs index 6a3074f..b2fd6b5 100644 --- a/HDL_ON/UI/UI2/UserPage.cs +++ b/HDL_ON/UI/UI2/UserPage.cs @@ -485,9 +485,10 @@ { btnNavigationSelectionIcon.SetRotation(0f); ContextView.RemoveAll(); - var classificaitionView = new ClassificationPage(); + var classificaitionView = new ClassificationPage(); ContextView.AddChidren(classificaitionView); classificaitionView.LoadPage(); + }); }) { IsBackground = true, Priority = System.Threading.ThreadPriority.Lowest }.Start(); -- Gitblit v1.8.0