| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <?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" /> |
| | |
| | | <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> |
| | |
| | | /// </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> |
| | | /// 网关在线-局域网 |
| | |
| | | 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) |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | var pack = pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); |
| | | } |
| | | } |
| | | ///// <summary> |
| | | ///// 发送A协议读取命令 |
| | | ///// </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协议控制场景 |
| | |
| | | { |
| | | 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 |
| | | { |
| | |
| | | //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) |
| | |
| | | localAttr.curValue = attr.value; |
| | | } |
| | | } |
| | | //rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + rgb.brightness + "%"; |
| | | RelayPage.UpdataState(localSwitch); |
| | | } |
| | | break; |
| | |
| | | } |
| | | } |
| | | ac.lastState = ""; |
| | | switch (ac.trait_mode.curValue.ToString()) |
| | | switch (ac.GetAttrState(FunctionAttributeKey.Mode)) |
| | | { |
| | | case "cool": |
| | | ac.lastState = Language.StringByID(StringId.Cool); |
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | 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)
|
| | |
| | | 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; |
| | |
| | | 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: |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | 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; |
| | |
| | | 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}"); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.trait_IndoorTemp.curValue = receiveBytes[1].ToString(); |
| | | ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[1].ToString()); |
| | | FunctionPage.UpdataStates(ac); |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class AC : Function |
| | | { |
| | | /* |
| | | * 空调:trait: [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:摄氏度 |
| | |
| | | /// 当前模式索引 |
| | | /// 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> |
| | | /// 模式属性 |
| | |
| | | return _trait_IndoorTemp; |
| | | } |
| | | } |
| | | */ |
| | | |
| | | /// <summary> |
| | | /// 当前模式的icon路径 |
| | | /// </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; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | /// <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> |
| | | /// 设置属性状态 |
| | |
| | | /// <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 |
| | | /// 举例: 来源 厂商代码 通讯方式 产品时间戳 产品类别 物模型类 通道号 大小类别 |
| | | /// 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte |
| | | /// 来源:00 默认原生态系统数据 、01 网关或者其他A设备、02 调试软件、03 APP应用程序、04 第三方网关或者平台 |
| | | /// 厂商代码: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> |
| | | /// 备注 |
| | |
| | | /// 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列表 |
| | |
| | | sendDataObj.time_stamp = Control.Ins.Get_TimeStamp(); |
| | | |
| | | |
| | | var acd = new AlinkControlData(); |
| | | var acd = new AlinkStatusData(); |
| | | acd.sid = sid; |
| | | foreach (var dic in commandDictionary) |
| | | { |
| | |
| | | /// </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 = ""; |
| | |
| | | public string time_stamp = ""; |
| | | } |
| | | /// <summary> |
| | | /// A协议控制数据 |
| | | /// A协议状态数据 |
| | | /// </summary> |
| | | public class AlinkControlData |
| | | public class AlinkStatusData |
| | | { |
| | | /* |
| | | mqtt接收的状态数据没有deviceId |
| | | 接口反馈的数据有 |
| | | */ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string sid = ""; |
| | | /// <summary> |
| | | /// 设备ID |
| | | /// 云端负责生成 |
| | | /// </summary> |
| | | public string deviceId = "0"; |
| | | public List<AttributesStatus> status = new List<AttributesStatus>(); |
| | | } |
| | | /// <summary> |
| | |
| | | /// 数据类型 |
| | | /// </summary> |
| | | public string data_type = ""; |
| | | /// <summary> |
| | | /// 当前状态 |
| | | /// </summary> |
| | | public string state = ""; |
| | | /// <summary> |
| | | /// 当前值 |
| | | /// </summary> |
| | |
| | | /// 凉霸 |
| | | /// </summary> |
| | | public const string ClothesHanger = "electrical.racks"; |
| | | /// <summary> |
| | | /// 红外宝 |
| | | /// </summary> |
| | | public const string IrModule = "ir.module"; |
| | | /// <summary> |
| | | /// 红外空调 |
| | | /// </summary> |
| | | public const string IrAC = "ir.ac"; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | 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> |
| | |
| | | ///// <summary> |
| | | ///// 场景背景 |
| | | ///// </summary> |
| | | //public string ImagePath = "Intelligence/Gallery/scenebg1.png";//"FunctionIcon/Scene/s1.png"; |
| | | |
| | | ///// <summary> |
| | | ///// 场景背景 |
| | | ///// </summary> |
| | | public string ImagePath |
| | | { |
| | | get |
| | |
| | | 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> |
| | |
| | | { |
| | | 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> |
| | | /// 场景推送配置 |
| | |
| | | { |
| | | _FunctionList = new FunctionList(); |
| | | #region 恢复数据 |
| | | var filePathList = Common.FileUtlis.Files.ReadFiles(); |
| | | var filePathList = FileUtlis.Files.ReadFiles(); |
| | | foreach (var filePath in filePathList) |
| | | { |
| | | _FunctionList.IniFunctionList(filePath); |
| | |
| | | return _FunctionList; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 功能列表 |
| | | /// </summary> |
| | | public List<Function> Functions = new List<Function>(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 空调列表 |
| | |
| | | /// 凉霸列表 |
| | | /// </summary> |
| | | public List<Function> clothesHangerList = new List<Function>(); |
| | | /// <summary> |
| | | /// 红外宝列表 |
| | | /// </summary> |
| | | public List<Function> irModule = new List<Function>(); |
| | | |
| | | #endregion |
| | | /// <summary> |
| | |
| | | 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> |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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> |
| | |
| | | #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 |
| | | } |
| | |
| | | <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\" />
|
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | {
|
| | | 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是当前设备上报过的属性才会存在,也就是它的个数有可能和attributes不一致 |
| | | 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是当前设备上报过的属性才会存在,也就是它的个数有可能和attributes不一致 |
| | | // 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);
|
| | |
| | | //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"; |
| | |
| | | |
| | | 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() |
| | | { |
| | |
| | | SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon1On.png", |
| | | }; |
| | | bodyDiv.AddChidren(btnClothesHangerDown); |
| | | LoadEvent_ControlClothesHanger(function, btnClothesHangerDown, btnClothesHangerUp); |
| | | LoadEvent_ControlClothesHanger(function, btnClothesHangerUp, btnClothesHangerDown); |
| | | #endregion |
| | | |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | { |
| | | 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"); |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | 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) |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = FunctionList.List.GetDelayText( scene.delay) |
| | | Text = scene.GetDelayText() |
| | | }; |
| | | sceneDelayRow.AddChidren(btnSceneDelayInfo); |
| | | |
| | |
| | | { |
| | | 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>(); |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | 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) |
| | |
| | | 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) |
| | |
| | | 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) => |
| | |
| | | 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); |
| | | |
| | |
| | | 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"); |
| | |
| | | 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) |
| | |
| | | { |
| | | 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) |
| | |
| | | { |
| | | temp.value = "0"; |
| | | } |
| | | btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; |
| | | btnBrightnessText.Text = temp.GetValueText() + "%"; |
| | | } |
| | | }; |
| | | |
| | |
| | | }; |
| | | 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(); |
| | |
| | | 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(),""); |
| | | }; |
| | | |
| | | } |
| | |
| | | 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, |
| | |
| | | { |
| | | 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) |
| | |
| | | { |
| | | temp.value = "off"; |
| | | } |
| | | btnOnText.Text = FunctionList.List.GetValueText(temp.key, temp.value); |
| | | btnOnText.Text = temp.GetValueText(); |
| | | } |
| | | }; |
| | | } |
| | |
| | | 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, |
| | |
| | | { |
| | | dialog.Close(); |
| | | trait.value = controlBar.Progress.ToString(); |
| | | btn.Text = trait.value + FunctionList.List.GetUintString(trait.key); |
| | | btn.Text = trait.value + trait.GetUintString(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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, |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Tag = m, |
| | | Text = FunctionList.List.GetValueText(trait.key, m) |
| | | Text = trait.GetValueText() |
| | | }; |
| | | row.AddChidren(btnPropertyTitle); |
| | | |
| | |
| | | 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), |
| | |
| | | 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); |
| | |
| | | Y = Application.GetRealHeight(334), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = aC.curModeImage, |
| | | UnSelectedImagePath = aC.GetModeIconPath(), |
| | | }; |
| | | controlView.AddChidren(btnMode); |
| | | |
| | |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = aC.curFanImage, |
| | | UnSelectedImagePath = aC.GetFanIconPath(), |
| | | }; |
| | | controlView.AddChidren(btnWindSpeed); |
| | | |
| | |
| | | }; |
| | | 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); |
| | |
| | | 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, |
| | |
| | | }; |
| | | 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); |
| | |
| | | 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() |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((() => |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | |
| | | 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; |
| | | } |
| | |
| | | bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | |
| | | }); |
| | | })); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | 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()); |
| | |
| | | }; |
| | | 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> |
| | |
| | | /// <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) => |
| | | { |
| | |
| | | }; |
| | | 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; |
| | | } |
| | |
| | | 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) => |
| | | { |
| | |
| | | }; |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | using 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 |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | this.InitFrameWhiteContent1(); |
| | | //初始化第二个索引页的内容 |
| | | this.InitFrameWhiteContent2(); |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | |
| | | //不是同一个东西 |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | |
| | | 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; |
| | |
| | | #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 |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent1(); |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | |
| | | //不是同一个东西 |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | |
| | | { |
| | | 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 |
| | | |
| | |
| | | #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 |
| | | } |
| | |
| | | /// </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";
|
| | |
| | | //空气质量
|
| | | else if (data.key == "pm25")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.airCleanerData.PM25Value = Convert.ToInt32(value);
|
| | |
| | | //滤芯使用率
|
| | | else if (data.key == "filter")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.airCleanerData.FilterPersent = Convert.ToInt32(value);
|
| | |
| | | /// </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);
|
| | |
| | | { |
| | | 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; |
| | | } |
| | |
| | | } |
| | | if (timeStatu != null) |
| | | { |
| | | int.TryParse(timeStatu.value, out waterRunningTime); |
| | | int.TryParse(timeStatu.state, out waterRunningTime); |
| | | } |
| | | RefreshTimeButton(); |
| | | }); |
| | |
| | | /// </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);
|
| | |
| | | //滚刷寿命
|
| | | else if (data.key == "roll_brush")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.RollBrush = Convert.ToInt32(value);
|
| | |
| | | //滤网寿命
|
| | | else if (data.key == "filter")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.Filter = Convert.ToInt32(value);
|
| | |
| | | //清扫时间
|
| | | else if (data.key == "clean_time")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.CleanTime = Convert.ToInt32(value);
|
| | |
| | | //剩余电量
|
| | | else if (data.key == "electricity_left")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.ElectricityLeft = Convert.ToInt32(value);
|