From 2ae36ddb40d28c62b64a2fdd4c3033e7d65d5cfb Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 04 三月 2021 15:20:29 +0800 Subject: [PATCH] 2021-0304-1 --- HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 17 HDL_ON/Entity/Function/Light.cs | 14 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs | 14 HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs | 47 HDL_ON/HDL_ON.projitems | 1 HDL-ON_iOS/Info.plist | 4 HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs | 36 HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs | 8 HDL_ON/Entity/Function/AC.cs | 405 ++++++---- HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs | 21 HDL_ON/DAL/DriverLayer/Packet.cs | 24 HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs | 83 - .vs/HDL_APP_Project/xs/UserPrefs.xml | 58 + HDL_ON/DAL/DriverLayer/Control.cs | 112 -- HDL_ON/UI/UI1-Login/LoginPage.cs | 5 HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs | 37 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs | 4 HDL_ON/Entity/Function/Scene.cs | 218 ++++ HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs | 40 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 14 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs | 8 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs | 4 HDL_ON/DAL/DriverLayer/Control_Udp.cs | 24 HDL_ON/Entity/FunctionList.cs | 353 -------- HDL_ON/Entity/Function/Function.cs | 88 - HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 6 HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs | 22 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 38 HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs | 623 +++++++++++++++ 31 files changed, 1,375 insertions(+), 959 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index bf727a7..e19ddc8 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,33 +1,59 @@ -锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> +锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs" Line="152" Column="16" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" Line="142" Column="51" /> - <File FileName="HDL_ON/UI/MainPage.cs" Line="29" Column="55" /> - <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="432" Column="43" /> - <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="242" Column="30" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="863" Column="51" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="377" Column="49" /> + <File FileName="HDL_ON/Entity/FunctionList.cs" Line="370" Column="38" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" Line="58" Column="22" /> + <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="153" Column="41" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs" /> + <File FileName="HDL_ON/Common/ApiUtlis.cs" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs" Line="98" Column="21" /> + <File FileName="HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs" Line="41" Column="42" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs" Line="789" Column="42" /> + <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="209" Column="31" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs" Line="83" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs" Line="9" Column="32" /> + <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="218" Column="58" /> + <File FileName="HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs" Line="47" Column="35" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> + <Node name="Common" expanded="True"> + <Node name="Utlis" expanded="True" /> + </Node> + <Node name="DAL" expanded="True"> + <Node name="DriverLayer" expanded="True" /> + </Node> + <Node name="Entity" expanded="True"> + <Node name="Function" expanded="True" /> + </Node> <Node name="UI" expanded="True"> + <Node name="UI0-Public" expanded="True"> + <Node name="UpdataSidDataDialog.cs" selected="True" /> + </Node> + <Node name="UI0-Stan" expanded="True"> + <Node name="Logic" expanded="True" /> + </Node> + <Node name="UI1-Login" expanded="True" /> <Node name="UI2" expanded="True"> - <Node name="1-HomePage" expanded="True"> - <Node name="HomePageBLL.cs" selected="True" /> - </Node> + <Node name="1-HomePage" expanded="True" /> <Node name="2-Classification" expanded="True" /> + <Node name="3-Intelligence" expanded="True"> + <Node name="Scene" expanded="True" /> + </Node> <Node name="FuntionControlView" expanded="True"> + <Node name="AC" expanded="True" /> + <Node name="ArmSensor" expanded="True" /> + <Node name="Curtain" expanded="True" /> <Node name="Electrical" expanded="True" /> + <Node name="Light" expanded="True" /> </Node> </Node> </Node> </Node> - <Node name="HDL-ON_iOS" expanded="True" /> <Node name="ys" expanded="True" /> </Node> </State> @@ -40,10 +66,12 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> - <BreakpointStore /> + <BreakpointStore> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="458" column="1" /> + </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> </Properties> \ No newline at end of file diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 3cc2844..7456bfe 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103031" android:versionName="1.1.202103031" package="com.hdl.onpro"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103032" android:versionName="1.1.202103032" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" /> <!-- 瀹氫綅鏉冮檺--> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index 6fbd3df..1e97d34 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -102,9 +102,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.1.202103031</string> + <string>1.1.202103032</string> <key>CFBundleVersion</key> - <string>202103031</string> + <string>202103032</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Use geographic location to provide services such as weather</string> <key>NSAppleMusicUsageDescription</key> diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 1d8c208..386bc5a 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -65,63 +65,6 @@ /// </summary> public bool IsSearchLocalGatewaySuccessful = false; - ///// <summary> - ///// - ///// </summary> - //bool _gatewayOnline1 = false; - ///// <summary> - ///// 缃戝叧鏄惁鍦ㄧ嚎 - ///// </summary> - //public bool GatewayOnline1 - //{ - // get - // { - // return _gatewayOnline; - // } - // set - // { - // if (_gatewayOnline != value) - // { - // if(value) - // { - // if (IsRemote)//濡傛灉鏄繙绋� - // { - // if(DB_ResidenceData.Instance.HomeGateway == null) - // { - // return; - // } - // if (!DB_ResidenceData.Instance.HomeGateway.gatewayStatus)//杩滅▼鎯呭喌涓嬶紝缃戝叧鏈摼鎺ユ湇鍔″櫒涓嶈兘淇敼涓婚〉缃戝叧鐘舵�� - // { - // new System.Threading.Thread(() => { - // System.Threading.Thread.Sleep(3000); - // var pm = new DAL.Server.HttpServerRequest(); - // pm.GetGatewayInfo(); - // }) { IsBackground = true }.Start(); - // return; - // } - // } - // _gatewayOnline = value; - // //淇敼涓婚〉杩炴帴鐘舵�� - // HomePage.LoadEvent_CheckLinkStatus(); - // MainPage.Log($"缃戝叧鍦ㄧ嚎锛屽埛鏂拌澶囩姸鎬�"); - // new System.Threading.Thread(() => - // { - // System.Threading.Thread.Sleep(1000); - // FunctionList.List.ReadAllFunctionStatus(); - // }) - // { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start(); - // } - // else - // { - // _gatewayOnline = value; - // //淇敼涓婚〉杩炴帴鐘舵�� - // HomePage.LoadEvent_CheckLinkStatus(); - // } - // } - // } - //} - - bool _GatewayOnline_Local = false; /// <summary> /// 缃戝叧鍦ㄧ嚎-灞�鍩熺綉 @@ -511,7 +454,8 @@ var pack = pm.GetDeviceInfoList(functionIds); if(pack!= null&& pack.Data!=null) { - var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(pack.Data.ToString()); + //寰呮祴璇�2021-03-04 + var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlinkStatusData>>(pack.Data.ToString()); if(ddd!= null) { foreach(var function in ddd) @@ -519,10 +463,9 @@ var temp = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == function.deviceId); if(temp!= null) { - temp = function; if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(temp.spk)) { - Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(temp.sid, temp.status); + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(temp.sid, function.status); } } } @@ -577,21 +520,6 @@ var pack = pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); } } - ///// <summary> - ///// 鍙戦�丄鍗忚璇诲彇鍛戒护 - ///// </summary> - //public void SendReadCommand(List<Dictionary<string, string>> keyValuePairs) - //{ - // var readDataObj = new GatewayAlinkReadObj() - // { - // id = Ins.msg_id.ToString(), - // objects = keyValuePairs, - // time_stamp = Utlis.GetTimestamp() - // }; - // var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); - // var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadStatus, functionControlDataJson); - // Ins.myUdp.SendLocalHdlLinkData(sendBytes); - //} /// <summary> /// a鍗忚鎺у埗鍦烘櫙 @@ -601,16 +529,8 @@ { if (!Ins.GatewayOnline_Local)//缃戝叧鏈湴涓嶅湪绾� { - //浜戠鍋氬鐞嗗彂閫佷竴绔彛鍦烘櫙 - //if (DB_ResidenceData.Instance.GatewayType == 0) - //{ - // new Control_Udp().ControlBusScenes(scene); - //} - //else - { - var pm = new DAL.Server.HttpServerRequest(); - var result = pm.ExecuteScene(scene.userSceneId); - } + var pm = new DAL.Server.HttpServerRequest(); + var result = pm.ExecuteScene(scene.userSceneId); } else { @@ -765,11 +685,7 @@ //MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}"); foreach (var attr in updateTemp.status) { - var attrState = localFunction.status.Find((func) => func.key == attr.key); - if(attrState!= null) - { - attrState.value = attr.value; - } + localFunction.SetAttrState(attr.key,attr.value); } if (localFunction != null) @@ -791,7 +707,6 @@ localAttr.curValue = attr.value; } } - //rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + rgb.brightness + "%"; RelayPage.UpdataState(localSwitch); } break; @@ -932,7 +847,7 @@ } } ac.lastState = ""; - switch (ac.trait_mode.curValue.ToString()) + switch (ac.GetAttrState(FunctionAttributeKey.Mode)) { case "cool": ac.lastState = Language.StringByID(StringId.Cool); @@ -950,7 +865,7 @@ ac.lastState = Language.StringByID(StringId.AirSupply); break; } - switch (ac.trait_fan.curValue.ToString()) + switch (ac.GetAttrState(FunctionAttributeKey.FanSpeed)) { case "high": ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed); @@ -965,7 +880,7 @@ ac.lastState += " " + Language.StringByID(StringId.Auto); break; } - ac.lastState += " " + ac.trait_temp.curValue + ac.tempUnitString; + ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString; ACPage.UpdataStates(ac); } break; @@ -1051,14 +966,9 @@ case SPK.SensorSmoke: case SPK.SensorWater: case SPK.ClothesHanger: + case SPK.IrAC: //璁惧鐘舵�佹帹閫� - var myDevice = Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid,updateTemp.status); - if (myDevice != null) - { - localObj = myDevice; - } - break; - default: + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid,updateTemp.status); break; } if (localObj != null) diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs index 507f1c1..456591d 100644 --- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs +++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs @@ -198,14 +198,14 @@ tempAc.trait_on_off.curValue = attr.value; break; case FunctionAttributeKey.Mode: - tempAc.trait_mode.curValue = attr.value; + tempAc.SetAttrState(FunctionAttributeKey.Mode, attr.value); break; case FunctionAttributeKey.FanSpeed: - tempAc.trait_fan.curValue = attr.value; + tempAc.SetAttrState(FunctionAttributeKey.FanSpeed, attr.value); break; case FunctionAttributeKey.SetTemp: - tempAc.trait_temp.curValue = attr.value; - switch (tempAc.curModeIndex) + tempAc.SetAttrState(FunctionAttributeKey.SetTemp, attr.value); + switch (tempAc.curModeIndex()) { case 3: modeKey = 8; @@ -226,9 +226,9 @@ break; } ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 3, tempAc.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, f.localFunction.bus.LoopId }); - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, tempAc.curModeIndex, f.localFunction.bus.LoopId }); - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, tempAc.curFanIndex, f.localFunction.bus.LoopId }); - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(tempAc.trait_temp.curValue), f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, tempAc.curModeIndex(), f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, tempAc.curFanIndex(), f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(tempAc.GetAttrState(FunctionAttributeKey.SetTemp)), f.localFunction.bus.LoopId }); } break; case SPK.LightSwitch: @@ -468,7 +468,7 @@ { case SPK.AcStandard: var aC = function as AC; - ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { aC.bus.LoopId, (byte)aC.curTempType, 32, 32, 32, 32, 32, 0, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.curModeIndex, aC.curFanIndex, Convert.ToByte(aC.trait_temp.curValue), 0 }); + ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { aC.bus.LoopId, (byte)aC.curTempType, 32, 32, 32, 32, 32, 0, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.curModeIndex(), aC.curFanIndex(), Convert.ToByte(aC.GetAttrState(FunctionAttributeKey.SetTemp)), 0 }); //ControlBytesSend(Command.InstructionPanelKey, aC.bus_Data.SubnetID, aC.bus_Data.DeviceID, new byte[] { 3, aC.on_off == "on" ? (byte)1 : (byte)0, aC.bus_Data.loopId }); foreach (var dic in commandDictionary) { @@ -478,14 +478,14 @@ ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 3, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.bus.LoopId }); break; case "mode": - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 6, aC.curModeIndex, aC.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 6, aC.curModeIndex(), aC.bus.LoopId }); break; case "fan": - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 5, aC.curFanIndex, aC.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 5, aC.curFanIndex(), aC.bus.LoopId }); break; case "temp": byte modeKey = 4; - switch (aC.curModeIndex) + switch (aC.curModeIndex()) { case 3: modeKey = 8; @@ -503,7 +503,7 @@ modeKey = 2; break; } - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(aC.trait_temp.curValue), aC.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(aC.GetAttrState(FunctionAttributeKey.SetTemp)), aC.bus.LoopId }); break; default: MainPage.Log($"鍔熻兘鏈敮鎸� : {dic.Key}"); diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs index 2a4ae74..323b918 100644 --- a/HDL_ON/DAL/DriverLayer/Packet.cs +++ b/HDL_ON/DAL/DriverLayer/Packet.cs @@ -315,13 +315,13 @@ if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { ac.curTempType = receiveBytes[1]; - ac.trait_IndoorTemp.curValue = receiveBytes[2].ToString(); + ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString()); ac.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; - ac.curModeIndex = receiveBytes[9]; - ac.curFanIndex = receiveBytes[10]; - ac.trait_temp.curValue = receiveBytes[11].ToString(); + ac.SetModeIndex(receiveBytes[9]); + ac.SetFanIndex(receiveBytes[10]); + ac.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString()); ac.lastState = ""; - switch (ac.trait_mode.curValue.ToString()) + switch (ac.GetAttrState(FunctionAttributeKey.Mode)) { case "cool": ac.lastState = Language.StringByID(StringId.Cool); @@ -339,7 +339,7 @@ ac.lastState = Language.StringByID(StringId.AirSupply); break; } - switch (ac.trait_fan.curValue.ToString()) + switch (ac.GetAttrState(FunctionAttributeKey.FanSpeed)) { case "high": ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed); @@ -354,7 +354,7 @@ ac.lastState += " " + Language.StringByID(StringId.Auto); break; } - ac.lastState += " " + ac.trait_temp.curValue + ac.tempUnitString; + ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString; RoomPage.UpdataStates(ac); FunctionPage.UpdataStates(ac); HomePage.UpdataFunctionStates(ac); @@ -584,18 +584,18 @@ case 7: case 8: case 19: - ac.trait_temp.curValue = receiveBytes[1].ToString(); + ac.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString()); break; case 5: - ac.curFanIndex = receiveBytes[1]; + ac.SetFanIndex ( receiveBytes[1]); break; case 6: - ac.curModeIndex = receiveBytes[1]; + ac.SetModeIndex ( receiveBytes[1]); break; } ac.lastState = ""; - ac.lastState += " " + ac.trait_temp.curValue + ac.tempUnitString; + ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString; RoomPage.UpdataStates(ac); FunctionPage.UpdataStates(ac); HomePage.UpdataFunctionStates(ac); @@ -610,7 +610,7 @@ { if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { - ac.trait_IndoorTemp.curValue = receiveBytes[1].ToString(); + ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[1].ToString()); FunctionPage.UpdataStates(ac); } } diff --git a/HDL_ON/Entity/Function/AC.cs b/HDL_ON/Entity/Function/AC.cs index 32d7556..9b76ee4 100644 --- a/HDL_ON/Entity/Function/AC.cs +++ b/HDL_ON/Entity/Function/AC.cs @@ -1,23 +1,11 @@ 锘縰sing System; using System.Collections.Generic; +using Shared; namespace HDL_ON.Entity { public class AC : Function { - /* - * 绌鸿皟锛歵rait: [switch, mode, fan, set_temp, swing, lock] - * 灞炴�� 鎻忚堪 - * on_off on/off - * mode mode: auto, cool, heat, dry, fan - * fan high, medium, low, auto - * set_temp up,down,value - * swing up/down/left/right - * lock boolean (Lock閿佸畾鎺у埗) - */ - public AC() - { - } /// <summary> /// 褰撳墠娓╁害妯″紡 /// 0:鎽勬皬搴� @@ -47,130 +35,130 @@ /// 褰撳墠妯″紡绱㈠紩 /// bus鎺у埗鍛戒护浣跨敤 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public byte curModeIndex + public byte curModeIndex() { - get + try { - try - { - byte index = 0; - switch (trait_mode.curValue.ToString()) - { - case "auto": - index = 3; - break; - case "cool": - index = 0; - break; - case "heat": - index = 1; - break; - case "dry": - index = 4; - break; - case "fan": - index = 2; - break; - default: - index = 0; - break; - } - return index; - } - catch (Exception ex) - { - MainPage.Log($"get curModeIndex error : {ex.Message}"); - return 0; - } - } - set - { + string value = GetAttrState(FunctionAttributeKey.Mode); + byte index = 0; switch (value) { - case 0: - trait_mode.curValue = "cool"; + case "auto": + index = 3; break; - case 1: - trait_mode.curValue = "heat"; + case "cool": + index = 0; break; - case 2: - trait_mode.curValue = "fan"; + case "heat": + index = 1; break; - case 3: - trait_mode.curValue = "auto"; + case "dry": + index = 4; break; - case 4: - trait_mode.curValue = "dry"; + case "fan": + index = 2; break; default: - trait_mode.curValue = "cool"; + index = 0; break; - } + return index; + } + catch (Exception ex) + { + MainPage.Log($"get curModeIndex error : {ex.Message}"); + return 0; } } + + /// <summary> + /// 璁剧疆bus鍗忚妯″紡鏍囪 + /// </summary> + public void SetModeIndex(int index) + { + string value = "auto"; + switch (index) + { + case 3: + value = "auto"; + break; + case 0: + value = "cool"; + break; + case 1: + value = "heat"; + break; + case 4: + value = "dry"; + break; + case 2: + value = "fan"; + break; + } + SetAttrState(FunctionAttributeKey.Mode, value); + } + /// <summary> /// 褰撳墠椋庨�熺储寮� /// bus鎺у埗鍛戒护浣跨敤 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public byte curFanIndex + public byte curFanIndex() { - get + try { - try - { - byte index = 0; - switch (trait_fan.curValue.ToString()) - { - case "high": - index = 1; - break; - case "medium": - index = 2; - break; - case "low": - index = 3; - break; - case "auto": - index = 0; - break; - default: - index = 0; - break; - } - return index; - } - catch (Exception ex) - { - MainPage.Log($"get curFanIndex error : {ex.Message}"); - return 0; - } - } - set - { + string value = GetAttrState(FunctionAttributeKey.FanSpeed); + byte index = 0; switch (value) { - case 0: - trait_fan.curValue = "auto"; + case "high": + index = 1; break; - case 1: - trait_fan.curValue = "high"; + case "medium": + index = 2; break; - case 2: - trait_fan.curValue = "medium"; + case "low": + index = 3; break; - case 3: - trait_fan.curValue = "low"; + case "auto": + index = 0; break; default: - trait_fan.curValue = "high"; + index = 0; break; } + return index; + } + catch (Exception ex) + { + MainPage.Log($"get curFanIndex error : {ex.Message}"); + return 0; } } + /// <summary> + /// 璁剧疆bus鍗忚椋庨�熸爣璁� + /// </summary> + public void SetFanIndex(int index) + { + string value = "high"; + switch (index) + { + case 1: + value = "high"; + break; + case 2: + value = "medium"; + break; + case 3: + value = "low"; + break; + case 0: + value = "auto"; + break; + } + SetAttrState(FunctionAttributeKey.FanSpeed, value); + } + /* 鍘绘帀琛嶇敓灞炴�э紝閫氳繃base.GetAttrState 鏌ユ壘灞炴�т笌鐘舵�� FunctionAttributes _trait_mode; /// <summary> /// 妯″紡灞炴�� @@ -342,84 +330,171 @@ return _trait_IndoorTemp; } } + */ /// <summary> /// 褰撳墠妯″紡鐨刬con璺緞 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string curModeImage + /// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param> + /// <returns></returns> + public string GetModeIconPath(bool lightingIcon = true) { - get + var value = GetAttrState(FunctionAttributeKey.Mode); + var imagePath = "FunctionIcon/AC/CoolIcon.png"; + if (lightingIcon) { - try + switch (value) { - var imagePath = "FunctionIcon/AC/CoolIcon.png"; - switch (trait_mode.curValue.ToString()) - { - case "auto": - imagePath = "FunctionIcon/AC/AutoIcon.png"; - break; - case "cool": - imagePath = "FunctionIcon/AC/CoolIcon.png"; - break; - case "heat": - imagePath = "FunctionIcon/AC/HeatingIcon.png"; - break; - case "dry": - imagePath = "FunctionIcon/AC/DehumidificationIcon.png"; - break; - case "fan": - imagePath = "FunctionIcon/AC/AirSupplyIcon.png"; - break; - default: - imagePath = "FunctionIcon/AC/CoolIcon.png"; - break; - } - return imagePath; - } - catch (Exception ex) - { - MainPage.Log($"ac ge curModeImage error : {ex.Message}"); - return "FunctionIcon/AC/CoolIcon.png"; + case "auto": + imagePath = "FunctionIcon/AC/AutoIcon.png"; + break; + case "cool": + imagePath = "FunctionIcon/AC/CoolIcon.png"; + break; + case "heat": + imagePath = "FunctionIcon/AC/HeatingIcon.png"; + break; + case "dry": + imagePath = "FunctionIcon/AC/DehumidificationIcon.png"; + break; + case "fan": + imagePath = "FunctionIcon/AC/AirSupplyIcon.png"; + break; + default: + imagePath = "FunctionIcon/AC/CoolIcon.png"; + break; } } + else + { + imagePath = "FunctionIcon/AC/AutoIconGray.png"; + switch (value) + { + case "auto": + imagePath = "FunctionIcon/AC/AutoIconGray.png"; + break; + case "cool": + imagePath = "FunctionIcon/AC/CoolIconGray.png"; + break; + case "heat": + imagePath = "FunctionIcon/AC/HeatingIconGray.png"; + break; + case "dry": + imagePath = "FunctionIcon/AC/DehumidificationIconGray.png"; + break; + case "fan": + imagePath = "FunctionIcon/AC/AirSupplyIconGray.png"; + break; + } + } + return imagePath; } + /// <summary> /// 褰撳墠椋庨�熺殑icon璺緞 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string curFanImage + /// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param> + /// <returns></returns> + public string GetFanIconPath(bool lightingIcon = true) { - get + string value = GetAttrState(FunctionAttributeKey.FanSpeed); + var imagePath = "FunctionIcon/AC/WindHighIcon.png"; + if (lightingIcon) { - try + switch (value) { - var imagePath = "FunctionIcon/AC/WindHighIcon.png"; - switch (trait_fan.curValue.ToString()) - { - case "high": - imagePath = "FunctionIcon/AC/WindHighIcon.png"; - break; - case "medium": - imagePath = "FunctionIcon/AC/WindMediumIcon.png"; - break; - case "low": - imagePath = "FunctionIcon/AC/WindLowIcon.png"; - break; - case "auto": - imagePath = "FunctionIcon/AC/AutoIcon.png"; - break; - default: - imagePath = "FunctionIcon/AC/WindHighIcon.png"; - break; - } - return imagePath; - }catch (Exception ex) - { - MainPage.Log($"ac get curFanImage error : {ex.Message}"); - return "FunctionIcon/AC/WindHighIcon.png"; + case "high": + imagePath = "FunctionIcon/AC/WindHighIcon.png"; + break; + case "medium": + imagePath = "FunctionIcon/AC/WindMediumIcon.png"; + break; + case "low": + imagePath = "FunctionIcon/AC/WindLowIcon.png"; + break; + case "auto": + imagePath = "FunctionIcon/AC/AutoIcon.png"; + break; } } + else + { + switch (value) + { + case "high": + imagePath = "FunctionIcon/AC/WindHighIconGray.png"; + break; + case "medium": + imagePath = "FunctionIcon/AC/WindMediumIconGray.png"; + break; + case "low": + imagePath = "FunctionIcon/AC/WindLowIconGray.png"; + break; + case "auto": + imagePath = "FunctionIcon/AC/AutoIconGray.png"; + break; + } + } + + return imagePath; + } + + + /// <summary> + /// 鑾峰彇妯″紡灞炴�ф枃鏈� + /// </summary> + /// <returns></returns> + public string GetModeAttrText(string value) + { + string text = ""; + switch (value) + { + #region 妯″紡 + case "auto": + text = Language.StringByID(StringId.Auto); + break; + case "cool": + text = Language.StringByID(StringId.Cool); + break; + case "heat": + text = Language.StringByID(StringId.Heat); + break; + case "dry": + text = Language.StringByID(StringId.Dry); + break; + case "fan": + text = Language.StringByID(StringId.AirSupply); + break; + #endregion + } + return text; + } + + /// <summary> + /// 鑾峰彇椋庨�熷睘鎬ф枃鏈� + /// </summary> + /// <returns></returns> + public string GetFanAttrText(string value) + { + string text = ""; + switch (value) + { + #region 椋庨�� + case "high": + text = Language.StringByID(StringId.HighWindSpeed); + break; + case "medium": + text = Language.StringByID(StringId.MiddleWindSpeed); + break; + case "low": + text = Language.StringByID(StringId.LowWindSpeed); + break; + case "auto": + text = Language.StringByID(StringId.Auto); + break; + #endregion + } + return text; } } diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 1737170..2eca3c6 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -89,18 +89,18 @@ } /// <summary> - /// 鑾峰彇灞炴�х姸鎬� + /// 鑾峰彇灞炴�у綋鍓嶇姸鎬� /// </summary> /// <param name="key"></param> /// <returns></returns> public string GetAttrState(string key) { - var attrState = status.Find((s) => s.key == key.ToString()); + var attrState = attributes.Find((s) => s.key == key.ToString()); if(attrState == null) { - return ""; + return "0"; } - return attrState.value; + return attrState.state; } /// <summary> /// 璁剧疆灞炴�х姸鎬� @@ -110,44 +110,25 @@ /// <returns>淇敼缁撴灉</returns> public bool SetAttrState(string key, string value) { - var attrState = status.Find((s) => s.key == key.ToString()); - if (attrState == null) + //var attrState = status.Find((s) => s.key == key.ToString()); + var attr = attributes.Find((s) => s.key == key); + if (attr == null) { return false; } else { - attrState.value = value; + attr.state = value; } return true; } + + #endregion #region base info - /// <summary> - /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes - /// 涓句緥锛� 鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆 - /// 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte - /// 鏉ユ簮锛�00 榛樿鍘熺敓鎬佺郴缁熸暟鎹� 銆�01 缃戝叧鎴栬�呭叾浠朅璁惧銆�02 璋冭瘯杞欢銆�03 APP搴旂敤绋嬪簭銆�04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙� - /// 鍘傚晢浠g爜锛�01 HDL - /// 閫氳鏂瑰紡锛�01 HDL Bus銆�02 Zigbee銆�03 KNX銆�04 Z-Wave - /// 浜у搧鏃堕棿鎴筹細4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣� - /// 浜у搧绫诲埆锛�01 璋冨厜鍣ㄣ��02 缁х數鍣ㄣ��03 骞叉帴鐐规ā鍧椼��04 浼犳劅鍣ㄣ��05 闈㈡澘 - /// 鐗╂ā鍨嬬被鍨嬶細 - /// 01 寮�鍏崇被锛�01 寮�鍏炽��02 鎻掑骇銆�03 - /// 02 鐓ф槑锛� 01 寮�鍏炽��02 璋冨厜銆�03 鑹叉俯銆�04 LED - /// 03 閬槼锛� 01 绐楀笜鐢垫満銆�02 鐧惧彾绐椼��03 寮�鍚堝笜銆�04 鍗峰笜 - /// 04 鎭掓俯鍣細01 绌鸿皟銆�02 鍦版殩銆�03 姣涚粏绌鸿皟 - /// 05 鏂伴 - /// 06 褰遍煶 - /// 07 闊充箰 - /// 08 鑳芥簮 - /// 09 瀹夐槻 - /// 澶х被鍒� 1bytes 锛堥鐣欙級 - /// 灏忕被鍒� 1byte 锛堥鐣欙級 - /// </summary> 鈥�0001021599F98A04050300010000鈥� public string sid = "0301011234567801012301230123"; /// <summary> /// 澶囨敞 @@ -187,23 +168,6 @@ /// attri /// </summary> public List<FunctionAttributes> attributes = new List<FunctionAttributes>(); - /// <summary> - /// 鍔熻兘鐘舵�佸垪琛� - /// </summary> - public List<AttributesStatus> status = new List<AttributesStatus>(); - /// <summary> - /// 鑾峰彇鐘舵�佸�� - /// </summary> - /// <returns></returns> - public string GetStatusValus(string key) - { - var d = status.Find((obj) => obj.key == key); - if(d==null) - { - return null; - } - return d.value; - } /// <summary> /// 鎴块棿ID鍒楄〃 @@ -531,7 +495,7 @@ sendDataObj.time_stamp = Control.Ins.Get_TimeStamp(); - var acd = new AlinkControlData(); + var acd = new AlinkStatusData(); acd.sid = sid; foreach (var dic in commandDictionary) { @@ -593,7 +557,7 @@ /// </summary> public class AlinkFunctionStatusObj { - public List<AlinkControlData> objects = new List<AlinkControlData>(); + public List<AlinkStatusData> objects = new List<AlinkStatusData>(); public string time_stamp = ""; public string id = ""; @@ -609,11 +573,23 @@ public string time_stamp = ""; } /// <summary> - /// A鍗忚鎺у埗鏁版嵁 + /// A鍗忚鐘舵�佹暟鎹� /// </summary> - public class AlinkControlData + public class AlinkStatusData { + /* + mqtt鎺ユ敹鐨勭姸鎬佹暟鎹病鏈塪eviceId + 鎺ュ彛鍙嶉鐨勬暟鎹湁 + */ + /// <summary> + /// + /// </summary> public string sid = ""; + /// <summary> + /// 璁惧ID + /// 浜戠璐熻矗鐢熸垚 + /// </summary> + public string deviceId = "0"; public List<AttributesStatus> status = new List<AttributesStatus>(); } /// <summary> @@ -660,6 +636,10 @@ /// 鏁版嵁绫诲瀷 /// </summary> public string data_type = ""; + /// <summary> + /// 褰撳墠鐘舵�� + /// </summary> + public string state = ""; /// <summary> /// 褰撳墠鍊� /// </summary> @@ -990,6 +970,14 @@ /// 鍑夐湼 /// </summary> public const string ClothesHanger = "electrical.racks"; + /// <summary> + /// 绾㈠瀹� + /// </summary> + public const string IrModule = "ir.module"; + /// <summary> + /// 绾㈠绌鸿皟 + /// </summary> + public const string IrAC = "ir.ac"; /// <summary> diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs index d430811..0ddbb56 100644 --- a/HDL_ON/Entity/Function/Light.cs +++ b/HDL_ON/Entity/Function/Light.cs @@ -6,20 +6,6 @@ { public class Light : Function { - /* - 鐏厜绫伙細trait: [switch,brightness,color,cct,delay,fadeTime] - 灞炴�� 鎻忚堪 - switch on/off; - brightness 0-100; - color int (red (0-255) green (0-255) blue (0-255)) - cct int (warm light(0-255) cold light (0-255) ) - delay 0-3600s - fadetime 0-3600s - */ - public Light() - { - } - [Newtonsoft.Json.JsonIgnore] FunctionAttributes trait_brightness; /// <summary> diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index c974e1e..386ded3 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -86,11 +86,6 @@ ///// <summary> ///// 鍦烘櫙鑳屾櫙 ///// </summary> - //public string ImagePath = "Intelligence/Gallery/scenebg1.png";//"FunctionIcon/Scene/s1.png"; - - ///// <summary> - ///// 鍦烘櫙鑳屾櫙 - ///// </summary> public string ImagePath { get @@ -339,40 +334,32 @@ return revPack.Code; } - - /// <summary> - /// 涓婁紶鏁版嵁鍒颁簯绔� + /// 寤舵椂鏄剧ず鐨勬枃鏈� /// </summary> - void UploadScene() + public string GetDelayText() { - var pm = new HttpServerRequest(); - ResponsePackNew revPack; - if (string.IsNullOrEmpty(createTime) && string.IsNullOrEmpty(modifyTime)) + string text = ""; + switch (delay) { - revPack = pm.AddScene(this); - if (revPack.Code == StateCode.SUCCESS) - { - var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); - } + case "0": + text = Language.StringByID(StringId.NoDelay); + break; + case "30": + text = "30s"; + break; + case "60": + text = "1min"; + break; + case "120": + text = "2min"; + break; + case "300": + text = "5min"; + break; } - else if (!string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime)) - { - revPack = pm.EditScene(this); - if (revPack.Code == StateCode.SUCCESS) - { - var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); - var tempScene = scenes.Find((obj) => obj.sid == sid); - if (tempScene != null) - { - var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); - Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); - } - } - } + return text; } - /// <summary> /// 浜戠鏁版嵁鍒涘缓鐨勬椂闂� /// </summary> @@ -431,6 +418,171 @@ { public string key = ""; public string value = ""; + + /// <summary> + /// 灞炴�у悕绉版樉绀烘枃鏈� + /// 涓嫳鏂囨樉绀� + /// </summary> + public string GetNameText() + { + string text = ""; + switch (key) + { + case FunctionAttributeKey.OnOff: + text = Language.StringByID(StringId.OnOff); + break; + case FunctionAttributeKey.Brightness: + text = Language.StringByID(StringId.Brightness); + break; + case FunctionAttributeKey.RGB: + text = Language.StringByID(StringId.ColorValue); + break; + case FunctionAttributeKey.Mode: + text = Language.StringByID(StringId.Mode); + break; + case FunctionAttributeKey.FanSpeed: + text = Language.StringByID(StringId.FanSpeed); + break; + case FunctionAttributeKey.SetTemp: + text = Language.StringByID(StringId.Temp); + break; + case FunctionAttributeKey.IndoorTemp: + text = Language.StringByID(StringId.IndoorTemp); + break; + case FunctionAttributeKey.Delay: + text = Language.StringByID(StringId.Delay); + break; + case FunctionAttributeKey.CCT: + text = "CCT"; + break; + case FunctionAttributeKey.Percent: + text = Language.StringByID(StringId.PercentAdjustment); + break; + case FunctionAttributeKey.FadeTime: + text = Language.StringByID(StringId.FadeSpeed); + break; + } + return text; + } + + + /// <summary> + /// 灞炴�у�煎崟浣� + /// </summary> + public string GetUintString() + { + var us = ""; + switch (key) + { + case FunctionAttributeKey.SetTemp: + case FunctionAttributeKey.IndoorTemp: + us = "掳C"; + break; + case FunctionAttributeKey.Percent: + case FunctionAttributeKey.Brightness: + us = "%"; + break; + } + return us; + } + + + /// <summary> + /// 鑾峰彇鎸囧畾灞炴�х殑鏄剧ず鏂囨湰 + /// 涓嫳鏂囨樉绀� + /// </summary> + public string GetValueText() + { + string text = ""; + switch (key) + { + case FunctionAttributeKey.OnOff: + text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); + break; + case FunctionAttributeKey.SetTemp: + case FunctionAttributeKey.IndoorTemp: + case FunctionAttributeKey.Brightness: + case FunctionAttributeKey.Percent: + if (value == "") + { + value = "0"; + } + text = value; + break; + case FunctionAttributeKey.Mode: + switch (value) + { + //----绌鸿皟 + case "auto": + text = Language.StringByID(StringId.Auto); + break; + case "cool": + text = Language.StringByID(StringId.Cool); + break; + case "heat": + text = Language.StringByID(StringId.Heat); + break; + case "dry": + text = Language.StringByID(StringId.Dry); + break; + case "fan": + text = Language.StringByID(StringId.AirSupply); + break; + //-----鍦扮儹 + case "day": + text = Language.StringByID(StringId.Day); + break; + case "night": + text = Language.StringByID(StringId.Night); + break; + case "away": + text = Language.StringByID(StringId.Away); + break; + case "normal": + text = Language.StringByID(StringId.Normal); + break; + case "timer": + text = Language.StringByID(StringId.Timer); + break; + } + break; + case FunctionAttributeKey.FanSpeed: + switch (value) + { + case "high": + text = Language.StringByID(StringId.HighWindSpeed); + break; + case "medium": + text = Language.StringByID(StringId.MiddleWindSpeed); + break; + case "low": + text = Language.StringByID(StringId.LowWindSpeed); + break; + case "auto": + text = Language.StringByID(StringId.Auto); + break; + default: + text = "low"; + break; + } + break; + case "high": + text = Language.StringByID(StringId.HighWindSpeed); + break; + case "medium": + text = Language.StringByID(StringId.MiddleWindSpeed); + break; + case "low": + text = Language.StringByID(StringId.LowWindSpeed); + break; + case "auto": + text = Language.StringByID(StringId.Auto); + break; + } + return text; + } + + } /// <summary> /// 鍦烘櫙鎺ㄩ�侀厤缃� diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 0395d89..845ab49 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -20,7 +20,7 @@ { _FunctionList = new FunctionList(); #region 鎭㈠鏁版嵁 - var filePathList = Common.FileUtlis.Files.ReadFiles(); + var filePathList = FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { _FunctionList.IniFunctionList(filePath); @@ -30,6 +30,14 @@ return _FunctionList; } } + /// <summary> + /// 鍔熻兘鍒楄〃 + /// </summary> + public List<Function> Functions = new List<Function>(); + + + + /// <summary> /// 绌鸿皟鍒楄〃 @@ -122,6 +130,10 @@ /// 鍑夐湼鍒楄〃 /// </summary> public List<Function> clothesHangerList = new List<Function>(); + /// <summary> + /// 绾㈠瀹濆垪琛� + /// </summary> + public List<Function> irModule = new List<Function>(); #endregion /// <summary> @@ -134,17 +146,6 @@ public List<Sensor> sensorsArm = new List<Sensor>(); public List<Scene> scenes = new List<Scene>(); - /// <summary> - /// 鍦烘櫙鍒楄〃 - /// </summary> - //public List<Scene> Scenes - //{ - // get - // { - // List.scenes = List.scenes.OrderByDescending(o => o.createTime).ToList(); - // return List.scenes; - // } - //} /// <summary> /// 鍔熻兘鍒楄〃 /// </summary> @@ -256,6 +257,11 @@ List.clothesHangerList.Add(ch); deviceFunctionList.Add(ch); break; + case SPK.IrModule: + var irm = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); + List.irModule.Add(irm); + deviceFunctionList.Add(irm); + break; } } } @@ -351,139 +357,6 @@ List.scenes = new List<Scene>(); List.deviceFunctionList = new List<Function>(); _FunctionList = null; - } - - /// <summary> - /// 鎺ユ敹bus杞欢涓婁紶鐨勫姛鑳� - /// tcp鏂瑰紡 - /// </summary> - /// <param name="sidObj"></param> - public void AddDeviceFunction(Function sidObj0) - { - switch (sidObj0.spk) - { - case SPK.AcStandard: - var sidObj = Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.aCs.Add(sidObj); - sidObj.SaveFunctionFile(); - break; - case SPK.FloorHeatStandard: - var sidObj1 = Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.floorHeatings.Add(sidObj1); - sidObj1.SaveFunctionFile(); - break; - case SPK.LightDimming: - case SPK.LightRGB: - case SPK.LightSwitch: - var sidObj2 = Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.lights.Add(sidObj2); - sidObj2.SaveFunctionFile(); - break; - case SPK.CurtainSwitch: - case SPK.CurtainRoller: - case SPK.CurtainTrietex: - var sidObj3 = Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.curtains.Add(sidObj3 ); - sidObj3.SaveFunctionFile(); - break; - case SPK.ElectricTV: - var sidObj4 = Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.tVs.Add(sidObj4); - sidObj4.SaveFunctionFile(); - break; - case SPK.ElectricSocket: - var sidObj5 = Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.switchSockets.Add(sidObj5); - sidObj5.SaveFunctionFile(); - break; - case SPK.ElectricFan: - var sidObj6 = Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.fans.Add(sidObj6); - sidObj6.SaveFunctionFile(); - break; - case SPK.SensorCO2: - case SPK.SensorTVOC: - case SPK.SensorPm25: - case SPK.SensorTemperature: - case SPK.SensorHumidity: - var sidObj7 = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); - List.sensorsEnvironmentalScience.Add(sidObj7); - sidObj7.SaveFunctionFile(); - break; - } - } - /// <summary> - /// 鎺ユ敹bus杞欢涓婁紶鐨勫姛鑳� - /// http udp - /// </summary> - /// <param name="obj"></param> - public void AddFunction(object obj) - { - var f = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(obj.ToString()); - if (f == null) - return; - switch (f.Spk_Prefix) - { - case FunctionCategory.AC: - switch (f.spk) - { - case SPK.AcStandard: - List.aCs.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(obj.ToString())); - break; - } - break; - case FunctionCategory.FloorHeat: - switch (f.spk) - { - case SPK.FloorHeatStandard: - List.floorHeatings.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(obj.ToString())); - break; - } - break; - case FunctionCategory.Light: - List.lights.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(obj.ToString())); - break; - case FunctionCategory.Curtain: - List.curtains.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(obj.ToString())); - break; - case FunctionCategory.Electric: - switch(f.spk) - { - case SPK.ElectricTV: - List.electricals.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(obj.ToString())); - break; - case SPK.ElectricSocket: - List.electricals.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(obj.ToString())); - break; - case SPK.ElectricFan: - List.electricals.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(obj.ToString())); - break; - } - break; - case FunctionCategory.Sensor: - switch (f.spk) - { - case SPK.SensorTVOC: - case SPK.SensorCO2: - case SPK.SensorPm25: - case SPK.SensorHumidity: - case SPK.SensorTemperature: - List.sensorsEnvironmentalScience.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(obj.ToString())); - break; - case SPK.SensorWater: - case SPK.SensorSmoke: - case SPK.SensorGas: - case SPK.SensorDryContact: - case SPK.SensorShanLan: - case SPK.SensorDuiShe: - case SPK.SensorPir: - case SPK.SensorDoorWindow: - case SPK.SensoruUtrasonic: - List.sensorsArm.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(obj.ToString())); - break; - } - break; - } } /// <summary> @@ -762,195 +635,9 @@ #endregion - #region 鍔熻兘鏂囨湰鐩稿叧 - /// <summary> - /// 灞炴�у悕绉版樉绀烘枃鏈� - /// 涓嫳鏂囨樉绀� - /// </summary> - public string GetNameText(string key) - { - string text = ""; - switch (key) - { - case FunctionAttributeKey.OnOff: - text = Language.StringByID(StringId.OnOff); - break; - case FunctionAttributeKey.Brightness: - text = Language.StringByID(StringId.Brightness); - break; - case FunctionAttributeKey.RGB: - text = Language.StringByID(StringId.ColorValue); - break; - case FunctionAttributeKey.Mode: - text = Language.StringByID(StringId.Mode); - break; - case FunctionAttributeKey.FanSpeed: - text = Language.StringByID(StringId.FanSpeed); - break; - case FunctionAttributeKey.SetTemp: - text = Language.StringByID(StringId.Temp); - break; - case FunctionAttributeKey.IndoorTemp: - text = Language.StringByID(StringId.IndoorTemp); - break; - case FunctionAttributeKey.Delay: - text = Language.StringByID(StringId.Delay); - break; - case FunctionAttributeKey.CCT: - text = "CCT"; - break; - case FunctionAttributeKey.Percent: - text = Language.StringByID(StringId.PercentAdjustment); - break; - case FunctionAttributeKey.FadeTime: - text = Language.StringByID(StringId.FadeSpeed); - break; - } - return text; - } + #region + - /// <summary> - /// 灞炴�у�煎崟浣� - /// </summary> - public string GetUintString(string key) - { - var us = ""; - switch (key) - { - case FunctionAttributeKey.SetTemp: - case FunctionAttributeKey.IndoorTemp: - us = "掳C"; - break; - case FunctionAttributeKey.Percent: - case FunctionAttributeKey.Brightness: - us = "%"; - break; - } - return us; - } - - /// <summary> - /// 鑾峰彇鎸囧畾灞炴�х殑鏄剧ず鏂囨湰 - /// 涓嫳鏂囨樉绀� - /// </summary> - public string GetValueText(string key, string value) - { - string text = ""; - switch (key) - { - case FunctionAttributeKey.OnOff: - text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); - break; - case FunctionAttributeKey.SetTemp: - case FunctionAttributeKey.IndoorTemp: - case FunctionAttributeKey.Brightness: - case FunctionAttributeKey.Percent: - if (value == "") - { - value = "0"; - } - text = value; - break; - case FunctionAttributeKey.Mode: - switch (value) - { - //----绌鸿皟 - case "auto": - text = Language.StringByID(StringId.Auto); - break; - case "cool": - text = Language.StringByID(StringId.Cool); - break; - case "heat": - text = Language.StringByID(StringId.Heat); - break; - case "dry": - text = Language.StringByID(StringId.Dry); - break; - case "fan": - text = Language.StringByID(StringId.AirSupply); - break; - //-----鍦扮儹 - case "day": - text = Language.StringByID(StringId.Day); - break; - case "night": - text = Language.StringByID(StringId.Night); - break; - case "away": - text = Language.StringByID(StringId.Away); - break; - case "normal": - text = Language.StringByID(StringId.Normal); - break; - case "timer": - text = Language.StringByID(StringId.Timer); - break; - } - break; - case FunctionAttributeKey.FanSpeed: - switch (value) - { - case "high": - text = Language.StringByID(StringId.HighWindSpeed); - break; - case "medium": - text = Language.StringByID(StringId.MiddleWindSpeed); - break; - case "low": - text = Language.StringByID(StringId.LowWindSpeed); - break; - case "auto": - text = Language.StringByID(StringId.Auto); - break; - default: - text = "low"; - break; - } - break; - case "high": - text = Language.StringByID(StringId.HighWindSpeed); - break; - case "medium": - text = Language.StringByID(StringId.MiddleWindSpeed); - break; - case "low": - text = Language.StringByID(StringId.LowWindSpeed); - break; - case "auto": - text = Language.StringByID(StringId.Auto); - break; - } - return text; - } - - - /// <summary> - /// 寤舵椂鏄剧ず鐨勬枃鏈� - /// </summary> - public string GetDelayText(string delay) - { - string text = ""; - switch (delay) - { - case "0": - text = Language.StringByID(StringId.NoDelay); - break; - case "30": - text = "30s"; - break; - case "60": - text = "1min"; - break; - case "120": - text = "2min"; - break; - case "300": - text = "5min"; - break; - } - return text; - } #endregion } diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 58efc12..4e35ba4 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -357,6 +357,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ReplicationView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\ClothesHangerSetTimePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\ArmSensorHistroyPaging.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\AC\AcControlPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)UI\" /> diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index 5f12ec0..f6559b3 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -65,12 +65,6 @@ rollingShutterView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; - case SPK.AcStandard: - var acView = new ACPage(function as AC); - MainPage.BasePageView.AddChidren(acView); - acView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - break; case SPK.FloorHeatStandard: var fhView = new FloorHeatingPage(function as FloorHeating); MainPage.BasePageView.AddChidren(fhView); @@ -148,6 +142,17 @@ var clothesHangerpage = new ClothesHangerPage(); clothesHangerpage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; + case SPK.IrAC: + case SPK.AcStandard: + var acPage = new AcControlPage(); + acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); + break; + //case SPK.AcStandard: + // var acView = new ACPage(function as AC); + // MainPage.BasePageView.AddChidren(acView); + // acView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); + // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + // break; } }; return eventHandler; diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs index 8dc9425..fca8398 100644 --- a/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs @@ -45,24 +45,27 @@ { foreach (var attr in updateData) { - var localAttr2 = localDevice.attributes.Find((obj) => obj.key == attr.key); - if (localAttr2 == null) - { - //鏈韩瀹冨氨娌℃湁杩欎釜灞炴��,鍒欎笉澶勭悊 - continue; - } - //鏇存敼灞炴�у�� - localAttr2.curValue = attr.value; + //var localAttr2 = localDevice.attributes.Find((obj) => obj.key == attr.key); + //if (localAttr2 == null) + //{ + // //鏈韩瀹冨氨娌℃湁杩欎釜灞炴��,鍒欎笉澶勭悊 + // continue; + //} + ////鏇存敼灞炴�у�� + //localAttr2.curValue = attr.value; - var localAttr = localDevice.status.Find((obj) => obj.key == attr.key); - if (localAttr == null) - { - //status鏄綋鍓嶈澶囦笂鎶ヨ繃鐨勫睘鎬ф墠浼氬瓨鍦�,涔熷氨鏄畠鐨勪釜鏁版湁鍙兘鍜宎ttributes涓嶄竴鑷� - localAttr = new AttributesStatus() { key = attr.key, value = attr.value }; - localDevice.status.Add(localAttr); - } - //鏇存敼灞炴�у�� - localAttr.value = attr.value; + //var localAttr = localDevice.status.Find((obj) => obj.key == attr.key); + //if (localAttr == null) + //{ + // //status鏄綋鍓嶈澶囦笂鎶ヨ繃鐨勫睘鎬ф墠浼氬瓨鍦�,涔熷氨鏄畠鐨勪釜鏁版湁鍙兘鍜宎ttributes涓嶄竴鑷� + // localAttr = new AttributesStatus() { key = attr.key, value = attr.value }; + // localDevice.status.Add(localAttr); + //} + ////鏇存敼灞炴�у�� + //localAttr.value = attr.value; + + localDevice.SetAttrState(attr.key, attr.value); + } //鍏ㄩ儴鐣岄潰鎺ㄩ�� HdlFormLogic.Current.DeviceStatuPush(localDevice); diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index fdfafcd..327f2ee 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -192,12 +192,13 @@ //return; if (b) { - etAccount.Text = "18666455392";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; - // "15622703419";// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 + etAccount.Text = "15622703419";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; + // "15622703419"lwn;// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 } else { etAccount.Text = "18316672920";//鍑夐湼"18666455392";//13375012446//13602944661//tzy 18778381374 + //15971583093 gs } b = !b; etPassword.Text = "123456"; diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index ebe9a20..f0a079e 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -102,10 +102,10 @@ break; } - var powerLowTipAttr = function.status.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); + var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); if (powerLowTipAttr != null) { - if (powerLowTipAttr.value.ToLower() == "low") + if (powerLowTipAttr.state.ToLower() == "low") { Button btnTipPowerLow = new Button() { @@ -429,7 +429,7 @@ SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon1On.png", }; bodyDiv.AddChidren(btnClothesHangerDown); - LoadEvent_ControlClothesHanger(function, btnClothesHangerDown, btnClothesHangerUp); + LoadEvent_ControlClothesHanger(function, btnClothesHangerUp, btnClothesHangerDown); #endregion diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs index 7ccf347..4f9c820 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs @@ -255,7 +255,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = FunctionList.List.GetDelayText(scene.delay.ToString()) + Text = scene.GetDelayText() }; sceneDelayRow.AddChidren(btnSceneDelayInfo); @@ -274,7 +274,7 @@ { Action<string> action = (obj) => { scene.delay = obj; - btnSceneDelayInfo.Text = FunctionList.List.GetDelayText(obj); + btnSceneDelayInfo.Text = scene.GetDelayText(); }; Dictionary<string, string> items = new Dictionary<string, string>(); items.Add("30", "30s"); @@ -427,7 +427,7 @@ if (Convert.ToInt32(scenefunction.delay) > 0) { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + FunctionList.List.GetDelayText(scenefunction.delay); + btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); } else { @@ -510,16 +510,16 @@ var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); if (modeState != null) { - sceneFunctionInfo += FunctionList.List.GetValueText(modeState.key, modeState.value); + sceneFunctionInfo += modeState.GetValueText(); } if (tempState != null) { - sceneFunctionInfo += FunctionList.List.GetValueText(tempState.key, tempState.value); - sceneFunctionInfo += FunctionList.List.GetUintString(tempState.key); + sceneFunctionInfo += tempState.GetValueText(); + sceneFunctionInfo += tempState.GetUintString(); } if (fanState != null) { - sceneFunctionInfo += FunctionList.List.GetValueText(fanState.key, fanState.value); + sceneFunctionInfo += tempState.GetValueText(); } var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); if (briState != null) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index 9a5237a..406ef9f 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -261,7 +261,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = FunctionList.List.GetDelayText( scene.delay) + Text = scene.GetDelayText() }; sceneDelayRow.AddChidren(btnSceneDelayInfo); @@ -281,7 +281,7 @@ { Action<string> action = (obj) => { scene.delay = obj; - btnSceneDelayInfo.Text = FunctionList.List.GetDelayText(obj); + btnSceneDelayInfo.Text = scene.GetDelayText(); scene.EditScene(); }; Dictionary<string, string> items = new Dictionary<string, string>(); @@ -483,7 +483,7 @@ if (Convert.ToInt32( scenefunction.delay) > 0) { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + FunctionList.List.GetDelayText(scenefunction.delay); + btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); } else { @@ -567,16 +567,16 @@ var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); if (modeState != null) { - sceneFunctionInfo += FunctionList.List.GetValueText(modeState.key, modeState.value) + " "; + sceneFunctionInfo += modeState.GetValueText() + " "; } if (tempState != null) { - sceneFunctionInfo += FunctionList.List.GetValueText(tempState.key, tempState.value) + " "; - sceneFunctionInfo += FunctionList.List.GetUintString(tempState.key); + sceneFunctionInfo += tempState.GetValueText() + " "; + sceneFunctionInfo += tempState.GetUintString(); } if (fanState != null) { - sceneFunctionInfo += FunctionList.List.GetValueText(fanState.key, fanState.value) + " "; + sceneFunctionInfo += fanState.GetValueText() + " "; } var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); if (briState != null) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 173cb69..9da0de8 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -202,7 +202,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = FunctionList.List.GetValueText(sceneStatus.key,sceneStatus.value) + FunctionList.List.GetUintString(sceneStatus.key) + Text = sceneStatus.GetValueText() + sceneStatus.GetUintString() }; row.AddChidren(btnFunctionText); if (sceneStatus.key == FunctionAttributeKey.OnOff) @@ -220,7 +220,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, - Text = FunctionList.List.GetNameText(sceneStatus.key) + Text = sceneStatus.GetNameText() }; row.AddChidren(btnFunctionName); btnFunctionName.MouseUpEventHandler = (sender, e) => @@ -300,7 +300,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = FunctionList.List.GetDelayText( sceneFunction.delay) + Text = new Scene() { delay = sceneFunction.delay }.GetDelayText() }; delayRow.AddChidren(btnDelayInfo); @@ -318,7 +318,7 @@ btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => { Action<string> action = (obj) => { sceneFunction.delay = obj; - btnDelayInfo.Text = FunctionList.List.GetDelayText(obj); + btnDelayInfo.Text = new Scene() { delay = sceneFunction.delay }.GetDelayText(); }; Dictionary<string, string> items = new Dictionary<string, string>(); items.Add("30", "30s"); @@ -423,7 +423,7 @@ dialog.Close(); trait.value = "on"; sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "on"; - btn.Text = FunctionList.List.GetValueText(trait.key, trait.value) + FunctionList.List.GetUintString(trait.key); + btn.Text = trait.GetValueText() + trait.GetUintString(); var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); if (temp == null) @@ -436,14 +436,14 @@ { temp.value = "100"; } - btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; + btnBrightnessText.Text = temp.GetValueText() + "%"; } }; btnOff.MouseUpEventHandler = (sender,e) =>{ dialog.Close(); trait.value = "off"; sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "off"; - btn.Text= FunctionList.List.GetValueText(trait.key,trait.value) + FunctionList.List.GetUintString(trait.key); + btn.Text= trait.GetValueText() + trait.GetUintString(); var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); if(temp == null) @@ -456,7 +456,7 @@ { temp.value = "0"; } - btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; + btnBrightnessText.Text = temp.GetValueText() + "%"; } }; @@ -540,16 +540,16 @@ }; for (int i = 16; i <= 32; i += 1) { - pickerItems.Add(i.ToString() + FunctionList.List.GetUintString(trait.key)); + pickerItems.Add(i.ToString() + trait.GetUintString()); } uIPickerView.setNPicker(pickerItems, null, null); optionBaseView.AddChidren(uIPickerView); uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); string selectItem = pickerItems[0]; - if (pickerItems.Contains(trait.value + FunctionList.List.GetUintString(trait.key))) + if (pickerItems.Contains(trait.value + trait.GetUintString())) { - selectItem = trait.value.ToString() + FunctionList.List.GetUintString(trait.key); + selectItem = trait.value.ToString() + trait.GetUintString(); } dialog.Show(); @@ -568,7 +568,7 @@ dialog.Close(); btn.Text = selectItem; //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ; - trait.value = selectItem.Replace(FunctionList.List.GetUintString(trait.key),""); + trait.value = selectItem.Replace(trait.GetUintString(),""); }; } @@ -622,7 +622,7 @@ Gravity = Gravity.CenterHorizontal, TextAlignment = TextAlignment.Center, Width = Application.GetRealWidth(100), - Text = FunctionList.List.GetNameText(trait.key), + Text = trait.GetNameText(), IsBold = true, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, @@ -711,7 +711,7 @@ { dialog.Close(); trait.value = controlBar.Progress.ToString(); - btn.Text = trait.value + FunctionList.List.GetUintString(trait.key); + btn.Text = trait.value + trait.GetUintString(); var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff); if (temp != null) @@ -724,7 +724,7 @@ { temp.value = "off"; } - btnOnText.Text = FunctionList.List.GetValueText(temp.key, temp.value); + btnOnText.Text = temp.GetValueText(); } }; } @@ -779,7 +779,7 @@ Gravity = Gravity.CenterHorizontal, TextAlignment = TextAlignment.Center, Width = Application.GetRealWidth(100), - Text = FunctionList.List.GetNameText(trait.key), + Text = trait.GetNameText(), IsBold = true, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, @@ -872,7 +872,7 @@ { dialog.Close(); trait.value = controlBar.Progress.ToString(); - btn.Text = trait.value + FunctionList.List.GetUintString(trait.key); + btn.Text = trait.value + trait.GetUintString(); }; } @@ -921,7 +921,7 @@ Gravity = Gravity.CenterHorizontal, TextAlignment = TextAlignment.Center, Width = Application.GetRealWidth(100), - Text = FunctionList.List.GetNameText(trait.key), + Text = trait.GetNameText(), IsBold = true, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, @@ -993,7 +993,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, Tag = m, - Text = FunctionList.List.GetValueText(trait.key, m) + Text = trait.GetValueText() }; row.AddChidren(btnPropertyTitle); diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs index cf1c52e..800f8a5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs @@ -150,11 +150,11 @@ ProgressBarColor = CSS_Color.MainColor, OfflineProgressBarColor = CSS_Color.PromptingColor2, IsOffline = aC.trait_on_off.curValue.ToString() == "off", - MinValue = aC.trait_temp.min, - MaxValue = aC.trait_temp.max, + MinValue = aC.GetAttribute(FunctionAttributeKey.SetTemp).min, + MaxValue = aC.GetAttribute(FunctionAttributeKey.SetTemp).max, //IsClickable = aC.trait_on_off.curValue.ToString() == "on", ArcColor = CSS_Color.BackgroundColor, - Progress = Convert.ToInt32(aC.trait_temp.curValue), + Progress = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)), #if __IOS__ Y = Application.GetRealHeight(120 + 25), Width = Application.GetRealWidth(260 - 40), @@ -179,7 +179,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = 50, IsBold = true, - Text = aC.trait_temp.curValue.ToString(), + Text = aC.GetAttrState(FunctionAttributeKey.SetTemp), TextAlignment = TextAlignment.Center, }; controlView.AddChidren(btnTemp); @@ -236,7 +236,7 @@ Y = Application.GetRealHeight(334), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = aC.curModeImage, + UnSelectedImagePath = aC.GetModeIconPath(), }; controlView.AddChidren(btnMode); @@ -246,7 +246,7 @@ Y = Application.GetRealHeight(337), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = aC.curFanImage, + UnSelectedImagePath = aC.GetFanIconPath(), }; controlView.AddChidren(btnWindSpeed); @@ -318,28 +318,29 @@ }; modeChangeView.AddChidren(btnLine); - foreach(var m in aC.trait_mode.value) + var modeList = aC.GetAttribute(FunctionAttributeKey.Mode).value; + foreach (var m in modeList) { Button btnModeIcon = new Button() { X = btnTitle.X, - Y = Application.GetRealHeight(44 * (aC.trait_mode.value.IndexOf(m) + 1) + 10 + 8), + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), - IsSelected = aC.trait_mode.curValue.ToString() == m, + IsSelected = aC.GetAttrState(FunctionAttributeKey.Mode) == m, }; modeChangeView.AddChidren(btnModeIcon); Button btnModeText = new Button() { X = Application.GetRealWidth(12) + btnModeIcon.Right, - Y = Application.GetRealHeight(44 * (aC.trait_mode.value.IndexOf(m) + 1) + 8), + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), Height = Application.GetRealHeight(44), Width = Application.GetRealWidth(90), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, - IsSelected = aC.trait_mode.curValue.ToString() == m, + IsSelected = aC.GetAttrState(FunctionAttributeKey.Mode) == m, TextSize = CSS_FontSize.TextFontSize, }; modeChangeView.AddChidren(btnModeText); @@ -373,12 +374,12 @@ break; } - if(aC.trait_mode.value.IndexOf(m) < aC.trait_mode.value.Count-1) + if (modeList.IndexOf(m) < modeList.Count - 1) { modeChangeView.AddChidren(new Button() { X = btnTitle.X, - Y = btnModeText.Bottom , + Y = btnModeText.Bottom, Width = Application.GetRealWidth(112), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.BackgroundColor, @@ -440,28 +441,29 @@ }; modeChangeView.AddChidren(btnLine); - foreach (var m in aC.trait_fan.value) + var modeList = aC.GetAttribute(FunctionAttributeKey.FanSpeed).value; + foreach (var m in modeList) { Button btnFanIcon = new Button() { X = btnTitle.X, - Y = Application.GetRealHeight(44 * (aC.trait_fan.value.IndexOf(m) + 1) + 10 + 8), + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), - IsSelected = aC.trait_fan.curValue.ToString() == m, + IsSelected = aC.GetAttrState(FunctionAttributeKey.FanSpeed) == m, }; modeChangeView.AddChidren(btnFanIcon); Button btnFanText = new Button() { X = Application.GetRealWidth(12) + btnFanIcon.Right, - Y = Application.GetRealHeight(44 * (aC.trait_fan.value.IndexOf(m) + 1) + 8), + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), Height = Application.GetRealHeight(44), Width = Application.GetRealWidth(70), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, - IsSelected = aC.trait_fan.curValue.ToString() == m, + IsSelected = aC.GetAttrState(FunctionAttributeKey.FanSpeed) == m, TextSize = CSS_FontSize.TextFontSize, }; modeChangeView.AddChidren(btnFanText); @@ -490,7 +492,7 @@ break; } - if (aC.trait_fan.value.IndexOf(m) < aC.trait_fan.value.Count - 1) + if (modeList.IndexOf(m) < modeList.Count - 1) { modeChangeView.AddChidren(new Button() { diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs index c652a45..d00e469 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs @@ -13,7 +13,7 @@ { try { - Application.RunOnMainThread(() => + Application.RunOnMainThread((() => { if (bodyView == null) { @@ -24,25 +24,17 @@ return; } updataTime = DateTime.Now; - //bodyView.arcBar.IsOffline = bodyView.aC.trait_on_off.curValue.ToString() != "on"; - //bodyView.btnSwitch.IsSelected = uAc.trait_on_off.curValue.ToString() == "on"; - //if (uAc.refreshTime.AddMilliseconds(500) < DateTime.Now) - //{ - // bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.trait_temp.curValue)); - //} - //bodyView.arcBar.ThumbImagePath = uAc.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png"; - //bodyView.arcBar.IsClickable = uAc.trait_on_off.curValue.ToString() == "on"; - bodyView.btnTemp.Text = uAc.trait_temp.curValue.ToString(); - bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.trait_IndoorTemp.curValue)) + "掳C"; - bodyView.btnMode.UnSelectedImagePath = uAc.curModeImage; - bodyView.btnWindSpeed.UnSelectedImagePath = uAc.curFanImage; - bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.trait_temp.curValue)); + bodyView.btnTemp.Text = uAc.GetAttrState(FunctionAttributeKey.SetTemp); + bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C"; + bodyView.btnMode.UnSelectedImagePath = uAc.GetModeIconPath(); + bodyView.btnWindSpeed.UnSelectedImagePath = uAc.GetFanIconPath(); + bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState(FunctionAttributeKey.SetTemp))); if (uAc.trait_on_off.curValue.ToString() == "on") { bodyView.arcBar.IsOffline = false; bodyView.btnSwitch.IsSelected = true; bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; - if (uAc.trait_mode.curValue.ToString() == "fan") + if (uAc.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") { bodyView.arcBar.IsClickable = false; } @@ -59,7 +51,7 @@ bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; } - }); + })); } catch (Exception ex) { @@ -99,19 +91,19 @@ { btnMinus.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan") + if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(aC.trait_temp.curValue); - if (temp <= aC.trait_temp.min) + var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp <= aC.GetAttribute(FunctionAttributeKey.Mode).min) { return; } temp--; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - aC.trait_temp.curValue = temp.ToString(); + aC.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); //Control.Send(CommandType_A.write, aC); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); @@ -119,37 +111,37 @@ }; btnPlus.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan") + if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(aC.trait_temp.curValue); - if (temp >= aC.trait_temp.max) + var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp >= aC.GetAttribute(FunctionAttributeKey.SetTemp).max) { return; } temp++; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - aC.trait_temp.curValue = temp.ToString(); + aC.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.SetTemp, aC.trait_temp.curValue.ToString()); + d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); Control.Ins.SendWriteCommand(aC, d); //aC.GetSendJObject }; arcBar.OnStopTrackingTouchEvent = (sender, e) => { - aC.trait_temp.curValue = arcBar.Progress.ToString(); - btnTemp.Text = aC.trait_temp.curValue.ToString(); + aC.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + btnTemp.Text = arcBar.Progress.ToString(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.SetTemp, aC.trait_temp.curValue.ToString()); + d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); Control.Ins.SendWriteCommand(aC, d); }; arcBar.OnProgressChangedEvent = (sender, e) => { - aC.trait_temp.curValue = e.ToString(); - btnTemp.Text = aC.trait_temp.curValue.ToString(); + aC.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); + btnTemp.Text = e.ToString(); }; } /// <summary> @@ -199,7 +191,7 @@ /// <summary> /// 鍔犺浇妯″紡鏀瑰彉浜嬩欢 /// </summary> - void LoadEvent_ChangeMode(Dialog dialog, FrameLayout dialogView, Button btn1, Button btn2, string curMode) + void LoadEvent_ChangeMode(Dialog dialog, FrameLayout dialogView, Button btnModeIcon, Button btnModeText, string curMode) { EventHandler<MouseEventArgs> eventHandler = (sender, e) => { @@ -207,16 +199,15 @@ }; EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { - btn1.IsSelected = btn2.IsSelected = true; - aC.trait_mode.curValue = curMode; - btnMode.UnSelectedImagePath = aC.curModeImage; - //Control.Send(CommandType_A.write, aC); + btnModeIcon.IsSelected = btnModeText.IsSelected = true; + aC.SetAttrState(FunctionAttributeKey.Mode, curMode); + btnMode.UnSelectedImagePath = aC.GetModeIconPath(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - btnMode.UnSelectedImagePath = btn1.UnSelectedImagePath; + btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; d.Add(FunctionAttributeKey.Mode, curMode); Control.Ins.SendWriteCommand(aC, d); dialog.Close(); - if (aC.trait_mode.curValue.ToString() == "fan") + if (aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") { bodyView.arcBar.IsClickable = false; } @@ -225,14 +216,14 @@ bodyView.arcBar.IsClickable = true; } }; - btn1.MouseUpEventHandler = eventHandler1; - btn2.MouseUpEventHandler = eventHandler1; + btnModeIcon.MouseUpEventHandler = eventHandler1; + btnModeText.MouseUpEventHandler = eventHandler1; dialogView.MouseUpEventHandler = eventHandler; } /// <summary> /// 鍔犺浇椋庨�熸敼鍙樹簨浠� /// </summary> - void LoadEvent_ChangeFan(Dialog dialog, FrameLayout dialogView, Button btn1, Button btn2, string curFan) + void LoadEvent_ChangeFan(Dialog dialog, FrameLayout dialogView, Button btnFanIcon, Button btnFanText, string curFan) { EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) => { @@ -240,17 +231,17 @@ }; EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { - btn1.IsSelected = btn2.IsSelected = true; - aC.trait_fan.curValue = curFan; - btnWindSpeed.UnSelectedImagePath = aC.curFanImage; + btnFanIcon.IsSelected = btnFanText.IsSelected = true; + aC.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); + btnWindSpeed.UnSelectedImagePath = aC.GetFanIconPath(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.FanSpeed, curFan); Control.Ins.SendWriteCommand(aC, d); - btnWindSpeed.UnSelectedImagePath = btn1.UnSelectedImagePath; + btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; dialog.Close(); }; - btn1.MouseUpEventHandler = eventHandler1; - btn2.MouseUpEventHandler = eventHandler1; + btnFanIcon.MouseUpEventHandler = eventHandler1; + btnFanText.MouseUpEventHandler = eventHandler1; dialogView.MouseUpEventHandler = closeDialogEvent; } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs new file mode 100644 index 0000000..1686f8f --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs @@ -0,0 +1,623 @@ +锘縰sing System; +using HDL_ON.DriverLayer; +using HDL_ON.Entity; +using HDL_ON.Stan; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + public class AcControlPage : DeviceFunctionCardCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + /// <summary> + /// 绌鸿皟娓╁害鎺у埗鎺т欢 + /// </summary> + DiyArcSeekBar arcBar; + /// <summary> + /// 鍑忓彿鎸夐挳 + /// </summary> + Button btnMinus; + /// <summary> + /// 鍔犲彿鎸夐挳 + /// </summary> + Button btnPlus; + /// <summary> + /// 娓╁害鎸夐挳 + /// </summary> + Button btnTemp; + Button btnTempUint; + /// <summary> + /// 瀹ゅ唴娓╁害鎸夐挳 + /// </summary> + Button btnIndoorTemp; + /// <summary> + /// 妯″紡鎸夐挳 + /// </summary> + Button btnMode; + /// <summary> + /// 椋庨�熸寜閽� + /// </summary> + Button btnWindSpeed; + /// <summary> + /// 寮�鍏虫寜閽� + /// </summary> + Button btnSwitch; + + AC acDevice; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栫櫧鑹插尯鍩熺殑鍐呭 + /// </summary> + public override void InitFrameWhiteContent() + { + acDevice = device as AC; + + base.ShowColltionButton = false; + base.SetTitleText(Language.StringByID(StringId.Electric)); + + //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� + this.InitFrameWhiteContent1(); + + //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� + this.RefreshNowDeviceStatuMemory(this.device); + //鍒锋柊鐣岄潰鐘舵�� + this.RefreshFormStatu(); + //璇诲彇鐘舵�� + new System.Threading.Thread(() => + { + Control.Ins.SendReadCommand(device); + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� + /// </summary> + private void InitFrameWhiteContent1() + { + + arcBar = new DiyArcSeekBar() + { + Gravity = Gravity.CenterHorizontal, + OpenAngle = 160, + ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", + ThumbImageHeight = Application.GetRealWidth(50), + ProgressBarColor = CSS_Color.MainColor, + OfflineProgressBarColor = CSS_Color.PromptingColor2, + IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off", + MinValue = device.GetAttribute(FunctionAttributeKey.OnOff).min, + MaxValue = device.GetAttribute(FunctionAttributeKey.OnOff).max, + //IsClickable = acDevice.trait_on_off.curValue.ToString() == "on", + ArcColor = CSS_Color.BackgroundColor, + Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)), +#if __IOS__ + Y = Application.GetRealHeight(120 + 25), + Width = Application.GetRealWidth(260 - 40), + Height = Application.GetRealWidth(260 - 40), + SeekBarPadding = Application.GetRealWidth(8), +#else + Y = Application.GetRealHeight(120 + 40), + Width = Application.GetRealWidth(260 - 40), + Height = Application.GetRealWidth(260 - 40), + SeekBarPadding = Application.GetRealWidth(7), +#endif + + }; + FrameWhiteCentet1.AddChidren(arcBar); + + btnTemp = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(206), + Width = Application.GetRealWidth(71), + Height = Application.GetRealWidth(60), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = 50, + IsBold = true, + Text = device.GetAttrState(FunctionAttributeKey.SetTemp), + TextAlignment = TextAlignment.Center, + }; + FrameWhiteCentet1.AddChidren(btnTemp); + + btnTempUint = new Button() + { + X = btnTemp.Right, + Y = btnTemp.Y, + Width = Application.GetRealWidth(30), + Height = Application.GetRealHeight(30), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.EmphasisFontSize_Secondary, + IsBold = true, + TextAlignment = TextAlignment.CenterLeft, + Text = "掳C", + }; + FrameWhiteCentet1.AddChidren(btnTempUint); + + btnIndoorTemp = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = btnTemp.Bottom, + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(20), + Text = Language.StringByID(StringId.IndoorTemp) + "20掳C", + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + FrameWhiteCentet1.AddChidren(btnIndoorTemp); + + btnMinus = new Button() + { + X = Application.GetRealWidth(21), + Y = Application.GetRealHeight(263), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "Public/MinusSignIcon.png", + }; + FrameWhiteCentet1.AddChidren(btnMinus); + + btnPlus = new Button() + { + X = Application.GetRealWidth(275), + Y = Application.GetRealHeight(263), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "Public/PlusSignIcon.png", + }; + FrameWhiteCentet1.AddChidren(btnPlus); + + btnMode = new Button() + { + X = Application.GetRealWidth(60), + Y = Application.GetRealHeight(334), + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + UnSelectedImagePath = acDevice.GetModeIconPath(), + }; + FrameWhiteCentet1.AddChidren(btnMode); + + btnWindSpeed = new Button() + { + X = Application.GetRealWidth(235), + Y = Application.GetRealHeight(337), + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + UnSelectedImagePath = acDevice.GetFanIconPath(), + }; + FrameWhiteCentet1.AddChidren(btnWindSpeed); + + btnSwitch = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(466), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "Public/PowerClose.png", + SelectedImagePath = "Public/PowerOpen.png", + IsSelected = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" + }; + FrameWhiteCentet1.AddChidren(btnSwitch); + + LoadEvent_TempChange(); + LoadEvent_AcStatesChange(); + } + + /// <summary> + /// 鍔犺浇淇敼妯″紡鍖哄煙 + /// </summary> + void LoadDiv_ChangeModeView() + { + Dialog dialog = new Dialog(); + + FrameLayout dialogView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(dialogView); + + FrameLayout modeChangeView; + modeChangeView = new FrameLayout() + { + X = Application.GetRealWidth(30), + Y = Application.GetRealHeight(128), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(287), + BackgroundImagePath = "FunctionIcon/AC/DivBg1.png", + }; + dialogView.AddChidren(modeChangeView); + + Button btnTitle; + btnTitle = new Button() + { + X = Application.GetRealWidth(8 + 16), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(44), + TextID = StringId.ChooseMode, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.EmphasisFontSize_Secondary, + }; + modeChangeView.AddChidren(btnTitle); + + Button btnLine = new Button() + { + X = btnTitle.X, + Y = btnTitle.Bottom, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.BackgroundColor, + }; + modeChangeView.AddChidren(btnLine); + + var modeList = device.GetAttribute(FunctionAttributeKey.Mode).value; + foreach (var m in modeList) + { + Button btnModeIcon = new Button() + { + X = btnTitle.X, + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, + }; + modeChangeView.AddChidren(btnModeIcon); + + Button btnModeText = new Button() + { + X = Application.GetRealWidth(12) + btnModeIcon.Right, + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(90), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, + TextSize = CSS_FontSize.TextFontSize, + }; + modeChangeView.AddChidren(btnModeText); + + btnModeIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false); + btnModeIcon.SelectedImagePath = acDevice.GetModeIconPath(); + btnModeText.Text = acDevice.GetModeAttrText( m); + + if (modeList.IndexOf(m) < modeList.Count - 1) + { + modeChangeView.AddChidren(new Button() + { + X = btnTitle.X, + Y = btnModeText.Bottom, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.BackgroundColor, + }); + } + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + dialog.Close(); + }; + EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => + { + btnModeIcon.IsSelected = btnModeText.IsSelected = true; + acDevice.SetAttrState(FunctionAttributeKey.Mode, m); + btnMode.UnSelectedImagePath = acDevice.GetModeIconPath(); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; + d.Add(FunctionAttributeKey.Mode, m); + Control.Ins.SendWriteCommand(acDevice, d); + dialog.Close(); + if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + { + arcBar.IsClickable = false; + } + else + { + arcBar.IsClickable = true; + } + }; + btnModeIcon.MouseUpEventHandler = eventHandler1; + btnModeText.MouseUpEventHandler = eventHandler1; + dialogView.MouseUpEventHandler = eventHandler; + + } + + dialogView.MouseUpEventHandler = (sender, e) => { + dialog.Close(); + }; + dialog.Show(); + } + /// <summary> + /// 鍔犺浇淇敼妯″紡鍖哄煙 + /// </summary> + void LoadDiv_ChangeFanView() + { + Dialog dialog = new Dialog(); + + FrameLayout dialogView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(dialogView); + + FrameLayout modeChangeView; + modeChangeView = new FrameLayout() + { + X = Application.GetRealWidth(185), + Y = Application.GetRealHeight(172), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(243), + BackgroundImagePath = "FunctionIcon/AC/DivBg2.png", + }; + dialogView.AddChidren(modeChangeView); + + Button btnTitle; + btnTitle = new Button() + { + X = Application.GetRealWidth(8 + 16), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(44), + TextID = StringId.ChooseFan, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.EmphasisFontSize_Secondary, + }; + modeChangeView.AddChidren(btnTitle); + + Button btnLine = new Button() + { + X = btnTitle.X, + Y = btnTitle.Bottom, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.BackgroundColor, + }; + modeChangeView.AddChidren(btnLine); + + var modeList = device.GetAttribute(FunctionAttributeKey.FanSpeed).value; + foreach (var m in modeList) + { + Button btnFanIcon = new Button() + { + X = btnTitle.X, + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, + }; + modeChangeView.AddChidren(btnFanIcon); + + Button btnFanText = new Button() + { + X = Application.GetRealWidth(12) + btnFanIcon.Right, + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(70), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, + TextSize = CSS_FontSize.TextFontSize, + }; + modeChangeView.AddChidren(btnFanText); + btnFanIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false); + btnFanIcon.SelectedImagePath = acDevice.GetModeIconPath(); + btnFanText.Text = acDevice.GetModeAttrText(m); + + if (modeList.IndexOf(m) < modeList.Count - 1) + { + modeChangeView.AddChidren(new Button() + { + X = btnTitle.X, + Y = btnFanText.Bottom, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.BackgroundColor, + }); + } + + EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) => + { + dialog.Close(); + }; + EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => + { + btnFanIcon.IsSelected = btnFanText.IsSelected = true; + acDevice.SetAttrState(FunctionAttributeKey.FanSpeed, m); + btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath(); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.FanSpeed, m); + Control.Ins.SendWriteCommand(acDevice, d); + btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; + dialog.Close(); + }; + btnFanIcon.MouseUpEventHandler = eventHandler1; + btnFanText.MouseUpEventHandler = eventHandler1; + dialogView.MouseUpEventHandler = closeDialogEvent; + } + + dialog.Show(); + } + + #endregion + + #region 鈻� 璁惧鐘舵�佸弽棣坃______________________ + + /// <summary> + /// 璁惧鐘舵�佸弽棣� + /// </summary> + /// <param name="i_LocalDevice"></param> + public override void DeviceStatuPush(Function i_LocalDevice) + { + //涓嶆槸鍚屼竴涓笢瑗� + if (this.device.sid != i_LocalDevice.sid) { return; } + + //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� + this.RefreshNowDeviceStatuMemory(i_LocalDevice); + //鍒锋柊鐣岄潰鐘舵�� + this.RefreshFormStatu(); + } + + #endregion + + #region 鈻� 鍙戦�佸悇绉嶅懡浠______________________ + + /// <summary> + /// 娓╁害鏀瑰彉妯″紡 + /// </summary> + void LoadEvent_TempChange() + { + btnMinus.MouseUpEventHandler = (sender, e) => + { + if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + { + return; + } + var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp <= acDevice.GetAttribute(FunctionAttributeKey.Mode).min) + { + return; + } + temp--; + arcBar.Progress = temp; + btnTemp.Text = temp.ToString(); + acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); + Control.Ins.SendWriteCommand(acDevice, d); + }; + btnPlus.MouseUpEventHandler = (sender, e) => + { + if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + { + return; + } + var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp >= acDevice.GetAttribute(FunctionAttributeKey.SetTemp).max) + { + return; + } + temp++; + arcBar.Progress = temp; + btnTemp.Text = temp.ToString(); + acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); + Control.Ins.SendWriteCommand(acDevice, d); + }; + arcBar.OnStopTrackingTouchEvent = (sender, e) => + { + acDevice.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + btnTemp.Text = arcBar.Progress.ToString(); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + Control.Ins.SendWriteCommand(acDevice, d); + }; + arcBar.OnProgressChangedEvent = (sender, e) => + { + acDevice.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); + btnTemp.Text = e.ToString(); + }; + } + /// <summary> + /// 鎺у埗妯″紡浜嬩欢 + /// </summary> + void LoadEvent_AcStatesChange() + { + btnMode.MouseUpEventHandler = (sender, e) => + { + if (acDevice.trait_on_off.curValue.ToString() == "off") + { + return; + } + LoadDiv_ChangeModeView(); + }; + btnWindSpeed.MouseUpEventHandler = (sender, e) => + { + if (acDevice.trait_on_off.curValue.ToString() == "off") + { + return; + } + LoadDiv_ChangeFanView(); + }; + + btnSwitch.MouseUpEventHandler = (sender, e) => + { + btnSwitch.IsSelected = !btnSwitch.IsSelected; + acDevice.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + if (acDevice.trait_on_off.curValue.ToString() == "on") + { + arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; + btnSwitch.IsSelected = true; + arcBar.IsOffline = false; + } + else + { + arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; + btnSwitch.IsBold = false; + arcBar.IsOffline = true; + } + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, acDevice.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(acDevice, d); + }; + } + + #endregion + + #region 鈻� 鍒锋柊鐣岄潰鐘舵�乢______________________ + + /// <summary> + /// 鍒锋柊鐣岄潰鐘舵�� + /// </summary> + private void RefreshFormStatu() + { + Application.RunOnMainThread(() => + { + btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); + btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C"; + btnMode.UnSelectedImagePath = acDevice.GetModeIconPath(); + btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath(); + arcBar.Progress = Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.SetTemp))); + if (acDevice.trait_on_off.curValue.ToString() == "on") + { + arcBar.IsOffline = false; + btnSwitch.IsSelected = true; + arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; + if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + { + arcBar.IsClickable = false; + } + else + { + arcBar.IsClickable = true; + } + } + else + { + arcBar.IsOffline = true; + btnSwitch.IsSelected = false; + arcBar.IsClickable = false; + arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; + } + }); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� + /// </summary> + private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) + { + } + + #endregion + } +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs index b2627e1..0d777d9 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs @@ -118,10 +118,10 @@ private void RefreshFormStatu() { Application.RunOnMainThread(() => { - var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); + var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); if (temp != null) { - if (temp.value == "open") + if (temp.state == "open") { btnIcon.IsSelected = true; btnSuctionView.TextID = StringId.Open; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs index a1815aa..1599610 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs @@ -36,9 +36,6 @@ this.InitFrameWhiteContent1(); //鍒濆鍖栫浜屼釜绱㈠紩椤电殑鍐呭 this.InitFrameWhiteContent2(); - - //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� - this.RefreshNowDeviceStatuMemory(this.device); //鍒锋柊鐣岄潰鐘舵�� this.RefreshFormStatu(); //璇诲彇鐘舵�� @@ -98,8 +95,6 @@ //涓嶆槸鍚屼竴涓笢瑗� if (this.device.sid != i_LocalDevice.sid) { return; } - //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� - this.RefreshNowDeviceStatuMemory(i_LocalDevice); //鍒锋柊鐣岄潰鐘舵�� this.RefreshFormStatu(); } @@ -118,10 +113,10 @@ private void RefreshFormStatu() { Application.RunOnMainThread(()=>{ - var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); + var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); if (temp != null) { - if (temp.value == "true") + if (temp.state == "true") { btnIcon.IsSelected = true; btnSuctionView.TextID = StringId.Someone; @@ -140,18 +135,6 @@ #endregion #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� - /// </summary> - private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) - { - foreach (var data in i_LocalDevice.status) - { - //寮�鍏� - //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; } - } - } #endregion } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs index 720eab6..67ae126 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs @@ -116,10 +116,10 @@ private void RefreshFormStatu() { Application.RunOnMainThread(() => { - var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); + var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); if (temp != null) { - if (temp.value == "alarm") + if (temp.state == "alarm") { btnIcon.IsSelected = true; btnSuctionView.TextID = StringId.InAlarm; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs index 4d2af1d..b2c3e3e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs @@ -116,10 +116,10 @@ private void RefreshFormStatu() { Application.RunOnMainThread(() => { - var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); + var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); if (temp != null) { - if (temp.value == "alarm") + if (temp.state == "alarm") { btnIcon.IsSelected = true; btnSuctionView.TextID = StringId.WaterLeakage; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs index 6454ccb..3255433 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs @@ -64,8 +64,6 @@ //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� this.InitFrameWhiteContent1(); - //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� - this.RefreshNowDeviceStatuMemory(this.device); //鍒锋柊鐣岄潰鐘舵�� this.RefreshFormStatu(); //璇诲彇鐘舵�� @@ -366,8 +364,6 @@ //涓嶆槸鍚屼竴涓笢瑗� if (this.device.sid != i_LocalDevice.sid) { return; } - //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� - this.RefreshNowDeviceStatuMemory(i_LocalDevice); //鍒锋柊鐣岄潰鐘舵�� this.RefreshFormStatu(); } @@ -389,46 +385,43 @@ { btnIcon.IsSelected = true; #region 鐐逛寒鏂囨湰 - var hotDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDry); + var hotDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDry); if (hotDryTemp != null) { - hotDryView.SetViewStatus(hotDryTemp.value == "true"); + hotDryView.SetViewStatus(hotDryTemp.state == "true"); } - var windDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDry); + var windDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDry); if (windDryTemp != null) { - windDryView.SetViewStatus(windDryTemp.value == "true"); + windDryView.SetViewStatus(windDryTemp.state == "true"); } - var disinfectTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Disinfect); + var disinfectTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Disinfect); if (disinfectTemp != null) { - disinfectView.SetViewStatus(disinfectTemp.value == "true"); + disinfectView.SetViewStatus(disinfectTemp.state == "true"); } - var lightTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.OnOff); + var lightTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.OnOff); if (lightTemp != null) { - lightingView.SetViewStatus(lightTemp.value == "on"); + lightingView.SetViewStatus(lightTemp.state == "on"); } #endregion #region 淇敼鏃堕棿 - var hotDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft); + var hotDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft); if (hotDryTimeLeftTemp != null) { - hotDryView.ChangeTime(hotDryTimeLeftTemp.value); - MainPage.Log($"鐑樺共鍓╀綑鏃堕棿{hotDryTimeLeftTemp.value}"); + hotDryView.ChangeTime(hotDryTimeLeftTemp.state); } - var windDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); + var windDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); if (windDryTimeLeftTemp != null) { - windDryView.ChangeTime(windDryTimeLeftTemp.value); - MainPage.Log($"椋庡共鍓╀綑鏃堕棿{windDryTimeLeftTemp.value}"); + windDryView.ChangeTime(windDryTimeLeftTemp.state); } - var disinfectTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); + var disinfectTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); if (disinfectTimeLeftTemp != null) { - disinfectView.ChangeTime(disinfectTimeLeftTemp.value); - MainPage.Log($"娑堟瘨鍓╀綑鏃堕棿{disinfectTimeLeftTemp.value}"); + disinfectView.ChangeTime(disinfectTimeLeftTemp.state); } #endregion @@ -439,18 +432,6 @@ #endregion #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛� - /// </summary> - private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) - { - foreach (var data in i_LocalDevice.status) - { - //寮�鍏� - //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; } - } - } #endregion } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs index 66a1372..171e369 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs @@ -784,25 +784,25 @@ /// </summary> private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) { - for (int i = 0; i < i_LocalDevice.status.Count; i++) + for (int i = 0; i < i_LocalDevice.attributes.Count; i++) { - var data = i_LocalDevice.status[i]; + var data = i_LocalDevice.attributes[i]; //妯″紡 - if (data.key == "mode") { this.airCleanerData.Mode = data.value; } + if (data.key == "mode") { this.airCleanerData.Mode = data.state; } //椋庨�熸。浣� - else if (data.key == "speed") { this.airCleanerData.Gear = data.value; } + else if (data.key == "speed") { this.airCleanerData.Gear = data.state; } //寮�鍏� - else if (data.key == "on_off") { this.airCleanerData.Open = data.value.ToLower() == "on"; } + else if (data.key == "on_off") { this.airCleanerData.Open = data.state.ToLower() == "on"; } //绔ラ攣 - else if (data.key == "lock") { this.airCleanerData.Lock = data.value.ToLower() == "true"; } + else if (data.key == "lock") { this.airCleanerData.Lock = data.state.ToLower() == "true"; } //婊よ姱澶嶄綅 - else if (data.key == "filter_reset") { this.airCleanerData.FilterReset = data.value.ToLower() == "true"; } + else if (data.key == "filter_reset") { this.airCleanerData.FilterReset = data.state.ToLower() == "true"; } //璐熺瀛� - else if (data.key == "anion") { this.airCleanerData.Anion = data.value.ToLower() == "true"; } + else if (data.key == "anion") { this.airCleanerData.Anion = data.state.ToLower() == "true"; } //瀹氭椂 else if (data.key == "countdown") { - this.airCleanerData.Timing = data.value; + this.airCleanerData.Timing = data.state; if (this.airCleanerData.Timing == "cancel") { this.airCleanerData.Timing = "0"; @@ -811,7 +811,7 @@ //绌烘皵璐ㄩ噺 else if (data.key == "pm25") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.airCleanerData.PM25Value = Convert.ToInt32(value); @@ -820,7 +820,7 @@ //婊よ姱浣跨敤鐜� else if (data.key == "filter") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.airCleanerData.FilterPersent = Convert.ToInt32(value); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs index e3fe9bc..c280a90 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs @@ -209,15 +209,15 @@ /// </summary> private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) { - for (int i = 0; i < i_LocalDevice.status.Count; i++) + for (int i = 0; i < i_LocalDevice.attributes.Count; i++) { - var data = i_LocalDevice.status[i]; + var data = i_LocalDevice.attributes[i]; //寮�鍏� - if (data.key == "on_off") { this.fanData.Open = data.value == "on"; } + if (data.key == "on_off") { this.fanData.Open = data.state == "on"; } //椋庨�熸。浣� else if (data.key == "fan_speed_percent") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.fanData.SpeedLevel = Convert.ToInt32(value); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs index 2ec37c5..89d188b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs @@ -174,12 +174,12 @@ { Application.RunOnMainThread(() => { - var onoffStatu = device.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff); - var timeStatu = device.status.Find((obj) => obj.key == FunctionAttributeKey.TuyaWaterTime); + var onoffStatu = device.attributes.Find((obj) => obj.key == FunctionAttributeKey.OnOff); + var timeStatu = device.attributes.Find((obj) => obj.key == FunctionAttributeKey.TuyaWaterTime); if (onoffStatu != null) { - if (onoffStatu.value.ToString() == "on") + if (onoffStatu.state == "on") { btnControlTip.TextID = StringId.ControllerOn; } @@ -191,7 +191,7 @@ } if (timeStatu != null) { - int.TryParse(timeStatu.value, out waterRunningTime); + int.TryParse(timeStatu.state, out waterRunningTime); } RefreshTimeButton(); }); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs index eec0502..f5028ec 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs @@ -561,42 +561,42 @@ /// </summary> private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) { - for (int i = 0; i < i_LocalDevice.status.Count; i++) + for (int i = 0; i < i_LocalDevice.attributes.Count; i++) { - var data = i_LocalDevice.status[i]; + var data = i_LocalDevice.attributes[i]; //寮�鍏� - if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; } + if (data.key == "on_off") { this.weepRobotData.Cleaning = data.state.ToLower() == "on"; } //瀵绘壘鏈哄櫒 - else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.value.ToLower() == "true"; } + else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.state.ToLower() == "true"; } //杈瑰埛閲嶇疆 - else if (data.key == "reset_edge_brush") { this.weepRobotData.ResetEdgeBrush = data.value.ToLower() == "true"; } + else if (data.key == "reset_edge_brush") { this.weepRobotData.ResetEdgeBrush = data.state.ToLower() == "true"; } //婊氬埛閲嶇疆 - else if (data.key == "reset_roll_brush") { this.weepRobotData.ResetRollBrush = data.value.ToLower() == "true"; } + else if (data.key == "reset_roll_brush") { this.weepRobotData.ResetRollBrush = data.state.ToLower() == "true"; } //婊ょ綉閲嶇疆 - else if (data.key == "reset_filter") { this.weepRobotData.ResetFilter = data.value.ToLower() == "true"; } + else if (data.key == "reset_filter") { this.weepRobotData.ResetFilter = data.state.ToLower() == "true"; } //鍚稿姏閫夋嫨 - else if (data.key == "suction") { this.weepRobotData.Suction = data.value; } + else if (data.key == "suction") { this.weepRobotData.Suction = data.state; } //宸ヤ綔妯″紡 - else if (data.key == "mode") { this.weepRobotData.Mode = data.value; } + else if (data.key == "mode") { this.weepRobotData.Mode = data.state; } //娓呮壂鏂瑰悜 - else if (data.key == "direction_control") { this.weepRobotData.DirectionControl = data.value; } + else if (data.key == "direction_control") { this.weepRobotData.DirectionControl = data.state; } //澹伴煶寮�鍏� - else if (data.key == "voice_switch") { this.weepRobotData.VoiceSwitch = data.value.ToLower() == "true"; } + else if (data.key == "voice_switch") { this.weepRobotData.VoiceSwitch = data.state.ToLower() == "true"; } //娓呮壂闈㈢Н else if (data.key == "clean_area") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.weepRobotData.CleanArea = Convert.ToInt32(value); } } //娓呮壂璁板綍 - else if (data.key == "clean_record") { this.weepRobotData.CleanRecord = data.value; } + else if (data.key == "clean_record") { this.weepRobotData.CleanRecord = data.state; } //杈瑰埛瀵垮懡 else if (data.key == "edge_brush") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.weepRobotData.EdgeBrush = Convert.ToInt32(value); @@ -605,7 +605,7 @@ //婊氬埛瀵垮懡 else if (data.key == "roll_brush") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.weepRobotData.RollBrush = Convert.ToInt32(value); @@ -614,7 +614,7 @@ //婊ょ綉瀵垮懡 else if (data.key == "filter") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.weepRobotData.Filter = Convert.ToInt32(value); @@ -623,7 +623,7 @@ //娓呮壂鏃堕棿 else if (data.key == "clean_time") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.weepRobotData.CleanTime = Convert.ToInt32(value); @@ -632,7 +632,7 @@ //鍓╀綑鐢甸噺 else if (data.key == "electricity_left") { - var value = data.value; + var value = data.state; if (value != string.Empty) { this.weepRobotData.ElectricityLeft = Convert.ToInt32(value); -- Gitblit v1.8.0