From 7584dea0241cefc276a4b5311331aee1dcda6c80 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 16 三月 2021 11:44:41 +0800 Subject: [PATCH] Merge branch 'WJC' into temp-wxr --- HDL-ON_iOS/Resources/Phone/PirIcon/succeed.png | 0 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 2 HDL-ON_Android/Assets/Language.ini | 9 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs | 174 ++++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs | 59 HDL_ON/DAL/Mqtt/MqttClient.cs | 26 HDL_ON/HDL_ON.projitems | 4 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs | 91 ++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 410 +++++++--- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs | 113 ++ HDL-ON_iOS/Resources/Language.ini | 62 + HDL-ON_iOS/Resources/Phone/PirIcon/right.png | 0 HDL-ON_iOS/Resources/Phone/PirIcon/2.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs | 4 HDL-ON_iOS/Resources/Phone/PirIcon/left.png | 0 HDL_ON/DAL/DriverLayer/Control.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs | 3 HDL_APP_Project.sln | 14 HDL-ON_iOS/Resources/Phone/PirIcon/3.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs | 351 +++++++++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs | 35 HDL-ON_iOS/Resources/Phone/PirIcon/icon1.png | 0 HDL-ON_iOS/Resources/Phone/PirIcon/failed.png | 0 HDL-ON_iOS/Resources/Phone/PirIcon/4.png | 0 HDL_ON/DAL/Server/NewAPI.cs | 23 HDL_ON/Entity/Function/Function.cs | 6 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs | 88 +- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs | 31 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs | 89 ++ HDL-ON_iOS/Resources/Phone/PirIcon/1.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs | 110 ++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs | 24 HDL_ON/Common/R.cs | 4 HDL-ON_iOS/Resources/Phone/PirIcon/icon2.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs | 41 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs | 1 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs | 463 +++-------- 37 files changed, 1,629 insertions(+), 610 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 506591d..a6f0ed0 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -1245,8 +1245,6 @@ 6012=绾㈠閬ユ帶 6013=璁惧绠$悊 6014=娣诲姞閬ユ帶鍣� - - 6015=鍦ㄧ嚎 6016=绂荤嚎 6017=鐗堟湰鍙� @@ -1304,6 +1302,11 @@ 6071=淇敼鍚嶅瓧 6072=纭鍒犻櫎 6073=鍙栨秷 +6074=閬ユ帶鍣ㄤ笉鑳借秴杩�10涓紵 +6075=閬ユ帶鍣ㄦ墍灞炲尯鍩�: +6076=缂栬緫淇℃伅 + + 7000=鏂板缓鑷姩鍖� 7001=缂栬緫鑷姩鍖� @@ -1353,7 +1356,7 @@ 7045=璁剧疆 7046=鍚嶇О 7047=淇敼鍚嶇О -7048=鑷姩鍖栧悕绉板凡瀛樺湪 +7048=鍚嶇О宸插瓨鍦� 7049=鏄惁瑕佸垹闄よ嚜鍔ㄥ寲锛� 7050=娣诲姞鍦烘櫙 7051=寤舵椂 diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index c3cdeac..c84cc7d 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -1248,6 +1248,66 @@ 6012=绾㈠閬ユ帶 6013=璁惧绠$悊 6014=娣诲姞閬ユ帶鍣� +6015=鍦ㄧ嚎 +6016=绂荤嚎 +6017=鐗堟湰鍙� +6018=璇疯緭鍏ラ仴鎺у櫒鍚嶇О +6019=鎻愮ず锛氶仴鎺у櫒鍒涘缓鍚庡彲鍦ㄥ姛鑳�-鐢靛櫒鍒嗙被{\r\n}鏌ユ壘浣跨敤 +6020=鎺ㄨ崘鎸夐敭 +6021=璇疯緭鍏ユ寜閿悕绉� +6022=涓嬩竴姝� +6023=鐢垫簮 +6024=闊抽噺+ +6025=闊抽噺- +6026=棰戦亾+ +6027=棰戦亾- +6028=涓� +6029=涓� +6030=宸� +6031=鍙� +6032=闈欓煶 +6034=纭 +6035=鎾斁 +6037=閫�鍑� +6038=鑿滃崟 +6039=鏆傚仠 +6040=杩斿洖 +6041=鍋滄 +6042=涓婚〉 +6043=蹇繘 +6044=蹇�� +6045=瀹氭椂 +6046=澶嶅埗閬ユ帶鍔熻兘 +6047=瀵瑰噯閬ユ帶鍣ㄤ腑蹇冩寜涓嬬浉鍚屾寜閿� +6048=鏅鸿兘閬ユ帶鍣� +6049=娣诲姞鎸夐敭 +6050=*闀挎寜鍙繘琛岃嚜瀹氫箟鎺掑簭 +6051=瀹屾垚 +6052=娣诲姞鎴愬姛 +6053=鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤 +6054=鎵�灞炲垎绫� +6055=閬ユ帶鍣ㄥ悕绉� +6056=鎵�灞炲尯鍩� +6057=缁х画娣诲姞 +6058=鐢靛櫒 +6059=娣诲姞澶辫触 +6060=閲嶈瘯 +6061=鍖归厤閬ユ帶鍣� +6062=璇风偣鍑讳互涓嬫寜閽� +6063=纭璁惧鏄惁鏈夊搷搴� +6064=鎺у埗澶辫触 +6065=鎺у埗鎴愬姛 +6066=鐢垫簮寮� +6067=妯″紡鍒跺喎 +6068=椋庨�熶腑椋� +6069=娓╁害26鈩� +6070=鍒犻櫎璁惧 +6071=淇敼鍚嶅瓧 +6072=纭鍒犻櫎 +6073=鍙栨秷 +6074=閬ユ帶鍣ㄤ笉鑳借秴杩�10涓紵 +6075=閬ユ帶鍣ㄦ墍灞炲尯鍩�: +6076=缂栬緫淇℃伅 6015=鍦ㄧ嚎 @@ -1356,7 +1416,7 @@ 7045=璁剧疆 7046=鍚嶇О 7047=淇敼鍚嶇О -7048=鑷姩鍖栧悕绉板凡瀛樺湪 +7048=鍚嶇О宸插瓨鍦� 7049=鏄惁瑕佸垹闄よ嚜鍔ㄥ寲锛� 7050=娣诲姞鍦烘櫙 7051=寤舵椂 diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/1.png b/HDL-ON_iOS/Resources/Phone/PirIcon/1.png new file mode 100755 index 0000000..fc7c017 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/1.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/2.png b/HDL-ON_iOS/Resources/Phone/PirIcon/2.png new file mode 100755 index 0000000..53153e8 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/2.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/3.png b/HDL-ON_iOS/Resources/Phone/PirIcon/3.png new file mode 100755 index 0000000..3c1487b --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/3.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/4.png b/HDL-ON_iOS/Resources/Phone/PirIcon/4.png new file mode 100755 index 0000000..94e0bdc --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/4.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/failed.png b/HDL-ON_iOS/Resources/Phone/PirIcon/failed.png new file mode 100755 index 0000000..76dcfbe --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/failed.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/icon1.png b/HDL-ON_iOS/Resources/Phone/PirIcon/icon1.png new file mode 100755 index 0000000..2430b09 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/icon1.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/icon2.png b/HDL-ON_iOS/Resources/Phone/PirIcon/icon2.png new file mode 100755 index 0000000..a68738c --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/icon2.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/left.png b/HDL-ON_iOS/Resources/Phone/PirIcon/left.png new file mode 100755 index 0000000..a7cb542 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/left.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/right.png b/HDL-ON_iOS/Resources/Phone/PirIcon/right.png new file mode 100755 index 0000000..49070bb --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/right.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/succeed.png b/HDL-ON_iOS/Resources/Phone/PirIcon/succeed.png new file mode 100755 index 0000000..61c36c2 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PirIcon/succeed.png Binary files differ diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln index 6e5610f..53170d1 100644 --- a/HDL_APP_Project.sln +++ b/HDL_APP_Project.sln @@ -9,6 +9,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ys", "ys\ys.csproj", "{DF065E3F-C3A1-4908-9582-000974B7C290}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -55,5 +57,17 @@ {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.ActiveCfg = Release|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.Build.0 = Release|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.Build.0 = Release|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.Build.0 = Debug|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.ActiveCfg = Release|Any CPU + {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 383268c..3d2d9c9 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -861,7 +861,9 @@ public const int xiugaimingzi = 6071; public const int querenshanchu = 6072; public const int quxiao = 6073; - + public const int bunengchaoguo10 = 6074; + public const int yaokongqiquyu = 6075; + public const int bianjixinxi = 6076; diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 1e17902..de9a955 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -852,7 +852,7 @@ case SPK.SensorSmoke: case SPK.SensorWater: case SPK.ClothesHanger: - case SPK.IrAC: + case SPK.AcIr: //璁惧鐘舵�佹帹閫� Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); break; diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index 6b893ed..e97ced8 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -197,10 +197,17 @@ Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found", QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; + //App璁㈤槄閬ユ帶鍣ㄨ嚜瀛︽寜閿涔犳垚鍔熼�氱煡 + var study = new MqttTopicFilter() + { + Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up", + QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce + }; Utlis.WriteLine("寮�濮嬭闃咃紒"); var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { pirStatus, + study, topicFilterPush2, topicAlinkStatus }); if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) { @@ -242,7 +249,7 @@ Utlis.WriteLine($"StartCloudMqtt: 寮�濮�"); - await Task.Factory.StartNew(async () => { + await Task.Factory.StartNew((Func<Task>)(async () => { try { #region 鍒濆鍖栬繙绋婱qtt @@ -254,7 +261,7 @@ if (RemoteMqttClient.ApplicationMessageReceivedHandler == null) { //澶勭悊鎺ユ敹鍒扮殑鏁版嵁 - RemoteMqttClient.UseApplicationMessageReceivedHandler((e) => { + RemoteMqttClient.UseApplicationMessageReceivedHandler((Action<MqttApplicationMessageReceivedEventArgs>)((e) => { try { var topic = e.ApplicationMessage.Topic; @@ -301,7 +308,16 @@ { var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); var revString = Encoding.UTF8.GetString(bytes); - HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString; + HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString; + //ReceiveCheckGateway(ss); + //return; + } + //App璁㈤槄閬ユ帶鍣ㄨ嚜瀛︽寜閿涔犳垚鍔熼�氱煡 + else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up") + { + var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); + var revString = Encoding.UTF8.GetString(bytes); + HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString; //ReceiveCheckGateway(ss); //return; } @@ -332,7 +348,7 @@ } } catch { } - }); + })); } //(2)DisconnectedHandler @@ -383,7 +399,7 @@ Utlis.WriteLine($"StartCloudMqtt: 缁撴潫"); } - }); + })); } diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index 5921982..86fce77 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -325,6 +325,7 @@ /// 鑾峰彇璁惧璇︽儏 /// </summary> public const string Api_Post_GetDevcieInfoList = "/home-wisdom/app/device/info"; + /// <summary> /// 鍒锋柊璁惧鐘� /// </summary> @@ -502,6 +503,18 @@ /// 閬ユ帶鍣ㄨ嚜瀛︽寜閿垹闄� /// </summary> public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove"; + /// <summary> + /// 鑾峰彇璁惧璇︽儏閫氳繃(spk,sid) + /// </summary> + public const string Api_Post_GetinfoBySid = "/home-wisdom/app/device/infoBySid"; + /// <summary> + /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄� + /// </summary> + public const string API_POST_Ir_DeviceDel = "/home-wisdom/app/device/remove"; + /// <summary> + /// 淇敼璁惧鍚嶇О + /// </summary> + public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename"; #endregion @@ -513,18 +526,12 @@ /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� /// </summary> public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/childToken"; - /// <summary> - /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄� - /// </summary> - public const string API_POST_Ir_DeviceDel= "/home-wisdom/app/device/remove"; - /// <summary> - /// 淇敼绾㈠瀹濆悕绉� - /// </summary> - public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename"; + #endregion + } ///// <summary> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 67707e3..bf83228 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1031,7 +1031,7 @@ /// <summary> /// 瀹剁數銆侀鎵� /// </summary> - public const string ElectricFan = "electrical.fan"; + public const string ElectricFan = "electrical.fan"; /// <summary> /// 瀹剁數銆佹秱楦︾┖姘斿噣鍖栧櫒 /// </summary> @@ -1039,7 +1039,7 @@ /// <summary> /// 瀹剁數銆佹秱楦︾數椋庢墖 /// </summary> - public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz"; + public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz"; /// <summary> /// 瀹剁數銆佹秱楦︽壂鍦版満鍣ㄤ汉 /// </summary> @@ -1057,7 +1057,7 @@ /// </summary> public const string IrModule = "ir.module"; /// <summary> - /// 绾㈠绌鸿皟 + /// 绾㈠鐢佃 /// </summary> public const string IrAC = "ir.ac"; /// <summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index dead566..00d6ce3 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -371,6 +371,10 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\BrandListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\IrLearnPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\EditControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\FrameLayout50.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ControlView.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index b6a33b2..1255e80 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -134,7 +134,7 @@ var clothesHangerpage = new ClothesHangerPage(); clothesHangerpage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; - case SPK.IrAC: + case SPK.AcIr: case SPK.AcStandard: var acPage = new AcControlPage(); acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs index acb78cb..9786316 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs @@ -892,9 +892,9 @@ /// 淇℃伅鎻愮ず绐楀彛锛岃嚜鍔ㄥ叧闂� /// </summary> /// <param name="msg">鎻愮ず閿欒鏂囨湰</param> - public void FlashingBox(string msg) + public void FlashingBox(string msg,int time=2000) { - new PublicAssmebly().TipMsgAutoClose(msg, false, 2000); + new PublicAssmebly().TipMsgAutoClose(msg, false, time); } /// <summary> diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs index 4f2aec5..559e88a 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs @@ -8,7 +8,7 @@ { public AddButton() { - Tag = "Pir"; + Tag = "PirView"; } public void Show(Control control) { @@ -114,7 +114,7 @@ //鍚嶇О涓嶈兘涓虹┖ return; } - var butName = Pir.BuottonList.Find((c) => c.value == texts); + var butName = control.status.Find((c) => c.value == texts); if (butName != null) { //鍚嶇О宸茬粡瀛樺湪 @@ -125,49 +125,61 @@ replication.Show(); //娣诲姞鏁版嵁瀵硅薄 - ButtonObj buttonObj = new ButtonObj(); - buttonObj.Key = "key" + Pir.BuottonList.Count.ToString(); + Entity.AttributesStatus buttonObj = new Entity.AttributesStatus(); + buttonObj.key = "key" + control.status.Count.ToString(); buttonObj.value = texts; - PirSend.CodeStudy(buttonObj, (responsePackNew) => + PirSend.CodeStudy(control, buttonObj, (responsePackNew) => { - ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� - /// - //浼戠湢鏄负鏄剧ず寮曞鐣岄潰 - System.Threading.Thread.Sleep(5000); - //绉婚櫎娣诲姞鎸夐挳寮曞鐣岄潰 - replication.RemView(); - //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - //{ - var buttonName = Pir.BuottonList.Find((c) => c.value == buttonObj.value); - if (buttonName == null) + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { - //娣诲姞鏁版嵁 - Pir.BuottonList.Add(buttonObj); - } - //绉婚櫎娣诲姞鎸夐挳鐣岄潰 - this.RemoveFromParent(); - - for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) - { - var view = MainPage.BasePageView.GetChildren(i); - if (view.GetType() == typeof(AddControl)) + Method method = new Method(); + var mqttdate = method.MqttDate(control.sid, 25); + if (mqttdate !=null) { - view.RemoveFromParent(); + //浼戠湢鏄负鏄剧ず寮曞鐣岄潰 + // System.Threading.Thread.Sleep(3000); + //绉婚櫎娣诲姞鎸夐挳寮曞鐣岄潰 + replication.RemView(); + var buttonName = control.status.Find((c) => c.value == buttonObj.value); + if (buttonName == null) + { + //娣诲姞鏁版嵁 + control.status.Add(buttonObj); + } + //绉婚櫎娣诲姞鎸夐挳鐣岄潰 + this.RemoveFromParent(); + + for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) + { + var view = MainPage.BasePageView.GetChildren(i); + if (view.GetType() == typeof(AddControl)) + { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); + view.RemoveFromParent(); + } + + } + + //鍔犺浇鏁版嵁鐣岄潰 + AddControl addControl = new AddControl(); + MainPage.BasePageView.AddChidren(addControl); + addControl.Show(control); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - + else + { + replication.RemView(); + new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); + + } + } - - //鍔犺浇鏁版嵁鐣岄潰 - AddControl addControl = new AddControl(); - MainPage.BasePageView.AddChidren(addControl); - addControl.Show(control); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - //} - //else - //{ - // PirSend.Error(responsePackNew); - //} + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } }); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs index 0d28f9d..76f446d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs @@ -9,7 +9,7 @@ { public AddControl() { - Tag = "Pir"; + Tag = "PirView"; } public void Show(Control control) { @@ -103,7 +103,7 @@ VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); frameLayout.AddChidren(vv); - RefreshView(vv, false); + RefreshView(vv, false, control); #endregion #region 鐣岄潰鐐瑰嚮浜嬩欢 @@ -117,13 +117,13 @@ topView.topIconBtn.Text = Language.StringByID(StringId.wancheng); topView.topIconBtn.TextSize = TextSize.text14; topView.topIconBtn.TextColor = CSS.CSS_Color.textColor; - RefreshView(vv, true); + RefreshView(vv, true, control); } else { topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png"; topView.topIconBtn.Text = ""; - RefreshView(vv, false); + RefreshView(vv, false, control); } @@ -151,7 +151,6 @@ view.RemoveFromParent(); } } - //MainPage.BasePageView.RemoveViewByTag("Pir"); AddControlComplete addControlComplete = new AddControlComplete(); MainPage.BasePageView.AddChidren(addControlComplete); addControlComplete.Show(control,false); @@ -164,18 +163,18 @@ /// </summary> /// <param name="vv">涓婁笅婊戝姩鎺т欢</param> /// <param name="if_bool">琛ㄧず鏄惁鏄剧ず鍒犻櫎鍥炬爣</param> - void RefreshView(VerticalScrolViewLayout vv, bool if_bool) + void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control) { vv.RemoveAll(); //瀹氫箟涓�涓彉閲忚褰曡鏁� int sum = 0; - if (Pir.BuottonList.Count % 3 == 0) + if (control.status.Count % 3 == 0) { - sum = Pir.BuottonList.Count / 3; + sum = control.status.Count / 3; } else { - sum = Pir.BuottonList.Count / 3 + 1; + sum = control.status.Count / 3 + 1; } //璁$畻鍔犺浇鍑烘潵鐨勬暟鎹渶瑕佺殑楂樺害 int h = 16 + sum * (16 + 44) + 104 + 76; @@ -186,9 +185,9 @@ Height = Application.GetRealWidth(h), }; vv.AddChidren(FLayout); - for (int i = 1, j = 0; i <= Pir.BuottonList.Count; i++, j++) + for (int i = 1, j = 0; i <= control.status.Count; i++, j++) { - var nameObj = Pir.BuottonList[i - 1]; + var nameObj = control.status[i - 1]; //鎸夐挳 var buttonNameBtn = new Button { @@ -223,7 +222,7 @@ //鍒犻櫎鍥炬爣鐨勭偣鍑讳簨浠� delIconBtn.MouseUpEventHandler += (sender, e) => { - var obj = delIconBtn.Tag as ButtonObj; + var obj = delIconBtn.Tag as Entity.AttributesStatus; //鍔犺浇log Loading loading = new Loading(); this.AddChidren(loading); @@ -234,7 +233,7 @@ try { //鍙戦�佹寜閿垹闄わ紱 - responsePackNew = PirSend.CodeRemove(obj); + responsePackNew = PirSend.CodeRemove(obj, control.deviceId); } catch { } finally @@ -245,12 +244,12 @@ if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� - var buttonObj = Pir.BuottonList.Find((c) => c.value == obj.value); + var buttonObj = control.status.Find((c) => c.value == obj.value); if (buttonObj != null) { - Pir.BuottonList.Remove(buttonObj); + control.status.Remove(buttonObj); } - RefreshView(vv, true); + RefreshView(vv, true, control); } else { Method method = new Method(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs index ac1b20d..3958f65 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs @@ -8,10 +8,24 @@ { public AddControlComplete() { - Tag = "Pir"; + Tag = "PirView"; } public void Show(Control control, bool bool_library) { + //鏁版嵁杞崲 + Entity.Function function = new Entity.Function(); + { + function.sid = control.sid; + function.deviceId = control.deviceId; + function.name = control.name; + function.spk = control.spk; + //function.attributes.AddRange(control.status); + //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛� + if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid)) + { + Pir.currPir.FunctioList.Add(function); + } + } #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); @@ -76,12 +90,71 @@ this.AddChidren(namePatchView.FLayoutView()); namePatchView.btnText1.TextID = StringId.yaokongqimingcheng; namePatchView.btnText2.Text = control.name; + namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { + + List<string> list = new List<string>(); + + for (int i = 0; i < Pir.currPir.FunctioList.Count; i++) + { + list.Add(Pir.currPir.FunctioList[i].name); + } + Method method = new Method(); + method.EditControlName(StringId.editName, list, control.name, (name, view) => + { + //鍔犺浇log + Loading loading = new Loading(); + view.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + view.Close(); + namePatchView.btnText2.Text = name; + function.name = name; + } + else + { + Method methodError = new Method(); + methodError.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + + + }, () => { }); + }; //鎵�灞炲尯鍩� View.PatchView quyuPatchView = new View.PatchView(); quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom; this.AddChidren(quyuPatchView.FLayoutView()); quyuPatchView.btnText1.TextID = StringId.suoshuquyu; - quyuPatchView.btnText2.TextID = StringId.dianqi; + quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function); + quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => + { + Method method = new Method(); + method.ManagementPosition(function, () => + { + //鏇存柊鍖哄煙 + quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function); + }); + }; + //缁х画娣诲姞 Button addBtn = new Button @@ -116,10 +189,10 @@ else { Method method = new Method(); - method.AddControl(this, (control1) => { + method.AddControl(this, (controlDevice) => { AddButton addButton = new AddButton(); MainPage.BasePageView.AddChidren(addButton); - addButton.Show(control1); + addButton.Show(controlDevice); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); } @@ -127,8 +200,12 @@ //瀹屾垚鐐瑰嚮浜嬩欢 saveView.btnClick.MouseUpEventHandler += (sender, e) => { - MainPage.BasePageView.RemoveViewByTag("AddControl"); - MainPage.BasePageView.RemoveViewByTag("Pir"); + //鍓嶉潰鐣岄潰 + // this.RemoveFromParent(); + MainPage.BasePageView.RemoveViewByTag("PirView"); + //涓荤晫闈� + MainPage.BasePageView.RemoveViewByTag("PirMain"); + }; #endregion } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs index d7b7c56..d936aef 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs @@ -11,7 +11,7 @@ { Tag = "PirView"; } - public void Show() + public void Show(Action action) { #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; @@ -19,7 +19,11 @@ topView.topNameBtn.TextID = StringId.shebeigaunli; topView.topIconBtn.Visible = true; this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + action(); + this.RemoveFromParent(); + }; VerticalRefreshLayout vv = new VerticalRefreshLayout(); vv.Height = Application.GetRealHeight(667 - 64); vv.Y = Application.GetRealHeight(64); @@ -29,14 +33,14 @@ //鍏抽棴鍒锋柊View锛� vv.EndHeaderRefreshing(); //鑾峰彇鍒楄〃 - Method.GetPirDeviceList(this,() => - { - Application.RunOnMainThread(() => - { - //鍒锋柊鐣岄潰 - UIView(vv); - }); - }); + Method.GetPirDeviceList(this, () => + { + Application.RunOnMainThread(() => + { + //鍒锋柊鐣岄潰 + UIView(vv); + }); + }); }; #endregion @@ -60,138 +64,32 @@ Height = Application.GetRealHeight(12 + 92 + (50 * pirDevice.FunctioList.Count)), }; vv.AddChidren(fLayout); - - //绾㈠瀹濇樉绀虹埗鎺т欢 - FrameLayout devfLayout = new FrameLayout - { - Y = Application.GetRealHeight(12), - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(375 - 16 * 2), - Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)), - BackgroundColor = CSS.CSS_Color.view, - Radius = (uint)Application.GetRealHeight(12), - }; - fLayout.AddChidren(devfLayout); - - - //绾㈠瀹濆浘鏍� - Button priequipmentBtn = new Button - { - Y = Application.GetRealHeight(16), - X = Application.GetRealWidth(5), - Width = Application.GetRealWidth(60), - Height = Application.GetRealWidth(60), - UnSelectedImagePath = "PirIcon/priequipment.png", - TextAlignment = TextAlignment.Center, - }; - devfLayout.AddChidren(priequipmentBtn); + View.PirView pirView = new View.PirView(); //绾㈠瀹濆悕绉� - Button deviceNameBtn = new Button + pirView.deviceNameBtn.Text = pirDevice.name; + //绾㈠瀹濆綋鍓嶆湁澶氬皯涓仴鎺у櫒 + pirView.geBtn.Text = pirDevice.FunctioList.Count.ToString(); + //绾㈠瀹濇槸鍚﹀湪绾�-绂荤嚎 + if (pirDevice.online) { - Y = Application.GetRealHeight(16), - X = priequipmentBtn.Right + Application.GetRealWidth(7), - Width = Application.GetRealWidth(120), - Height = Application.GetRealHeight(20), - Text = pirDevice.name, - TextAlignment = TextAlignment.CenterLeft, - TextSize = TextSize.text14, - TextColor = CSS.CSS_Color.textColor, - IsBold = true, - }; - devfLayout.AddChidren(deviceNameBtn); - //鐗堟湰鍙� - Button versionBtn = new Button + pirView.stateIconBtn.IsSelected = true; + pirView.stateTextBtn.IsSelected = true; + } + else { - Y = deviceNameBtn.Bottom + Application.GetRealHeight(4), - X = priequipmentBtn.Right + Application.GetRealWidth(7), - Width = Application.GetRealWidth(120), - Height = Application.GetRealHeight(17), - Text = "鐗堟湰鍙穠1.3.5", - TextAlignment = TextAlignment.CenterLeft, - TextSize = TextSize.text12, - TextColor = CSS.CSS_Color.textCancelColor, - }; - devfLayout.AddChidren(versionBtn); - // 5/10 - Button geBtn = new Button + pirView.stateIconBtn.IsSelected = false; + pirView.stateTextBtn.IsSelected = false; + } + //鏍囪绾㈠瀹� + pirView.clickBtn.Tag = pirDevice; + //绾㈠瀹濈偣鍑讳簨浠� + pirView.clickBtn.MouseUpEventHandler += (sender, e) => { - Y = versionBtn.Bottom + Application.GetRealHeight(2), - X = priequipmentBtn.Right + Application.GetRealWidth(7), - Width = Application.GetRealWidth(120), - Height = Application.GetRealHeight(17), - Text = pirDevice.FunctioList.Count.ToString(), - TextAlignment = TextAlignment.CenterLeft, - TextSize = TextSize.text12, - TextColor = CSS.CSS_Color.textConfirmColor, - }; - devfLayout.AddChidren(geBtn); - geBtn.Width = geBtn.GetTextWidth(); - // 5/10 - Button sumBtn = new Button - { - Y = versionBtn.Bottom + Application.GetRealHeight(2), - X = geBtn.Right, - Width = Application.GetRealWidth(20), - Height = Application.GetRealHeight(17), - Text = "/10", - TextAlignment = TextAlignment.CenterLeft, - TextSize = TextSize.text12, - TextColor = CSS.CSS_Color.textCancelColor, - }; - devfLayout.AddChidren(sumBtn); - //鐘舵�佸浘鏍� - Button stateIconBtn = new Button - { - Y = Application.GetRealHeight(23), - X = Application.GetRealWidth(291), - Width = Application.GetRealWidth(8), - Height = Application.GetRealWidth(8), - UnSelectedImagePath = "PirIcon/online.png", - }; - devfLayout.AddChidren(stateIconBtn); - //绾㈠瀹濈姸鎬侊紙鍦ㄧ嚎-绂荤嚎锛� - Button stateTextBtn = new Button - { - Y = Application.GetRealHeight(18), - X = Application.GetRealWidth(303), - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(17), - TextID = StringId.zaixianhwb, - TextAlignment = TextAlignment.CenterLeft, - TextSize = TextSize.text12, - TextColor = 0xFF67D569,// CSS.CSS_Color.textColor, - IsBold = true, - }; - devfLayout.AddChidren(stateTextBtn); - //绾� - Button lineBtn = new Button - { - Y = Application.GetRealHeight(92) - 1, - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(343 - 16 * 2), - Height = 1, - BackgroundColor = CSS.CSS_Color.viewLine, - }; - devfLayout.AddChidren(lineBtn); - //鐐瑰嚮浜嬩欢 - FrameLayout clickFram = new FrameLayout - { - Y = Application.GetRealHeight(12), - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(375 - 16 * 2), - Height = Application.GetRealHeight(92), - BackgroundColor = 0x00000000, //CSS.CSS_Color.view, - Radius = (uint)Application.GetRealHeight(12), - Tag = Pir.pirDeviceList[i], - }; - fLayout.AddChidren(clickFram); - - clickFram.MouseUpEventHandler += (sender, e) => - { - var pirclick = (clickFram.Tag as Pir); + var pirclick = (pirView.clickBtn.Tag as Pir); NewSwitchView(pirclick, vv); }; - + //鍔犺浇鐣岄潰 + pirView.Show(pirDevice.FunctioList.Count, fLayout); if (Pir.pirDeviceList.Count - 1 == i) { //鏈�鍚庝竴涓悗闈㈠鍔犻棿闅旇儗鏅� @@ -201,128 +99,65 @@ for (int j = 0; j < pirDevice.FunctioList.Count; j++) { - var control = pirDevice.FunctioList[i]; - RowLayout funControlRow = new RowLayout - { - Y = Application.GetRealHeight(92 + (50 * j)), - Width = Application.GetRealWidth(375 - 16 * 2), - Height = Application.GetRealHeight(50), - LineColor = CSS.CSS_Color.textWhiteColor, - SubViewWidth = Application.GetRealWidth(68), - }; - devfLayout.AddChidren(funControlRow); + var control = pirDevice.FunctioList[j]; + + View.ControlView controlView = new View.ControlView(); + controlView.Show(pirView.devfLayout, j); //閬ユ帶鍣ㄥ悕绉� - Button nameBtn = new Button + controlView.nameBtn.Text = control.name; + //閬ユ帶鍣ㄥ瓨鏀惧尯鍩� + controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); + //鏍囪閬ユ帶鍣� + controlView.delBtn.Tag = control; + //鍒犻櫎鐐瑰嚮浜嬩欢 + controlView.delBtn.MouseUpEventHandler += (sender, e) => { - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(20), - Text = control.name, - TextAlignment = TextAlignment.CenterLeft, - TextSize = TextSize.text14, - TextColor = CSS.CSS_Color.textColor, - Gravity = Gravity.CenterVertical, + var Function = controlView.delBtn.Tag as Entity.Function; + string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?"; + TipPopView tipPopView = new TipPopView(); + tipPopView.TipBox(StringId.tip, text, (dialog) => + { + Thread(dialog, (responsePackNew) => + { + dialog.Close(); + var function = pirDevice.FunctioList.Find((c) => c.sid == Function.sid); + if (function != null) + { + pirDevice.FunctioList.Remove(Function); + if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid) + { + Pir.currPir.FunctioList = pirDevice.FunctioList; + } + } + UIView(vv); + + }, "鍒犻櫎", Function.deviceId, ""); + + }, () => { }, false); }; - funControlRow.AddChidren(nameBtn); - //閬ユ帶鍣ㄥ尯鍩� - Button areaBtn = new Button - { - X = Application.GetRealWidth(311 + 16 - (40 + 100)), - Width = Application.GetRealWidth(100), - Height = Application.GetRealHeight(17), - Text = j.ToString(), - TextAlignment = TextAlignment.CenterRight, - TextSize = TextSize.text12, - TextColor = CSS.CSS_Color.textCancelColor, - Gravity = Gravity.CenterVertical, - }; - funControlRow.AddChidren(areaBtn); - //涓嬩竴绾у浘鏍� - Button nextIconBtn = new Button - { - X = Application.GetRealWidth(295 + 16), - Width = Application.GetRealWidth(16), - Height = Application.GetRealWidth(16), - UnSelectedImagePath = "PirIcon/next.png", - Gravity = Gravity.CenterVertical, - }; - funControlRow.AddChidren(nextIconBtn); - //鍒犻櫎 - Button delBtn = new Button - { - Width = Application.GetRealWidth(50), - Height = Application.GetRealHeight(22), - TextID = StringId.Del, - TextAlignment = TextAlignment.Center, - TextSize = TextSize.text16, - TextColor = CSS.CSS_Color.textWhiteColor, - IsBold = true, - BackgroundColor = CSS.CSS_Color.textRedColor, - Tag = control, - }; - funControlRow.AddRightView(delBtn); - //绾� - Button line1Btn = new Button - { - Y = Application.GetRealHeight(50 - 2), - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(311), - Height = 1, - BackgroundColor = CSS.CSS_Color.viewLine, - }; - funControlRow.AddChidren(line1Btn); + //view鐐瑰嚮浜嬩欢 + controlView.clickBtn.MouseUpEventHandler += (sender, e) => + { + EditControl editControl = new EditControl(); + MainPage.BasePageView.AddChidren(editControl); + editControl.Show(control, pirDevice, (device) => + { + //鍥炶皟鏇存柊鍚嶅瓧/鍖哄煙 + controlView.nameBtn.Text = device.name; + controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device); + + }); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; if (j == pirDevice.FunctioList.Count - 1) { //鏈�鍚庢敼鍙樹竴涓嚎鐨勯鑹� - line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence; - funControlRow.LineColor = CSS.CSS_Color.viewTranslucence; + controlView.line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence; + controlView.funControlRow.LineColor = CSS.CSS_Color.viewTranslucence; } - delBtn.MouseUpEventHandler += (sender, e) => - { - var Function = delBtn.Tag as Entity.Function; - //鍔犺浇log - Loading loading = new Loading(); - this.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); - new System.Threading.Thread(() => - { - try - { - responsePackNew = PirSend.DeleteDevice(Function.deviceId); - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - loading.Hide(); - try - { - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - pirDevice.FunctioList.Remove(Function); - UIView(vv); - } - else - { - Method method = new Method(); - method.ErrorShow(responsePackNew); - } - } - catch { } - - }); - } - - }) - { IsBackground = true }.Start(); - }; } - - } } @@ -346,44 +181,15 @@ { list.Add(Pir.pirDeviceList[b].name); } - TipPopView tipPopView = new TipPopView(); - tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (name, view) => + Method methodView = new Method(); + methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) => { - pirclick.name = name; - //鍔犺浇log - Loading loading = new Loading(); - view.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); - new System.Threading.Thread(() => + Thread(view, (responsePackNew) => { - try - { - responsePackNew = PirSend.DeviceRename(pirclick); - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - loading.Hide(); - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - view.Close(); - UIView(vv); - } - else - { - Method method = new Method(); - method.ErrorShow(responsePackNew); - } - - }); - } - - }) - { IsBackground = true }.Start(); - + pirclick.name = name; + view.Close(); + UIView(vv); + }, "淇敼鍚嶇О", pirclick.deviceId, pirclick.name); }, () => { NewSwitchView(pirclick, vv); @@ -396,40 +202,12 @@ TipPopView tipPopView = new TipPopView(); tipPopView.TipBox(StringId.tip, text, (dialog) => { - //鍔犺浇log - Loading loading = new Loading(); - dialog.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); - new System.Threading.Thread(() => + + Thread(dialog, (responsePackNew) => { - try - { - responsePackNew = PirSend.DeleteDevice(pirclick.deviceId); - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - loading.Hide(); - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - dialog.Close(); - UIView(vv); - } - else - { - - Method method = new Method(); - method.ErrorShow(responsePackNew); - } - - }); - } - - }) - { IsBackground = true }.Start(); + dialog.Close(); + UIView(vv); + }, "鍒犻櫎", pirclick.deviceId, ""); }, () => { NewSwitchView(pirclick, vv); @@ -438,7 +216,56 @@ } }); } + /// <summary> + /// 鍙戦�佺嚎绋� + /// </summary> + /// <param name="dialog"></param> + /// <param name="action"></param> + /// <param name="str"></param> + /// <param name="deviceId"></param> + /// <param name="obj"></param> + void Thread(Dialog dialog, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, string deviceId, string obj) + { + //鍔犺浇log + Loading loading = new Loading(); + dialog.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + if (str == "鍒犻櫎") + { + responsePackNew = PirSend.DeleteDevice(deviceId); + } + else if (str == "淇敼鍚嶇О") + { - + responsePackNew = PirSend.DeviceRename(deviceId, obj); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + action(responsePackNew); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs new file mode 100644 index 0000000..0325f8a --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs @@ -0,0 +1,110 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; +using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View; + +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice +{ + public class EditControl : FrameLayout + { + public EditControl() + { + } + + public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action) + { + + this.BackgroundColor = CSS.CSS_Color.viewMiddle; + PirDevice.View.TopView topView = new View.TopView(); + topView.topNameBtn.TextID = StringId.pipeiyaokongqi; + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + action(control); + RemoveFromParent(); + }; + topView.topNameBtn.TextID = StringId.bianjixinxi; + FrameLayout viewLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Width = Application.GetRealWidth(375), + Height = Application.GetRealHeight(667 - 64), + BackgroundColor = CSS.CSS_Color.viewMiddle, + }; + this.AddChidren(viewLayout); + + FrameLayout50 editNameFLayout = new FrameLayout50(); + editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":"; + editNameFLayout.btnEditText.Text = control.name; + editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28); + editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28); + editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png"; + viewLayout.AddChidren(editNameFLayout.FLayoutView()); + + FrameLayout50 areaFLayout = new FrameLayout50(); + areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu); + areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); + areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom; + viewLayout.AddChidren(areaFLayout.FLayoutView()); + + editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) => + { + List<string> list = new List<string>(); + + for (int i = 0; i < pir.FunctioList.Count; i++) + { + list.Add(pir.FunctioList[i].name); + } + Method method = new Method(); + method.EditControlName(StringId.editName,list, control.name, (name,view) => + { + //鍔犺浇log + Loading loading = new Loading(); + view.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + view.Close(); + editNameFLayout.btnEditText.Text = name; + control.name = name; + } + else + { + Method methodError = new Method(); + methodError.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + + + },()=> { }); + }; + areaFLayout.btnClick.MouseUpEventHandler += (sender, e) => + { + Method method = new Method(); + method.ManagementPosition(control, () => + { + //鏇存柊鍖哄煙 + areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); + }); + }; + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs index ec6420f..8ef498e 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs @@ -140,10 +140,12 @@ fLayout.AddChidren(succeedBtn); #endregion #region 鐐瑰嚮浜嬩欢 - //琛ㄧず搴撳垪琛ㄧ储寮曞�� - int index= 1; - //琛ㄧず娴嬭瘯鐮佺储寮曞�� + //琛ㄧず搴撳垪琛ㄧ储寮曞��(鐩墠鍙�20涓簱) + int index = 1; + //琛ㄧず娴嬭瘯鐮佺储寮曞��(鐩墠鍙祴璇�3涓爜) int code = 1; + //琛ㄧず娴嬭瘯鏈�鍚庝竴涓爜锛� + bool if_bool = false; //宸� leftIconBtn.MouseUpEventHandler += (sender, e) => { @@ -165,22 +167,31 @@ code = 1; GetBtnText(testBtn, code, spk); }; + //娴嬭瘯Text testBtn.MouseUpEventHandler += (sender, e) => { var library = libraryList[index]; var control = GetControl(spk, testBtn.TextID, library); + //鍙戦�佹祴璇曠爜鍛戒护 CodeTest(control); + if (code == 3) { + //鏍囪鏈�鍚庨偅涓爜 + if_bool = true; + } }; //鎺у埗澶辫触 failedBtn.MouseUpEventHandler += (sender, e) => { if (index < 20) { + //鍏堝姞 index++; + //鏇存柊鏂囨湰 sumBtn.Text = "(" + index.ToString() + "/20)"; } code = 1; + //鏇存柊鐘舵�� GetBtnText(testBtn, code, spk); }; //鎺у埗鎴愬姛 @@ -190,17 +201,20 @@ { code++; } + //鏇存柊鐘舵�� GetBtnText(testBtn, code, spk); - if (code == 3) + if (if_bool) { var library = libraryList[index]; var control = GetControl(spk, testBtn.TextID, library); Method method = new Method(); - method.ThreadAddControl(control, this,(control1) => { + //鍙戦�佸簱娣诲姞閬ユ帶鍣ㄥ懡浠� + method.ThreadAddControl(control, this, (cont) => + { MainPage.BasePageView.RemoveViewByTag("PirView"); AddControlComplete addControlComplete = new AddControlComplete(); MainPage.BasePageView.AddChidren(addControlComplete); - addControlComplete.Show(control1,true); + addControlComplete.Show(cont, true); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); @@ -222,11 +236,11 @@ string value = ""; switch (spk) { - case SPK.AcStandard: + case SPK.AcIr: { switch (textInt) { - case StringId.dianshi: + case StringId.dianyuan: { key = "on_off"; value = "on"; @@ -247,11 +261,11 @@ } } break; - case SPK.ElectricTV: + case SPK.TvIr: { switch (textInt) { - case StringId.dianshi: + case StringId.dianyuan: { key = "on_off"; value = "on"; @@ -259,8 +273,8 @@ break; case StringId.yinliangjia: { - key = "on_off"; - value = "on"; + key = "volume+"; + value = "50"; } break; case StringId.jingyin: @@ -273,21 +287,23 @@ } break; } - ButtonObj buttonObj = new ButtonObj(); - buttonObj.Key = key; + AttributesStatus buttonObj = new AttributesStatus(); + buttonObj.key = key; buttonObj.value = value; Control control = new Control(); control.spk = spk; control.name = spk; - control.group_id = library.irIndex; + control.groupId = library.irIndex; control.type = "library"; control.status.Add(buttonObj); + control.deviceId = Pir.currPir.deviceId; + control.sid = ""; string[] strings = library.irCode.Split(','); - for (int array = 0; array < strings.Length; array++) + for (int arrayStr = 0; arrayStr < strings.Length; arrayStr++) { - //var intValue = Convert.ToInt32(strings[array],16); - control.library.Add(strings[array]); + //var intValue = Convert.ToInt32(strings[arrayStr],16); + control.library.Add(strings[arrayStr].Replace("0x","")); } return control; @@ -309,7 +325,6 @@ { try { - //鍙戦�佹寜閿垹闄わ紱 responsePackNew = PirSend.CodeTest(control); } catch { } @@ -324,8 +339,8 @@ } else { - Method method = new Method(); - method.ErrorShow(responsePackNew); + //Method method = new Method(); + //method.ErrorShow(responsePackNew); } }); @@ -368,7 +383,7 @@ } } break; - case SPK.ElectricTV: + case SPK.TvIr: { switch (code) { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index 0bc89c6..d0745a8 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -8,17 +8,45 @@ { public class Method { + + /// <summary> + /// 绠$悊浣嶇疆 + /// </summary> + /// <param name="control">褰撳墠璁惧</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + public void ManagementPosition(Entity.Function control, Action action) + { + var view = new ChooseRoomPage(control, action); + MainPage.BasePageView.AddChidren(view); + view.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + /// <summary> + /// 淇敼鍚嶇О + /// </summary> + /// <param name="tipText">鎻愮ず鏍囬鏂囨湰</param> + /// <param name="list">褰撳墠瀛樺湪鍚嶇О鍒楄〃</param> + /// <param name="currName">褰撳墠鍚嶇О</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + public void EditControlName(int tipText, List<string> list, string currName, Action<string, Dialog> action, Action actionCancel, bool tag = false) + { + new View.TipView().InputBox(tipText, currName, StringId.nameNull, StringId.NameAlreadyExists, list, (text, view + ) => + { + action(text, view); + }, () => { actionCancel(); }, tag); + } /// <summary> /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶 /// </summary> + /// <param name="frameLayout">log鍥炬爣鍔犺浇鐣岄潰</param> + /// <param name="action">鍥炶皟鍑芥暟</param> public void AddControl(FrameLayout frameLayout, Action<Control> action) { View.TipView tipView = new View.TipView(); tipView.InputBox(frameLayout, "", (name, frame) => { - ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁 - Pir.BuottonList.Clear(); - if (!string.IsNullOrEmpty(name)) + if (Pir.currPir != null && Pir.currPir.FunctioList.Count < 10) { Control control = new Control(); control.name = name; @@ -26,9 +54,11 @@ control.spk = "ir.learn"; control.deviceId = Pir.currPir.deviceId; ThreadAddControl(control, frame, action); - - - + } + else + { + View.TipView tt = new View.TipView(); + tt.TipBox(StringId.tip, StringId.bunengchaoguo10); } }, false); @@ -36,12 +66,12 @@ /// <summary> /// 鍙戦�侀仴鎺у櫒鍛戒护鏂规硶 /// </summary> - /// <param name="control"></param> - /// <param name="frame"></param> + /// <param name="control">鍙戦�佸弬鏁板璞�</param> + /// <param name="frame">log鍥炬爣鍔犺浇鐣岄潰</param> + /// <param name="action">鍥炶皟鍑芥暟</param> public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action) { - - DAL.Server.ResponsePackNew responsePackNew = null; + Cloud mqttdate = null; Loading loading = new Loading(); frame.AddChidren(loading); loading.Start(); @@ -49,7 +79,18 @@ { try { - responsePackNew = PirSend.Add(control); + //鍙戦�佹坊鍔犲懡浠� + var responsePackNew = PirSend.Add(control); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + string sid = responsePackNew.Data.ToString(); + mqttdate = MqttDate(sid); + if (mqttdate != null) + { + control.sid = sid; + } + } + } catch { } finally @@ -57,52 +98,58 @@ Application.RunOnMainThread(() => { loading.Hide(); - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰�; + if (mqttdate != null) { - bool bool_if = false; - string sid = responsePackNew.Data.ToString(); - var mqttdate = MqttDate(); - for (int i = 0; i < mqttdate.objects.Count; i++) { - var objects = mqttdate.objects[i]; - if (sid == objects.sid) { - bool_if = true; - break; - } - } - if (bool_if) + //浼戠湢500姣锛屼负绛夊緟浜戠鍒涘缓deviceid锛� + System.Threading.Thread.Sleep(500); + //璇诲彇娣诲姞閬ユ帶鍣╠eviceID锛屾墠鐭ラ亾鏄惁娣诲姞鎴愬姛锛� + GetControl(frame, control, (device) => { - control.deviceId = mqttdate.id; - ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� - frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥 - action(control); - } - else - { - //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀� - View.FailView failView = new View.FailView(); - failView.ShouError((view) => + if (device != null) { - view.Close(); - ThreadAddControl(control, frame, action); - }); - } + control.deviceId = device.deviceId; + frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥 + action(control); + } + else + { + //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀� + View.FailView failView = new View.FailView(); + failView.ShouError((view) => + { + view.Close(); + ThreadAddControl(control, frame, action); + }); + } + }); } else { - ErrorShow(responsePackNew); + //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀� + View.FailView failView = new View.FailView(); + failView.ShouError((view) => + { + view.Close(); + ThreadAddControl(control, frame, action); + }); } + + }); + } }) { IsBackground = true }.Start(); } - /// <summary> /// 鑾峰彇绾㈠璁惧鍒楄〃 /// </summary> + /// <param name="frame">log鍥炬爣鍔犺浇鐣岄潰</param> + /// <param name="action">鍥炶皟鍑芥暟</param> public static void GetPirDeviceList(FrameLayout frame, Action action) { //娓呴櫎涔嬪墠鍒楄〃; @@ -110,56 +157,63 @@ //鍔犺浇log Loading loading = new Loading(); frame.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; loading.Start(); new System.Threading.Thread(() => { try { - responsePackNew = PirSend.GetDeviceList("ir.module"); + var responsePackNew = PirSend.GetDeviceList("ir.module"); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString()); + string list = jobject["list"].ToString(); + + var jArray = Newtonsoft.Json.Linq.JArray.Parse(list); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + string spk = jay["spk"].ToString(); + if (spk == "ir.module") + { + //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str); + if (pirJosn != null) + { + if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) + { + + Pir.pirDeviceList.Add(pirJosn); + + } + } + } + + } + + } } catch { } finally { Application.RunOnMainThread(() => { - loading.Hide(); try { - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + if (Pir.pirDeviceList.Count != 0) { - var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString()); - string list = jobject["list"].ToString(); - - var jArray = Newtonsoft.Json.Linq.JArray.Parse(list); - for (int a = 0; a < jArray.Count; a++) + GetControlList(() => { - var jay = jArray[a]; - string spk = jay["spk"].ToString(); - if (spk == "ir.module") - { - //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 - var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); - var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str); - if (pirJosn != null) - { - if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) - { + loading.Hide(); + action(); - Pir.pirDeviceList.Add(pirJosn); - - } - } - } - - } - GetControlList(frame, action); - + }); } else { + loading.Hide(); Method method = new Method(); - method.ErrorShow(responsePackNew); + method.ErrorShow(null,"璇诲彇绾㈠瀹濆垪琛ㄥけ璐�"); } } catch { } @@ -174,13 +228,10 @@ /// <summary> /// 鑾峰彇閬ユ帶鍣ㄥ垪琛� /// </summary> - public static void GetControlList(FrameLayout frame, Action action) + /// <param name="action">鍥炶皟鍑芥暟</param> + public static void GetControlList(Action action) { - //鍔犺浇log - Loading loading = new Loading(); - frame.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); + new System.Threading.Thread(() => { try @@ -190,45 +241,69 @@ var pirDevice = Pir.pirDeviceList[i]; try { - responsePackNew = PirSend.ControlList(pirDevice); + var responsePackNew = PirSend.ControlList(pirDevice); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + var jArray = JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); + if (pirJosn != null) + { + if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) + { + pirDevice.FunctioList.Add(pirJosn); + } + } + + } + } } catch { } - finally - { - Application.RunOnMainThread(() => - { - try - { - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); - for (int a = 0; a < jArray.Count; a++) - { - var jay = jArray[a]; - //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 - var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); - var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); - if (pirJosn != null) - { - if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) - { - pirDevice.FunctioList.Add(pirJosn); - } - } - } - } - else - { - //Method method = new Method(); - //method.ErrorShow(responsePackNew); - } - } - catch { } + } + } + catch { } + finally + { - }); - } + Application.RunOnMainThread(() => + { + action(); + }); + } + + }) + { IsBackground = true }.Start(); + + } + /// <summary> + /// 鑾峰彇璁惧璇︽儏閫氳繃(spk,sid) + /// </summary> + /// <param name="frame">log鍥炬爣鍔犺浇鐣岄潰</param> + /// <param name="control">鍙戦�佸弬鏁板璞�</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + public void GetControl(FrameLayout frame, Control control, Action<Entity.Function> action) + { + Entity.Function function = null; + //鍔犺浇log + Loading loading = new Loading(); + frame.AddChidren(loading); + loading.Start(); + new System.Threading.Thread(() => + { + try + { + // 鑾峰彇璁惧璇︽儏閫氳繃(spk,sid) + var responsePackNew = PirSend.GetinfoBySid(control); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + //var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString()); + function = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(responsePackNew.Data.ToString()); } } catch { } @@ -237,65 +312,112 @@ Application.RunOnMainThread(() => { loading.Hide(); - action(); + action(function); }); } + }) { IsBackground = true }.Start(); + } + /// <summary> + /// 鍙戦�佸懡浠ょ嚎绋� + /// </summary> + /// <param name="control">鍙戦�佹暟鎹璞�</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + /// <param name="str">鍒ゆ柇瀛楃</param> + /// <param name="frame">log鐖舵帶浠�</param> + /// <param name="dialog">log鐖舵帶浠�</param> + public void ThreadSend(Control control, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, FrameLayout frame, Dialog dialog) + { + + } + /// <summary> - /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁(閬ユ帶鍣ㄦ坊鍔�) + /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁 /// </summary> - public static string addcontronsid = ""; + public static string mqttdata = ""; /// <summary> - /// + /// 鍒ゆ柇杩欎釜涓婚鏄惁鏄坊鍔犻仴鎺у櫒涓婚 /// </summary> + /// <param name="sid">鍞竴鏍囪瘑</param> + /// <param name="timeValue">绛夊緟鏃堕棿鍊�</param> /// <returns></returns> - public Cloud MqttDate() + public Cloud MqttDate(string sid, int timeValue = 10) { + Cloud cloud = null; var dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000) + while ((DateTime.Now - dateTime).TotalMilliseconds < timeValue * 1000) { - if (!string.IsNullOrEmpty(addcontronsid)) + if (!string.IsNullOrEmpty(mqttdata)) { - break; + try + { + var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(mqttdata); + for (int i = 0; i < cloudjson.objects.Count; i++) + { + var objects = cloudjson.objects[i]; + if (sid == objects.sid) + { + cloud = cloudjson; + mqttdata = ""; + break; + } + } + if (cloud!=null) + { + break; + } + } + catch { } } - - } - return PushData(); - } - - public Cloud PushData() - { - Cloud cloud = new Cloud(); - if (addcontronsid != "") - { - //var date = Newtonsoft.Json.JsonConvert.SerializeObject(addcontronsid); - cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid); } return cloud; } - - - /// <summary> /// 閿欒鐮佹彁绀� /// </summary> /// <param name="responsePackNew"></param> - public void ErrorShow(ResponsePackNew responsePackNew) + /// <param name="str"></param> + public void ErrorShow(ResponsePackNew responsePackNew=null, string str = "") { - - if (responsePackNew != null && responsePackNew.Code == "14005") + if (str == "鍒犻櫎閬ユ帶鍣�") { - new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); + } else if (str == "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�") { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox("璇诲彇绾㈠瀹濆垪琛ㄥけ璐�"); } else { - new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + + if (responsePackNew != null) + { + switch (responsePackNew.Code) + { + + case "14005": + { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + } + break; + case "10807": + { + //绾㈠瀹濅笅閬ユ帶鍣ㄨ秴杩囨渶澶�(10涓�)鏁伴噺闄愬埗 + new Intelligence.Automation.LogicView.TipPopView().FlashingBox("绾㈠瀹濅笅閬ユ帶鍣ㄨ秴杩囨渶澶�(10涓�)鏁伴噺闄愬埗"); + } + break; + default: + { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + } + break; + + } + } } } @@ -304,10 +426,7 @@ [Serializable] public class Cloud { - /// <summary> - /// 璁惧id - /// </summary> - public string id = string.Empty; + public string id = ""; public List<Objects> objects = new List<Objects>(); public string time_stamp = string.Empty; @@ -316,8 +435,17 @@ [Serializable] public class Objects { + public string sid = string.Empty; public string spk = string.Empty; + public List<Attributes> attributes = new List<Attributes>(); } + [Serializable] + public class Attributes + { + public string key = ""; + public string data_type = ""; + public List<string> value = new List<string>(); + } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs index e985b71..9ec777a 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs @@ -1,14 +1,15 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.Entity; + namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { [System.Serializable] - public class Pir: Entity.Function + public class Pir : Entity.Function { /// <summary> - /// 娣诲姞鎸夐敭鍒楄〃 + /// 绾㈠瀹濆垪琛� /// </summary> - public static List<ButtonObj> BuottonList = new List<ButtonObj>(); public static List<Pir> pirDeviceList = new List<Pir>(); /// <summary> /// 褰撳墠閫昏緫 @@ -20,7 +21,6 @@ public List<Entity.Function> FunctioList = new List<Entity.Function>(); } - [System.Serializable] public class Control @@ -28,11 +28,15 @@ /// <summary> /// 绾㈠瀹濊澶嘔d /// </summary> - public string deviceId = "0"; + public string deviceId = ""; + /// <summary> + /// sid + /// </summary> + public string sid = ""; /// <summary> /// 绾㈠閬ユ帶鍣ㄥ悕绉� /// </summary> - public string name = "0"; + public string name = ""; /// <summary> /// 绾㈠閬ユ帶鍣╯pk /// </summary> @@ -44,25 +48,17 @@ /// <summary> /// 鐮佺粍鍙� /// </summary> - public string group_id = "12"; + public string groupId = ""; /// <summary> - /// 绾㈠鐮� + /// 绾㈠鐮佸簱 /// </summary> public List<string> library = new List<string>(); /// <summary> - /// 绾㈠鐮� + /// /// </summary> - public List<ButtonObj> status = new List<ButtonObj>(); + public List<AttributesStatus> status = new List<AttributesStatus>(); } - [System.Serializable] - public class ButtonObj - { - public string Key = string.Empty; - /// <summary> - /// #app 鏄剧ず鐨勬枃瀛� - /// </summary> - public string value = string.Empty; - } + [System.Serializable] public class DeviceType { @@ -92,7 +88,6 @@ public string brandName = string.Empty; } - public class Library { /// <summary> diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs index 902b7ee..b1e7b74 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs @@ -135,14 +135,7 @@ ///绾㈠瀹濈偣鍑讳簨浠� FrameLayout clickFLayout = new FrameLayout(); pirDeviceFLayout.AddChidren(clickFLayout); - clickFLayout.MouseUpEventHandler += (sender, e) => - { - - DeviceSet deviceSet = new DeviceSet(); - MainPage.BasePageView.AddChidren(deviceSet); - deviceSet.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; + FrameLayout deviceListFLayout = new FrameLayout(); deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12); @@ -282,6 +275,19 @@ }; + clickFLayout.MouseUpEventHandler += (sender, e) => + { + + DeviceSet deviceSet = new DeviceSet(); + MainPage.BasePageView.AddChidren(deviceSet); + deviceSet.Show(() => { + if (Pir.currPir != null) + { + deviceNameBtn.Text = Pir.currPir.name; + } + }); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; #endregion int line = 0; for (int i = 1, j = 0; i <= 7; i++, j++) @@ -451,7 +457,7 @@ case 2: { //鐢佃 - type = "tv-" + SPK.ElectricTV; + type = "tv-" + SPK.TvIr; } break; case 3: diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs index 6c253dc..9ef310f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq; using System.Collections.Generic; using Shared; +using HDL_ON.Entity; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { @@ -12,7 +13,6 @@ public class PirSend { - public static string pirId = "1367032976869658625"; /// <summary> /// 浣忓畢ID /// </summary> @@ -51,6 +51,19 @@ return responsePackNew; } /// <summary> + /// 鑾峰彇璁惧璇︽儏閫氳繃(spk,sid) + /// </summary> + /// <returns></returns> + public static ResponsePackNew GetinfoBySid(Control control) + { + var jObject = new JObject { }; + jObject.Add("homeId", HomeId); + jObject.Add("spk", control.spk); + jObject.Add("sid", control.sid); + var responsePackNew = RequestServerhomeId(jObject, NewAPI.Api_Post_GetinfoBySid); + return responsePackNew; + } + /// <summary> /// 鑾峰彇閬ユ帶鍣ㄥ垪琛� /// </summary> public static ResponsePackNew ControlList(Pir pir) @@ -75,7 +88,7 @@ jObject.Add("type", control.type); if (control.type=="library") { - jObject.Add("group_id", control.group_id); + jObject.Add("groupId", control.groupId); var libraryjay = new JArray { }; for (int i = 0; i < control.library.Count; i++) { @@ -97,8 +110,8 @@ jObject.Add("homeId", HomeId); jObject.Add("deviceId", control.deviceId); jObject.Add("spk", control.spk); - if (control.spk== Entity.SPK.AcStandard) { - jObject.Add("group_id", control.group_id); + if (control.spk== SPK.AcIr) { + jObject.Add("groupId", control.groupId); } var libraryJay = new JArray { }; for (int i = 0; i < control.library.Count; i++) @@ -110,7 +123,7 @@ { var statusJob = new JObject { }; var job = control.status[i]; - statusJob.Add("key", job.Key); + statusJob.Add("key", job.key); statusJob.Add("value", job.value); statusJay.Add(statusJob); } @@ -124,7 +137,7 @@ /// 绾㈠鐮佸涔� /// </summary> /// <returns></returns> - public static void CodeStudy(ButtonObj buttonObj, Action<ResponsePackNew> action) + public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action) { //var whichDayJson = jay["whichDay"].ToString(); //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson); @@ -134,14 +147,14 @@ // timer.whichDay.Add(int.Parse(days)); //} var job = new JObject { }; - job.Add("key", buttonObj.Key); + job.Add("key", buttonObj.key); job.Add("data_type", "string"); var valuejArray = new JArray { }; valuejArray.Add(buttonObj.value); job.Add("value", valuejArray); var jArray = new JArray { }; jArray.Add(job); - var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } }; ResponsePackNew responsePackNew = null; new System.Threading.Thread(() => { @@ -167,17 +180,17 @@ /// 鑷鎸夐敭鍒犻櫎 /// </summary> /// <returns></returns> - public static ResponsePackNew CodeRemove(ButtonObj buttonObj) + public static ResponsePackNew CodeRemove(AttributesStatus buttonObj,string deviceId) { var job = new JObject { }; - job.Add("key", buttonObj.Key); + job.Add("key", buttonObj.key); job.Add("data_type", "string"); var valuejArray = new JArray { }; valuejArray.Add(buttonObj.value); job.Add("value", valuejArray); var jArray = new JArray { }; jArray.Add(job); - var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove); return responsePackNew; } @@ -193,12 +206,12 @@ return responsePackNew; } /// <summary> - /// 淇敼绾㈠瀹濆悕绉� + /// 淇敼绾㈠瀹�/璁惧鍚嶇О /// </summary> /// <returns></returns> - public static ResponsePackNew DeviceRename(Pir pir) + public static ResponsePackNew DeviceRename(string deviceId,string name) { - var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } }; + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "name", name} }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename); return responsePackNew; } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs new file mode 100644 index 0000000..a2caf6c --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs @@ -0,0 +1,113 @@ +锘縰sing System; +using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; +using Shared; + +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View +{ + public class ControlView + { + /// <summary> + /// 鐖舵帶浠� + /// </summary> + public RowLayout funControlRow = new RowLayout + { + Width = Application.GetRealWidth(375 - 16 * 2), + Height = Application.GetRealHeight(50), + LineColor = CSS.CSS_Color.textWhiteColor, + SubViewWidth = Application.GetRealWidth(68), + }; + /// <summary> + /// 閬ユ帶鍣ㄥ悕绉� + /// </summary> + public Button nameBtn = new Button + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(20), + //Text = control.name, + TextAlignment = TextAlignment.CenterLeft, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + Gravity = Gravity.CenterVertical, + }; + + /// <summary> + /// 閬ユ帶鍣ㄥ尯鍩� + /// </summary> + public Button areaBtn = new Button + { + X = Application.GetRealWidth(311 + 16 - (40 + 100)), + Width = Application.GetRealWidth(100), + Height = Application.GetRealHeight(17), + //Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control), + TextAlignment = TextAlignment.CenterRight, + TextSize = TextSize.text12, + TextColor = CSS.CSS_Color.textCancelColor, + Gravity = Gravity.CenterVertical, + }; + + /// <summary> + /// 涓嬩竴绾у浘鏍� + /// </summary> + public Button nextIconBtn = new Button + { + X = Application.GetRealWidth(295 + 16), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "PirIcon/next.png", + Gravity = Gravity.CenterVertical, + }; + + + /// <summary> + /// 鍒犻櫎 + /// </summary> + public Button delBtn = new Button + { + Width = Application.GetRealWidth(50), + Height = Application.GetRealHeight(22), + TextID = StringId.Del, + TextAlignment = TextAlignment.Center, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textWhiteColor, + IsBold = true, + BackgroundColor = CSS.CSS_Color.textRedColor, + //Tag = control, + }; + + /// <summary> + /// 绾� + /// </summary> + public Button line1Btn = new Button + { + Y = Application.GetRealHeight(50 - 2), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(311), + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + }; + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + public Button clickBtn = new Button + { + Width = Application.GetRealWidth(375 - 16 * 2), + Height = Application.GetRealHeight(50), + }; + /// <summary> + /// view鏂规硶 + /// </summary> + /// <param name="frame"></param> + public void Show(FrameLayout frame, int i) + { + funControlRow.Y = Application.GetRealHeight(92 + (50 * i)); + frame.AddChidren(funControlRow); + funControlRow.AddChidren(nameBtn); + funControlRow.AddChidren(areaBtn); + funControlRow.AddChidren(nextIconBtn); + funControlRow.AddRightView(delBtn); + funControlRow.AddChidren(line1Btn); + funControlRow.AddChidren(clickBtn); + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs index f224e9d..abe1886 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs @@ -52,7 +52,6 @@ View.SaveView saveView = new View.SaveView(); dialog.AddChidren(saveView.FLayoutView()); saveView.btnSave.TextID = StringId.chongshii; - saveView.frameLayout.BackgroundColor = CSS.CSS_Color.viewLine; saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); dialog.Show(); saveView.btnClick.MouseUpEventHandler += (sender,e) => { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs new file mode 100644 index 0000000..eacada3 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs @@ -0,0 +1,91 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using Shared; +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View +{ + public class FrameLayout50 + { + /// <summary> + /// 涓绘帶浠禫iew + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS.CSS_Color.view, + }; + + /// <summary> + /// 鏂囨湰鎻忚堪 + /// </summary> + public Button btnText = new Button + { + TextSize = TextSize.Text16, + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(22), + TextColor = CSS.CSS_Color.textColor, + X = Application.GetRealWidth(16), + }; + + /// <summary> + /// 缂栬緫鏂囨湰 + /// </summary> + public Button btnEditText = new Button + { + Width = Application.GetRealWidth(357 - 52 - 200 - 16), + Height = Application.GetRealHeight(20), + TextSize = TextSize.Text14, + TextColor = CSS.CSS_Color.textCancelColor, + X = Application.GetRealWidth(200 + 16), + TextAlignment = TextAlignment.CenterRight, + }; + + + /// <summary> + /// 鍥炬爣 + /// </summary> + public Button btnNextIcon = new Button + { + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "LogicIcon/next.png", + X = Application.GetRealWidth(339), + + }; + + /// <summary> + /// 绾� + /// </summary> + public Button btnLine = new Button + { + Width = Application.GetRealWidth(375 - 32), + X = Application.GetRealWidth(16), + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + + }; + + public Button btnClick = new Button + { + Height = Application.GetRealHeight(50), + }; + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <returns></returns> + public FrameLayout FLayoutView() + { + btnText.Gravity = Gravity.CenterVertical; + btnText.TextAlignment = TextAlignment.CenterLeft; + btnNextIcon.Gravity = Gravity.CenterVertical; + btnEditText.Gravity = Gravity.CenterVertical; + frameLayout.AddChidren(btnText); + frameLayout.AddChidren(btnEditText); + frameLayout.AddChidren(btnNextIcon); + btnLine.Y = frameLayout.Height - 1; + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnClick); + return frameLayout; + } + } +} + diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs new file mode 100644 index 0000000..37368a5 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs @@ -0,0 +1,174 @@ +锘縰sing System; +using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; +using Shared; +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View +{ + public class PirView + { + + /// <summary> + /// 鐖舵帶浠� + /// </summary> + public FrameLayout devfLayout = new FrameLayout + { + Y = Application.GetRealHeight(12), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(375 - 16 * 2), + // Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)), + BackgroundColor = CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12), + }; + /// <summary> + /// 鍥炬爣 + /// </summary> + public Button priequipmentBtn = new Button + { + Y = Application.GetRealHeight(16), + X = Application.GetRealWidth(5), + Width = Application.GetRealWidth(60), + Height = Application.GetRealWidth(60), + UnSelectedImagePath = "PirIcon/priequipment.png", + TextAlignment = TextAlignment.Center, + }; + + /// <summary> + /// 鍚嶇О + /// </summary> + public Button deviceNameBtn = new Button + { + Y = Application.GetRealHeight(16), + X = Application.GetRealWidth(72), + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(20), + //Text = pirDevice.name, + TextAlignment = TextAlignment.CenterLeft, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + IsBold = true, + }; + + + /// <summary> + /// 鐗堟湰鍙� + /// </summary> + public Button versionBtn = new Button + { + Y = Application.GetRealHeight(40), + X = Application.GetRealWidth(72), + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(17), + Text = "鐗堟湰鍙穠1.3.5", + TextAlignment = TextAlignment.CenterLeft, + TextSize = TextSize.text12, + TextColor = CSS.CSS_Color.textCancelColor, + }; + + /// <summary> + /// 褰撳墠涓暟 + /// </summary> + public Button geBtn = new Button + { + Y = Application.GetRealHeight(59), + X = Application.GetRealWidth(72), + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(17), + //Text = pirDevice.FunctioList.Count.ToString(), + TextAlignment = TextAlignment.CenterLeft, + TextSize = TextSize.text12, + TextColor = CSS.CSS_Color.textConfirmColor, + }; + + /// <summary> + /// 鎬绘暟 + /// </summary> + public Button sumBtn = new Button + { + Y = Application.GetRealHeight(59), + + Width = Application.GetRealWidth(20), + Height = Application.GetRealHeight(17), + Text = "/10", + TextAlignment = TextAlignment.CenterLeft, + TextSize = TextSize.text12, + TextColor = CSS.CSS_Color.textCancelColor, + }; + + /// <summary> + /// 鐘舵�佸浘鏍� + /// </summary> + public Button stateIconBtn = new Button + { + Y = Application.GetRealHeight(23), + X = Application.GetRealWidth(291), + Width = Application.GetRealWidth(8), + Height = Application.GetRealWidth(8), + UnSelectedImagePath = "PirIcon/online.png", + SelectedImagePath = "PirIcon/offline.png", + }; + + /// <summary> + /// 绾㈠瀹濈姸鎬侊紙鍦ㄧ嚎-绂荤嚎锛� + /// </summary> + public Button stateTextBtn = new Button + { + Y = Application.GetRealHeight(18), + X = Application.GetRealWidth(303), + Width = Application.GetRealWidth(30), + Height = Application.GetRealHeight(17), + TextID = StringId.zaixianhwb, + TextAlignment = TextAlignment.CenterLeft, + TextSize = TextSize.text12, + TextColor = 0xFF67D569,// CSS.CSS_Color.textColor, + SelectedTextColor = CSS.CSS_Color.textRedColor, + IsBold = true, + }; + /// <summary> + /// 绾� + /// </summary> + public Button lineBtn = new Button + { + Y = Application.GetRealHeight(92) - 1, + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(343 - 16 * 2), + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + }; + + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + public Button clickBtn = new Button + { + Y = Application.GetRealHeight(12), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(375 - 16 * 2), + Height = Application.GetRealHeight(92), + BackgroundColor = 0x00000000, //CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12), + //Tag = Pir.pirDeviceList[i], + }; + /// <summary> + /// view鏂规硶 + /// </summary> + /// <param name="i"></param> + /// <param name="fLayout"></param> + public void Show(int i, FrameLayout fLayout) + { + + + fLayout.AddChidren(devfLayout); + devfLayout.Height = Application.GetRealHeight(92 + (50 * i)); + devfLayout.AddChidren(priequipmentBtn); + devfLayout.AddChidren(deviceNameBtn); + devfLayout.AddChidren(versionBtn); + devfLayout.AddChidren(geBtn); + geBtn.Width = geBtn.GetTextWidth(); + devfLayout.AddChidren(sumBtn); + sumBtn.X = geBtn.Right; + devfLayout.AddChidren(stateIconBtn); + devfLayout.AddChidren(stateTextBtn); + devfLayout.AddChidren(lineBtn); + devfLayout.AddChidren(clickBtn); + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs index 37e24d9..2b8b5d4 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs @@ -15,6 +15,8 @@ Width = Application.GetRealWidth(TextSize.view375), Gravity = Gravity.BottomCenter,//缃簳鐨勫睘鎬� BackgroundColor = CSS.CSS_Color.view, + BorderWidth = 1, + BorderColor = CSS.CSS_Color.viewLine, }; /// <summary> @@ -33,6 +35,7 @@ BackgroundColor = CSS.CSS_Color.btnSaveBackgroundColor, Radius = (uint)Application.GetRealHeight(22), + }; public Button btnClick = new Button { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs index b86395d..9a2280b 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs @@ -15,6 +15,186 @@ /// 灏忔鍦嗚鍊� /// </summary> public int radiusEditFrameLayout = 4; + /// <summary> + /// 杈撳叆妗� + /// </summary> + /// <param name="titleId">鏍囬鏂囨湰</param> + /// <param name="tnputEditTxet">鏄剧ず鏂囨湰</param> + /// <param name="errorId_IsNullOrEmpty">杈撳叆妗嗘枃鏈负绌鸿嚜瀹氫箟鎻愮ず閿欒鏂囨湰</param> + /// <param name="errorId_PresenceP">妫�绱㈠凡瀛樺湪鍚嶇О鑷畾涔夋彁绀洪敊璇枃鏈�</param> + /// <param name="confirmAction">鍥炶皟鍑芥暟</param> + /// <param name="List">琚绱㈠垪琛�</param> + /// <param name="confirmAction">鍥炶皟鍑芥暟</param> + public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string, Dialog> confirmAction, Action action, bool tag = true) + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + + FrameLayout whiteView = new FrameLayout() + { + //Gravity = Gravity.Center, + X = Application.GetRealWidth(53), + Y = Application.GetRealHeight(264), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(172), + BackgroundColor = CSS_Color.view, + BorderColor = CSS_Color.viewTranslucence, + BorderWidth = 0, + Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), + }; + dialog.AddChidren(whiteView); + + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(20), + X = Application.GetRealWidth(35), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(200), + TextColor = CSS_Color.textConfirmColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = titleId, + + }; + whiteView.AddChidren(btnTitle); + + FrameLayout editBjView = new FrameLayout() + { + // Gravity = Gravity.CenterHorizontal, + Y = btnTitle.Bottom + Application.GetRealHeight(16), + X = Application.GetRealWidth(24), + Width = Application.GetRealWidth(222), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.viewMiddle, + BorderColor = CSS_Color.viewTranslucence, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), + }; + whiteView.AddChidren(editBjView); + + EditText editText = new EditText() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealHeight(10), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(20), + Text = tnputEditTxet, + TextColor = CSS_Color.textColor, + TextSize = TextSize.Text14, + TextAlignment = TextAlignment.CenterLeft, + + }; + editBjView.AddChidren(editText); + + Button clearIconBtn = new Button + { + X = Application.GetRealWidth(194), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + UnSelectedImagePath = "MusicIcon/clear.png", + }; + editBjView.AddChidren(clearIconBtn); + clearIconBtn.MouseUpEventHandler += (sender, e) => + { + editText.Text = ""; + }; + + Button btnLine = new Button() + { + Y = whiteView.Height - Application.GetRealHeight(44 + 1), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.viewLine, + }; + whiteView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.textTipColor, + TextSize = TextSize.Text16, + TextID = StringId.cancelMusic, + Gravity = Gravity.BottomLeft, + }; + whiteView.AddChidren(btnCancel); + btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); + Button btnConfirm = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.view, + IsBold = true, + TextSize = TextSize.Text16, + TextID = StringId.confirmMusic, + BackgroundColor = CSS_Color.textConfirmColor, + Gravity = Gravity.BottomRight, + }; + whiteView.AddChidren(btnConfirm); + btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); + + dialog.Show(); + btnCancel.MouseUpEventHandler += (sender, e) => + { + dialog.Close(); + action(); + + }; + Button btnTip = new Button + { + Width = Application.GetRealWidth(0), + }; + whiteView.AddChidren(btnTip);//涓�鐩撮敊璇紝涓�鐩寸寷鐐癸紝涓�鐩村姞鎺т欢 + btnConfirm.MouseUpEventHandler += (sender, e) => + { + string listNameText = editText.Text.Trim(); + if (string.IsNullOrEmpty(listNameText) || List.Contains(listNameText)) + { + string tipMsgString = ""; + if (string.IsNullOrEmpty(editText.Text.Trim())) + { + tipMsgString = Language.StringByID(errorId_IsNullOrEmpty); + } + else + { + tipMsgString = Language.StringByID(errorId_PresenceP); + } + + whiteView.Height = Application.GetRealHeight(183); + btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1); + btnCancel.Y = btnLine.Bottom; + btnCancel.Gravity = Gravity.BottomLeft; + btnConfirm.Y = btnLine.Bottom; + btnConfirm.Gravity = Gravity.BottomRight; + + btnTip.X = Application.GetRealWidth(24); + btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12); + btnTip.Width = Application.GetRealWidth(222); + btnTip.Height = Application.GetRealHeight(17); + btnTip.Text = tipMsgString; + btnTip.TextColor = CSS_Color.textRedColor; + btnTip.TextSize = TextSize.Text12; + btnTip.TextAlignment = TextAlignment.CenterLeft; + + return; + } + + + confirmAction(editText.Text.Trim(), dialog); + if (tag) + { + dialog.Close(); + } + }; + + } /// <summary> /// 杈撳叆妗� @@ -326,7 +506,178 @@ } + /// <summary> + /// 纭畾鎻愮ず妗� + /// </summary> + /// <param name="titleId">鏍囬鏂囨湰</param> + /// <param name="tipTxet">鑷畾涔夋彁绀烘枃鏈�</param> + /// <param name="confirmAction">鍥炶皟鍑芥暟</param> + public void TipBox(int titleId, int tipTxet, Action confirmAction) + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + + FrameLayout whiteView = new FrameLayout() + { + //Gravity = Gravity.Center, + X = Application.GetRealWidth(53), + Y = Application.GetRealHeight(264), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(140), + BackgroundColor = CSS_Color.view, + BorderColor = CSS_Color.viewTranslucence, + BorderWidth = 0, + Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), + }; + dialog.AddChidren(whiteView); + + Button titleBtn = new Button() + { + Y = Application.GetRealHeight(20), + X = Application.GetRealWidth(35), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(270 - 35 * 2), + TextColor = CSS_Color.textConfirmColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = titleId, + }; + whiteView.AddChidren(titleBtn); + + Button tipBtn = new Button() + { + Y = titleBtn.Bottom + Application.GetRealHeight(8), + X = Application.GetRealWidth(20), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(270 - 20 * 2), + TextColor = CSS_Color.textTipColor, + TextSize = TextSize.Text12, + TextAlignment = TextAlignment.Center, + TextID = tipTxet, + }; + whiteView.AddChidren(tipBtn); + Button btnLine = new Button() + { + Y = whiteView.Height - Application.GetRealHeight(44 + 1), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.viewLine, + }; + whiteView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.textTipColor, + TextSize = TextSize.Text16, + TextID = StringId.cancelMusic, + Gravity = Gravity.BottomLeft, + }; + whiteView.AddChidren(btnCancel); + btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); + Button btnConfirm = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.view, + IsBold = true, + TextSize = TextSize.Text16, + TextID = StringId.confirmMusic, + BackgroundColor = CSS_Color.textConfirmColor, + Gravity = Gravity.BottomRight, + }; + whiteView.AddChidren(btnConfirm); + btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); + dialog.Show(); + btnCancel.MouseUpEventHandler += (sender, e) => + { + dialog.Close(); + }; + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + confirmAction(); + dialog.Close(); + }; + + } + /// <summary> + /// 閿欒淇℃伅鎻愮ず绐楀彛锛屾墜鍔ㄧ‘瀹氬叧闂� + /// </summary> + /// <param name="titleId">鏍囬鏂囨湰</param> + /// <param name="msgId">鎻愮ず閿欒鏂囨湰</param> + public void TipBox(int titleId, int msgId) + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS_Color.viewTrans60lucence, + }; + + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(140), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), + }; + dialog.AddChidren(contentView); + + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(20), + Height = Application.GetRealHeight(22), + TextColor = CSS_Color.MainColor, + TextSize =TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = titleId, + }; + contentView.AddChidren(btnTitle); + + Button btnMsg = new Button() + { + Height = Application.GetRealHeight(17), + Y = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = TextSize.Text12, + TextID = msgId, + }; + contentView.AddChidren(btnMsg); + + Button btnLine = new Button() + { + Y = Application.GetRealHeight(96), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.viewLine, + }; + contentView.AddChidren(btnLine); + + Button btnConfirm = new Button() + { + Y = btnLine.Bottom, + Height = Application.GetRealHeight(43), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = TextSize.Text16, + TextID = StringId.Close, + }; + contentView.AddChidren(btnConfirm); + dialog.Show(); + btnConfirm.MouseUpEventHandler += (sender, e) => + { + dialog.Close(); + }; + + } } } -- Gitblit v1.8.0