| | |
| | | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.220222E9-B9CA-4834-9318-2BC22465F050" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Function.cs"> |
| | | <Files> |
| | | <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="190" Column="57" /> |
| | | <File FileName="HDL_ON/Entity/Function/Function.cs" Line="420" Column="21" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" Line="760" Column="141" /> |
| | | <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs" /> |
| | | <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="190" Column="55" /> |
| | | <File FileName="HDL_ON/Entity/Function/Function.cs" Line="430" Column="1" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="Common" expanded="True" /> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="Server" expanded="True" /> |
| | | <Node name="DriverLayer" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Function" expanded="True"> |
| | | <Node name="Function.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI1-Login" expanded="True" /> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="1-HomePage" expanded="True" /> |
| | | <Node name="FuntionControlView" expanded="True"> |
| | | <Node name="AC" expanded="True" /> |
| | | <Node name="ArmSensor" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | |
| | | <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.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.7374d754" /> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" line="42" column="1" /> |
| | |
| | | //处理剩下的新增功能 |
| | | foreach (var newFunction in deviceList.list) |
| | | { |
| | | newFunction.AssembleStatus(); |
| | | newFunction.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(newFunction.savePath); |
| | | } |
| | |
| | | ColorTureLampPage.UpdataStatus(localFunction); |
| | | break; |
| | | case SPK.CurtainSwitch: |
| | | localFunction.lastState = localFunction.trait_on_off.curValue.ToString() == "on" ? Language.StringByID(StringId.Open) : Language.StringByID(StringId.Close); |
| | | localFunction.lastState = localFunction.trait_on_off.state.ToString() == "on" ? Language.StringByID(StringId.Open) : Language.StringByID(StringId.Close); |
| | | CurtainModulePage.UpdataState(localFunction); |
| | | break; |
| | | case SPK.CurtainTrietex: |
| | |
| | | byte b0 = 100;//开关操作依据on_off字段,实际开关值依据brightness,当on_off为打开,brightness不能为0 |
| | | if(commandDictionary.ContainsKey(FunctionAttributeKey.OnOff)) |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | b0 = 0; |
| | | } |
| | |
| | | break; |
| | | case SPK.LightRGB: |
| | | byte b = 100;//开关操作依据on_off字段,实际开关值依据brightness,当on_off为打开,brightness不能为0 |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | b = 0; |
| | | } |
| | |
| | | break; |
| | | case SPK.LightDimming: |
| | | byte b1 = 100; |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | b1 = 0; |
| | | } |
| | |
| | | 0, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) }); |
| | | break; |
| | | case SPK.LightSwitch: |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 }); |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.state.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 }); |
| | | break; |
| | | } |
| | | break; |
| | |
| | | { |
| | | case SPK.CurtainSwitch: |
| | | byte b1 = 0; |
| | | if (function.trait_on_off.curValue.ToString() == "stop") |
| | | if (function.trait_on_off.state.ToString() == "stop") |
| | | { |
| | | b1 = 0; |
| | | } |
| | | else if (function.trait_on_off.curValue.ToString() == "on") |
| | | else if (function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | b1 = 1; |
| | | } |
| | |
| | | break; |
| | | case SPK.CurtainTrietex: |
| | | case SPK.CurtainRoller: |
| | | if (function.trait_on_off.curValue.ToString() == "stop") |
| | | if (function.trait_on_off.state.ToString() == "stop") |
| | | { |
| | | ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, 0 }); |
| | | } |
| | |
| | | switch (dic.Key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 3, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId }); |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 3, function.trait_on_off.state.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId }); |
| | | break; |
| | | case "mode": |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 6, ac.GetModeIndex(function), function.bus.LoopId }); |
| | |
| | | switch (dic.Key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 20, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId }); |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 20, function.trait_on_off.state.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId }); |
| | | break; |
| | | case "mode": |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 21, fhTemp.GetModeIndex(function), function.bus.LoopId }); |
| | |
| | | } |
| | | else |
| | | { |
| | | var onoffString = function.trait_on_off.curValue.ToString(); |
| | | var onoffString = function.trait_on_off.state.ToString(); |
| | | byte b1 = 1; |
| | | if (onoffString == "off") |
| | | { |
| | |
| | | switch (function.spk) |
| | | { |
| | | case SPK.ElectricFan: |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | if (function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.OpenLevel)) }); |
| | | } |
| | |
| | | } |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 }); |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.state.ToString() == "on" ? (byte)100 : (byte)0 }); |
| | | break; |
| | | } |
| | | break; |
| | |
| | | { |
| | | if (updataObj.spk != SPK.LightRGB) |
| | | { |
| | | updataObj.trait_on_off.curValue = receiveBytes[2] > 0 ? "on" : "off"; |
| | | if (updataObj.trait_on_off.curValue.ToString() == "on") |
| | | updataObj.trait_on_off.state = receiveBytes[2] > 0 ? "on" : "off"; |
| | | if (updataObj.trait_on_off.state.ToString() == "on") |
| | | { |
| | | switch (updataObj.spk) |
| | | { |
| | |
| | | { |
| | | if (light.spk != SPK.LightRGB) |
| | | { |
| | | light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"; |
| | | if (light.trait_on_off.curValue.ToString() == "on") |
| | | light.trait_on_off.state = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"; |
| | | if (light.trait_on_off.state.ToString() == "on") |
| | | { |
| | | light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString()); |
| | | light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; |
| | |
| | | if (function != null) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | if (function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString()); |
| | | function.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | |
| | | { |
| | | if (lightTeme.spk == SPK.LightRGB) |
| | | { |
| | | lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | lightTeme.trait_on_off.state = receiveBytes[1] > 0 ? "on" : "off"; |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | |
| | | RGBPage.UpdataStates(lightTeme); |
| | | }else if(lightTeme.spk == SPK.LightCCT) |
| | | { |
| | | lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | lightTeme.trait_on_off.state = receiveBytes[1] > 0 ? "on" : "off"; |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | |
| | | { |
| | | if (receiveBytes[1] > 1) |
| | | { |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.trait_on_off.state = "on"; |
| | | } |
| | | else |
| | | { |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.trait_on_off.state = "off"; |
| | | } |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString()); |
| | | curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%"; |
| | |
| | | switch (receiveBytes[1]) |
| | | { |
| | | case 0: |
| | | curtain.trait_on_off.curValue = "stop"; |
| | | curtain.trait_on_off.state = "stop"; |
| | | break; |
| | | case 1: |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.trait_on_off.state = "on"; |
| | | curtain.lastState = Language.StringByID(StringId.Open); |
| | | break; |
| | | case 2: |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.trait_on_off.state = "off"; |
| | | curtain.lastState = Language.StringByID(StringId.Close); |
| | | break; |
| | | } |
| | |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString()); |
| | | function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | function.trait_on_off.state = receiveBytes[8] == 1 ? "on" : "off"; |
| | | acFunction.SetMode(receiveBytes[9],function); |
| | | acFunction.SetFan(receiveBytes[10],function); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString()); |
| | |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]); |
| | | function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on"; |
| | | function.trait_on_off.state = receiveBytes[1] % 2 == 0 ? "off" : "on"; |
| | | new FloorHeating().SetModeIndex(receiveBytes[3],function); |
| | | |
| | | if (function.Fh_Mode_Temp.ContainsKey("normal")) |
| | |
| | | switch (receiveBytes[0]) |
| | | { |
| | | case 3:// |
| | | function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off"; |
| | | function.trait_on_off.state = receiveBytes[1] == 1 ? "on" : "off"; |
| | | break; |
| | | case 4: |
| | | case 7: |
| | |
| | | else |
| | | { |
| | | attr.state = value.ToString(); |
| | | attr.curValue = value.ToString(); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | max = 1, |
| | | min = 0, |
| | | }; |
| | | _trait_on_off.curValue = "off"; |
| | | _trait_on_off.state = "off"; |
| | | } |
| | | } |
| | | if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off" && _trait_on_off.curValue.ToString() != "stop") |
| | | if(_trait_on_off.state.ToString() != "on"&& _trait_on_off.state.ToString() != "off" && _trait_on_off.state.ToString() != "stop") |
| | | { |
| | | _trait_on_off.curValue = "off"; |
| | | _trait_on_off.state = "off"; |
| | | } |
| | | return _trait_on_off; |
| | | } |
| | |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过状态列表组装属性里面的状态 |
| | | /// </summary> |
| | | public void AssembleStatus() |
| | | { |
| | | foreach(var sta in status) |
| | | { |
| | | SetAttrState(sta.key, sta.value); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存房间绑定信息 |
| | | /// </summary> |
| | |
| | | case FunctionAttributeKey.FanSpeed: |
| | | case FunctionAttributeKey.Percent: |
| | | //case FunctionAttributeKey.FadeTime: |
| | | if (attr.curValue.ToString() == "{}") |
| | | if (attr.state.ToString() == "{}") |
| | | { |
| | | if (attr.key == FunctionAttributeKey.OnOff) |
| | | { |
| | | attr.curValue = "off"; |
| | | attr.state = "off"; |
| | | } |
| | | else if (attr.key == FunctionAttributeKey.Mode ) |
| | | { |
| | | if (DB_ResidenceData.Instance.GatewayType == 0) |
| | | { |
| | | attr.curValue = "0"; |
| | | attr.state = "0"; |
| | | } |
| | | else |
| | | { |
| | | if (SPK.AcSpkList().Contains(spk)) |
| | | { |
| | | attr.curValue = "cool"; |
| | | attr.state = "cool"; |
| | | } |
| | | else if (SPK.FhSpkList().Contains(spk)) |
| | | { |
| | | attr.curValue = "day"; |
| | | attr.state = "day"; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | attr.curValue = "0"; |
| | | attr.state = "0"; |
| | | } |
| | | } |
| | | if (attr.key == FunctionAttributeKey.SetTemp) |
| | | { |
| | | double vv = 16; |
| | | Double.TryParse(attr.curValue.ToString(), out vv); |
| | | Double.TryParse(attr.state.ToString(), out vv); |
| | | if (vv == 0) |
| | | { |
| | | vv = 26; |
| | |
| | | } |
| | | else |
| | | { |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() }); |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.state.ToString() }); |
| | | } |
| | | break; |
| | | } |
| | |
| | | public string value = ""; |
| | | } |
| | | |
| | | public class attttttt |
| | | { |
| | | /// <summary> |
| | | /// 当前状态 |
| | | /// </summary> |
| | | public string state = ""; |
| | | /// <summary> |
| | | /// 当前值 |
| | | /// </summary> |
| | | public object curValue = new object(); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 功能属性 |
| | | /// 属性字段解析:attri :属性内容,value 属性的值,max 最大值 min 最小值 |
| | |
| | | /// 当前状态 |
| | | /// </summary> |
| | | public string state = ""; |
| | | /// <summary> |
| | | /// 当前值 |
| | | /// </summary> |
| | | public object curValue = new object(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | collect = true, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="100",state = "100" }, |
| | | new FunctionAttributes() { key = "rgb",value =new List<string>(){ "0","100" }, curValue="0,0,0",state = "0,0,0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state="on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "100" }, |
| | | new FunctionAttributes() { key = "rgb",value =new List<string>(){ "0","100" }, state = "0,0,0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightRgb1.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "rgb",value =new List<string>(){ "0","100" }, curValue="0,0,0",state = "0,0,0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "rgb",value =new List<string>(){ "0","100" }, state = "0,0,0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightRgb2.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightCct.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightSwitch1.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightSwitch2.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "percent",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "percent",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | curtain1.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "percent",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "percent",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | curtain2.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { "1405771024583090178"}, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "mode",value =new List<string>(){ "day", "night", "away", "normal", "timer" }, curValue="day",state = "day" }, |
| | | new FunctionAttributes() { key = "set_temp",value =new List<string>(){ "" }, curValue="26",state = "26" }, |
| | | new FunctionAttributes() { key = "room_temp",value =new List<string>(){ "" }, curValue="26",state = "26" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "mode",value =new List<string>(){ "day", "night", "away", "normal", "timer" }, state = "day" }, |
| | | new FunctionAttributes() { key = "set_temp",value =new List<string>(){ "" }, state = "26" ,max = 30,min =16 }, |
| | | new FunctionAttributes() { key = "room_temp",value =new List<string>(){ "" }, state = "26" }, |
| | | }, |
| | | }; |
| | | fh.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { room3.roomId }, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightSwitch3.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { room3.roomId }, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightSwitch4.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { room3.roomId }, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off", value = new List<string>() { "on", "off" }, curValue = "on", state = "on" }, |
| | | new FunctionAttributes() { key = "mode", value = new List<string>() { "cool", "heat", "fan", "auto", "dry" }, curValue = "cool", state = "cool" }, |
| | | new FunctionAttributes() { key = "fan", value = new List<string>() { "high", "medium", "low", "auto" }, curValue = "auto", state = "auto" }, |
| | | new FunctionAttributes() { key = "set_temp", value = new List<string>() { "16", "30"}, curValue = "16", state = "16",max = 30,min = 16 }, |
| | | new FunctionAttributes() { key = "room_temp", value = new List<string>() { }, curValue = "20", state = "20" }, |
| | | new FunctionAttributes() { key = "swing", value = new List<string>() {"up_down", "left_right", "stop" }, curValue = "20", state = "20" }, |
| | | new FunctionAttributes() { key = "on_off", value = new List<string>() { "on", "off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "mode", value = new List<string>() { "cool", "heat", "fan", "auto", "dry" }, state = "cool" }, |
| | | new FunctionAttributes() { key = "fan", value = new List<string>() { "high", "medium", "low", "auto" }, state = "auto" }, |
| | | new FunctionAttributes() { key = "set_temp", value = new List<string>() { "16", "30"}, state = "16",max = 30,min = 16 }, |
| | | new FunctionAttributes() { key = "room_temp", value = new List<string>() { }, state = "20" }, |
| | | new FunctionAttributes() { key = "swing", value = new List<string>() {"up_down", "left_right", "stop" }, state = "20" }, |
| | | } |
| | | }; |
| | | ac.SaveFunctionFile(); |
| | |
| | | roomIds = new List<string>() { room1.roomId }, |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, state = "0" }, |
| | | }, |
| | | }; |
| | | lightSwitch6.SaveFunctionFile(); |
| | |
| | | btnPower.IsSelected = false; |
| | | Music.SendMethod.Pause(a31player); |
| | | a31player.A31PlayStatus.status = "pause"; |
| | | a31player.trait_on_off.curValue = "off"; |
| | | a31player.trait_on_off.state = "off"; |
| | | } |
| | | else |
| | | { |
| | | btnPower.IsSelected = true; |
| | | Music.SendMethod.Play(a31player); |
| | | a31player.A31PlayStatus.status = "play"; |
| | | a31player.trait_on_off.curValue = "on"; |
| | | a31player.trait_on_off.state = "on"; |
| | | } |
| | | UpdataFunctionStates(a31player); |
| | | }; |
| | |
| | | /// </summary> |
| | | public static void LoadEvent_RefreshEnvirIndoorHumi() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | |
| | | name = enviTemp.name, |
| | | sid = enviTemp.sid, |
| | | deviceId = enviTemp.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = tempAttr.state, curValue = tempAttr.curValue } }, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = tempAttr.state } }, |
| | | }; |
| | | humiSensorList.Add(newTemp); |
| | | } |
| | |
| | | } |
| | | bodyView.btnIndoorHumiValues.Width = bodyView.btnIndoorHumiValues.GetTextWidth(); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新室内传感器数据-晚点 |
| | | /// </summary> |
| | | public static void LoadEvent_RefreshEnvirIndoorTemp() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | |
| | | name = enviTemp.name, |
| | | sid = enviTemp.sid, |
| | | deviceId = enviTemp.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = tempAttr.state, curValue = tempAttr.curValue } }, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = tempAttr.state } }, |
| | | }; |
| | | tempSensorList.Add(newTemp); |
| | | } |
| | |
| | | } |
| | | bodyView.btnIndoorTempValues.Width = bodyView.btnIndoorTempValues.GetTextWidth(); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public static void UpdataFunctionStates(Function function) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | state = function.trait_on_off.curValue.ToString() == "on"; |
| | | state = function.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | for (int i = 0; i < view.ChildrenCount; i++) |
| | | { |
| | |
| | | { |
| | | MainPage.Log($"HomePage updata funciton states error {ex.Message}"); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | }); |
| | | } |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB) |
| | | { |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | if (btnSwitch.IsSelected) |
| | | { |
| | | d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString()); |
| | |
| | | } |
| | | else |
| | | { |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | }) |
| | |
| | | btnClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnClose.IsSelected = true; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.trait_on_off.state = "off"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnOpen.IsSelected = true; |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.trait_on_off.state = "on"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 100); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | (fcView.GetChildren(j) as Button).IsSelected = updataFunction.trait_on_off.curValue.ToString() == "on"; |
| | | (fcView.GetChildren(j) as Button).IsSelected = updataFunction.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | try |
| | | { |
| | | (fcView.GetChildren(j) as DiyImageSeekBar).Progress = Convert.ToInt32(updataFunction.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | if (updataFunction.trait_on_off.curValue.ToString() == "on") |
| | | if (updataFunction.trait_on_off.state.ToString() == "on") |
| | | { |
| | | (fcView.GetChildren(j) as DiyImageSeekBar).ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | (fcView.GetChildren(j) as Button).IsSelected = updataFunction.trait_on_off.curValue.ToString() == "on"; |
| | | (fcView.GetChildren(j) as Button).IsSelected = updataFunction.trait_on_off.state.ToString() == "on"; |
| | | (fcView.GetChildren(j) as Button).Text = updataFunction.lastState; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | case ShowFunction.Light: |
| | | #region Light |
| | | functionCount = FunctionList.List.GetLightList().Count; |
| | | functionOnCount = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.AC: |
| | | #region AC |
| | | functionCount = FunctionList.List.GetAcList().Count; |
| | | functionOnCount = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.Curtain: |
| | | #region Curtain |
| | | functionCount = FunctionList.List.GetCurtainList().Count; |
| | | functionOnCount = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.FloorHeating: |
| | | #region 地热 |
| | | functionCount = FunctionList.List.GetFloorHeatingList().Count; |
| | | functionOnCount = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.DoorLock: |
| | |
| | | case ShowFunction.Electric: |
| | | #region 电器 |
| | | functionCount = FunctionList.List.GetElectricals().Count; |
| | | functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.EnergyMonitoring: |
| | | #region 能源 |
| | | functionCount = FunctionList.List.GetEnergyList().Count; |
| | | functionOnCount = FunctionList.List.GetEnergyList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetEnergyList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.Environmental: |
| | |
| | | break; |
| | | case ShowFunction.FreshAir: |
| | | functionCount = FunctionList.List.GetAirFreshList().Count; |
| | | functionOnCount = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | functionOnCount = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count; |
| | | break; |
| | | case ShowFunction.Music: |
| | | //functionCount = Music.A31MusicModel.A31MusicModelList.Count; |
| | |
| | | switch (functionCategory) |
| | | { |
| | | case ShowFunction.FloorHeating: |
| | | btnText = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); |
| | | btnText = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString(); |
| | | break; |
| | | case ShowFunction.AC: |
| | | btnText = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); |
| | | btnText = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString(); |
| | | break; |
| | | case ShowFunction.Curtain: |
| | | btnText = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); |
| | | btnText = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString(); |
| | | break; |
| | | case ShowFunction.Light: |
| | | btnText = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); |
| | | btnText = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString(); |
| | | break; |
| | | case ShowFunction.Electric: |
| | | btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); |
| | | btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString(); |
| | | break; |
| | | case ShowFunction.FreshAir: |
| | | btnText = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); |
| | | btnText = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString(); |
| | | break; |
| | | } |
| | | if (btn.Tag.ToString() == functionCategory + "_onCount") |
| | |
| | | var btn = view1.GetChildren(j) as Button; |
| | | if (btn.Tag != null && btn.Tag.ToString() == "AllClose") |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | if (function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | btn.Visible = true; |
| | | } |
| | |
| | | { |
| | | continue; |
| | | } |
| | | var ssd = r.GetRoomFunctions(false).FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on"); |
| | | var ssd = r.GetRoomFunctions(false).FindAll((obj) => obj.trait_on_off.state.ToString() == "on"); |
| | | var sss = ssd.Count; |
| | | if (sss == 0) |
| | | { |
| | |
| | | { |
| | | foreach (var f in room.GetRoomFunctions(false)) |
| | | { |
| | | f.trait_on_off.curValue = "off"; |
| | | f.trait_on_off.state = "off"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("on_off", f.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | } |
| | | |
| | |
| | | }; |
| | | foreach (var f in room.GetRoomFunctions(false)) |
| | | { |
| | | if (f.trait_on_off.curValue.ToString() == "on") |
| | | if (f.trait_on_off.state.ToString() == "on") |
| | | { |
| | | btn.Visible = true; |
| | | break; |
| | |
| | | case ShowFunction.AC: |
| | | foreach (var f in FunctionList.List.GetAcList()) |
| | | { |
| | | f.trait_on_off.curValue = onoff; |
| | | f.trait_on_off.state = onoff; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(sleepTime); |
| | | } |
| | |
| | | case ShowFunction.FloorHeating: |
| | | foreach (var f in FunctionList.List.GetFloorHeatingList()) |
| | | { |
| | | f.trait_on_off.curValue = onoff; |
| | | f.trait_on_off.state = onoff; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(sleepTime); |
| | | } |
| | |
| | | case ShowFunction.Light: |
| | | foreach (var f in FunctionList.List.GetLightList()) |
| | | { |
| | | f.trait_on_off.curValue = onoff; |
| | | f.trait_on_off.state = onoff; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(sleepTime); |
| | | } |
| | |
| | | case ShowFunction.Electric: |
| | | foreach (var f in FunctionList.List.GetElectricals()) |
| | | { |
| | | f.trait_on_off.curValue = onoff; |
| | | f.trait_on_off.state = onoff; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(sleepTime); |
| | | } |
| | |
| | | case ShowFunction.FreshAir: |
| | | foreach (var f in FunctionList.List.GetAirFreshList()) |
| | | { |
| | | f.trait_on_off.curValue = onoff; |
| | | f.trait_on_off.state = onoff; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(sleepTime); |
| | | } |
| | |
| | | { |
| | | foreach (var f in FunctionList.List.GetCurtainList()) |
| | | { |
| | | f.trait_on_off.curValue = "on"; |
| | | f.trait_on_off.state = "on"; |
| | | f.SetAttrState(FunctionAttributeKey.Percent, "100"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("on_off", f.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | |
| | | btnOpen.IsSelected = false; |
| | | foreach (var f in FunctionList.List.GetCurtainList()) |
| | | { |
| | | f.trait_on_off.curValue = "off"; |
| | | f.trait_on_off.state = "off"; |
| | | f.SetAttrState(FunctionAttributeKey.Percent, "0"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("on_off", f.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", f.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | } |
| | | }; |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on", |
| | | IsSelected = function.trait_on_off.state.ToString() == "on", |
| | | Tag = function.sid + "_Switch", |
| | | }; |
| | | bodyDiv.AddChidren(btnSwitch); |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on", |
| | | IsSelected = function.trait_on_off.state.ToString() == "on", |
| | | Tag = function.sid + "_Switch", |
| | | }; |
| | | bodyDiv.AddChidren(btnSwitch); |
| | |
| | | LoadLastStatesButton(); |
| | | break; |
| | | case FunctionCategory.Light: |
| | | btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; |
| | | btnSwitch.IsSelected = function.trait_on_off.state.ToString() == "on"; |
| | | LoadLightControl(); |
| | | break; |
| | | case FunctionCategory.Electric: |
| | | btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; |
| | | btnSwitch.IsSelected = function.trait_on_off.state.ToString() == "on"; |
| | | break; |
| | | } |
| | | #endregion |
| | |
| | | SeekBarViewHeight = Application.GetRealHeight(8), |
| | | ThumbImagePath = "Public/ThumbImage.png", |
| | | ThumbImageHeight = Application.GetRealHeight(54), |
| | | ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.PromptingColor2, |
| | | ProgressBarColor = function.trait_on_off.state.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.PromptingColor2, |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | MaxValue = 100, |
| | |
| | | TextColor = 0x00000000, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | Tag = function.spk + "_laststates_" + function.sid, |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | bodyDiv.AddChidren(btnLastStates); |
| | | } |
| | |
| | | { |
| | | if(bodyDiv!= null) |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | Application.RunOnMainThread((Action)(() => { |
| | | if(bodyDiv.Tag.ToString() == upfunc.sid) |
| | | { |
| | | for (var o = 0; o < bodyDiv.ChildrenCount; o++) |
| | |
| | | { |
| | | if (btn.Tag.ToString() == upfunc.sid + "_Switch")// + "_DimmerBar") |
| | | { |
| | | btn.IsSelected = upfunc.trait_on_off.curValue.ToString() == "on"; |
| | | btn.IsSelected = upfunc.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | if(fadeTime!= null) |
| | | { |
| | | int result = 0; |
| | | int.TryParse(fadeTime.curValue.ToString(), out result); |
| | | int.TryParse(fadeTime.state.ToString(), out result); |
| | | d.Add(FunctionAttributeKey.FadeTime, result.ToString()); |
| | | } |
| | | Control.Ins.SendWriteCommand(function, d); |
| | |
| | | { |
| | | if (function.Spk_Prefix == FunctionCategory.Light) |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | }) |
| | |
| | | btnClose.IsSelected = true; |
| | | btnStop.IsSelected = false; |
| | | btnOpen.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.trait_on_off.state = "off"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | |
| | | btnStop.IsSelected = true; |
| | | btnClose.IsSelected = false; |
| | | btnOpen.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "stop"; |
| | | curtain.trait_on_off.state = "stop"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | |
| | | btnOpen.IsSelected = true; |
| | | btnClose.IsSelected = false; |
| | | btnStop.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.trait_on_off.state = "on"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 100); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | } |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.trait_on_off.state.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.trait_on_off.state.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | if (device.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | //扫风改变模式 |
| | | btnSwing.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | if (device.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | if (device.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | device.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.trait_on_off.state.ToString() == "on") |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | btnSwitch.IsSelected = true; |
| | |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | } |
| | |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | btnTemp.Text = Convert.ToDouble( device.GetAttrState(FunctionAttributeKey.SetTemp)).ToString(); |
| | | btnTemp.Text = Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)).ToString(); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing)); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | if (device.trait_on_off.state.ToString() == "on") |
| | | { |
| | | arcBar.IsOffline = false; |
| | | btnSwitch.IsSelected = true; |
| | |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = device.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = device.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnSwitch); |
| | | |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.trait_on_off.state.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.trait_on_off.state.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | if (device.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | device.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.trait_on_off.state.ToString() == "on") |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | btnSwitch.IsSelected = true; |
| | |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | } |
| | |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = fhTemp.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | if (device.trait_on_off.state.ToString() == "on") |
| | | { |
| | | arcBar.IsOffline = false; |
| | | btnSwitch.IsSelected = true; |
| | |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | OpenAngle = 160, |
| | | ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", |
| | | ThumbImagePath = function.trait_on_off.state.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", |
| | | ThumbImageHeight = Application.GetRealWidth(50), |
| | | ProgressBarColor = CSS_Color.MainColor, |
| | | OfflineProgressBarColor = CSS_Color.PromptingColor2, |
| | | IsOffline = function.trait_on_off.curValue.ToString() == "off", |
| | | IsOffline = function.trait_on_off.state.ToString() == "off", |
| | | MinValue = function.GetAttribute(FunctionAttributeKey.SetTemp).min, |
| | | MaxValue = function.GetAttribute(FunctionAttributeKey.SetTemp).max, |
| | | //IsClickable = function.trait_on_off.curValue.ToString() == "on", |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread((() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | |
| | | bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | | if (updateTemp.trait_on_off.state.ToString() == "on") |
| | | { |
| | | bodyView.arcBar.IsOffline = false; |
| | | bodyView.btnSwitch.IsSelected = true; |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (function.trait_on_off.state.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (function.trait_on_off.state.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | btnSwitch.IsSelected = true; |
| | |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | } |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "off", |
| | | IsSelected = function.trait_on_off.state.ToString() == "off", |
| | | }; |
| | | controlView.AddChidren(btnCurtainClose); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "stop", |
| | | IsSelected = function.trait_on_off.state.ToString() == "stop", |
| | | }; |
| | | controlView.AddChidren(btnCurtainStop); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on", |
| | | IsSelected = function.trait_on_off.state.ToString() == "on", |
| | | }; |
| | | controlView.AddChidren(btnCurtainOpen); |
| | | |
| | |
| | | /// </summary> |
| | | public static void UpdataState(Function updataTemp) |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | Application.RunOnMainThread((Action)(() => { |
| | | if(bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) |
| | | { |
| | | if (updataTemp.trait_on_off.curValue.ToString() == "stop") |
| | | if (updataTemp.trait_on_off.state.ToString() == "stop") |
| | | { |
| | | //bodyView.btnCurtainOpen.IsSelected = false; |
| | | //bodyView.btnCurtainClose.IsSelected = false; |
| | | //bodyView.btnCurtainStop.IsSelected = true; |
| | | } |
| | | else if (updataTemp.trait_on_off.curValue.ToString() == "on") |
| | | else if (updataTemp.trait_on_off.state.ToString() == "on") |
| | | { |
| | | //bodyView.btnCurtainOpen.IsSelected = true; |
| | | //bodyView.btnCurtainClose.IsSelected = false; |
| | | //bodyView.btnCurtainStop.IsSelected = false; |
| | | bodyView.btnCurtainBgIcon.IsSelected = true; |
| | | } |
| | | else if (updataTemp.trait_on_off.curValue.ToString() == "off") |
| | | else if (updataTemp.trait_on_off.state.ToString() == "off") |
| | | { |
| | | //bodyView.btnCurtainOpen.IsSelected = false; |
| | | //bodyView.btnCurtainClose.IsSelected = true; |
| | |
| | | bodyView.btnCurtainBgIcon.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | void LoadEventList() |
| | |
| | | }); |
| | | }) { IsBackground = true }.Start(); |
| | | btnCurtainBgIcon.IsSelected = false; |
| | | function.trait_on_off.curValue = "off"; |
| | | function.trait_on_off.state = "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | |
| | |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "stop"; |
| | | function.trait_on_off.state = "stop"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | btnCurtainOpen.MouseUpEventHandler = (sender, e) => |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | btnCurtainBgIcon.IsSelected = true; |
| | | function.trait_on_off.curValue = "on"; |
| | | function.trait_on_off.state = "on"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | |
| | |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "off"; |
| | | function.trait_on_off.state = "off"; |
| | | function.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | CurtainAnimation(0); |
| | | }; |
| | |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "stop"; |
| | | function.trait_on_off.state = "stop"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | |
| | |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "on"; |
| | | function.trait_on_off.state = "on"; |
| | | function.SetAttrState(FunctionAttributeKey.Percent, 100); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | CurtainAnimation(100); |
| | | }; |
| | |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "off"; |
| | | function.trait_on_off.state = "off"; |
| | | function.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | CurtainAnimation(0); |
| | | }; |
| | |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "stop"; |
| | | function.trait_on_off.state = "stop"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | onCurtainAnimation = false; |
| | | }; |
| | |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "on"; |
| | | function.trait_on_off.state = "on"; |
| | | function.SetAttrState(FunctionAttributeKey.Percent, 100); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | CurtainAnimation(100); |
| | | }; |
| | |
| | | Y = Application.GetRealHeight(100), |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on", |
| | | IsSelected = function.trait_on_off.state.ToString() == "on", |
| | | SelectedImagePath = "FunctionIcon/Electrical/FanIconBg.png", |
| | | UnSelectedImagePath = "FunctionIcon/Electrical/FanIconBgGray.png", |
| | | }; |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | /// </summary> |
| | | public static void UpdataState(Function updateTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | | if (bodyView == null) |
| | | return; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updateTemp.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.barGradualChange.ProgressBarColor = updateTemp.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updateTemp.trait_on_off.state.ToString() == "on"; |
| | | bodyView.barGradualChange.ProgressBarColor = updateTemp.trait_on_off.state.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; |
| | | bodyView.barGradualChange.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.OpenLevel)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"RelayPage error {ex.Message}"); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | /// <summary> |
| | | /// 加载事件列表 |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | function.SetAttrState(FunctionAttributeKey.OpenLevel, e.ToString()); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | Y = Application.GetRealHeight(100), |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on", |
| | | IsSelected = function.trait_on_off.state.ToString() == "on", |
| | | UnSelectedImagePath = "FunctionIcon/Socket/SocketIconBg.png", |
| | | SelectedImagePath = "FunctionIcon/Socket/SocketIconOnBg.png", |
| | | }; |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | /// </summary> |
| | | public static void UpdataState(Function uFan) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | | if (bodyView == null) |
| | | return; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"RelayPage error {ex.Message}"); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | /// <summary> |
| | | /// 加载事件列表 |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | name = sensor.name, |
| | | sid = sensor.sid, |
| | | deviceId = sensor.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue } }, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state } }, |
| | | }; |
| | | switch (seTemp.key) |
| | | { |
| | |
| | | |
| | | public static void LoadEvent_UpdataStatus(Function updateTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | name = updateTemp.name, |
| | | sid = updateTemp.sid, |
| | | deviceId = updateTemp.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state ,curValue = seTemp.curValue} }, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state} }, |
| | | }; |
| | | switch (seTemp.key) |
| | | { |
| | |
| | | { |
| | | MainPage.Log($"更新环境传感器界面异常:{ex.Message}"); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | void LoadEvent_ChangeWeatherIcon(FrameLayout view) |
| | |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | OpenAngle = 160, |
| | | ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", |
| | | ThumbImagePath = function.trait_on_off.state.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", |
| | | ThumbImageHeight = Application.GetRealWidth(50), |
| | | ProgressBarColor = CSS_Color.AuxiliaryColor1, // 0xFFFC9C04, |
| | | OfflineProgressBarColor = CSS_Color.PromptingColor2, |
| | | IsOffline = function.trait_on_off.curValue.ToString() == "off", |
| | | IsOffline = function.trait_on_off.state.ToString() == "off", |
| | | MinValue = minValue,//function.GetAttribute(FunctionAttributeKey.SetTemp).min, |
| | | MaxValue = maxValue,// function.GetAttribute(FunctionAttributeKey.SetTemp).max, |
| | | ArcColor = CSS_Color.BackgroundColor, |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | |
| | | // bodyView.arcBar.IsOffline = true; |
| | | //} |
| | | |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | | if (updateTemp.trait_on_off.state.ToString() == "on") |
| | | { |
| | | bodyView.arcBar.IsOffline = false; |
| | | bodyView.btnSwitch.IsSelected = true; |
| | |
| | | } |
| | | |
| | | |
| | | }); |
| | | })); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if(function.trait_on_off.curValue.ToString() == "off") |
| | | if(function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | //arcBar.ProgressBarColor = CSS_Color.MainColor; |
| | | arcBar.ThumbImagePath = "FunctionIcon/FloorHeating/DiyThumbIconOn.png"; |
| | |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | |
| | | }; |
| | |
| | | IsProgressTextShow = false,
|
| | | };
|
| | | controlView.AddChidren(dimmerBar);
|
| | | if (function.trait_on_off.curValue.ToString() == "on")
|
| | | if (function.trait_on_off.state.ToString() == "on")
|
| | | {
|
| | | dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
|
| | | }
|
| | |
| | | Height = Application.GetRealWidth(32),
|
| | | UnSelectedImagePath = "Public/PowerClose.png",
|
| | | SelectedImagePath = "Public/PowerOpen.png",
|
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on",
|
| | | IsSelected = function.trait_on_off.state.ToString() == "on",
|
| | | };
|
| | | controlView.AddChidren(btnSwitch);
|
| | |
|
| | |
| | | /// </summary>
|
| | | public static void UpdataStatus(Function updataTemp)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | Application.RunOnMainThread((Action)(() =>
|
| | | {
|
| | | try
|
| | | {
|
| | |
| | | return;
|
| | | if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
|
| | | {
|
| | | if (updataTemp.trait_on_off.curValue.ToString() == "on")
|
| | | if (updataTemp.trait_on_off.state.ToString() == "on")
|
| | | {
|
| | | bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
|
| | | if (!bodyView.onDimmerBar)
|
| | |
| | | {
|
| | | bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
|
| | | }
|
| | | bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
|
| | | bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on";
|
| | | bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.state.ToString() == "on";
|
| | | bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.state.ToString() == "on";
|
| | | var cct = 27;
|
| | | int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct);
|
| | | bodyView.barColorTemplatrue.Progress = cct / 100; |
| | |
| | | {
|
| | | MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}");
|
| | | }
|
| | | });
|
| | | }));
|
| | | }
|
| | |
|
| | | void LoadEventList()
|
| | |
| | | }
|
| | | new System.Threading.Thread(() =>
|
| | | {
|
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
|
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off";
|
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
|
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
|
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString());
|
| | | d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); |
| | | if (btnSwitch.IsSelected)
|
| | | {
|
| | |
| | | IsProgressTextShow = false, |
| | | }; |
| | | controlView.AddChidren(dimmerBar); |
| | | if(function.trait_on_off.curValue.ToString() == "on") |
| | | if(function.trait_on_off.state.ToString() == "on") |
| | | { |
| | | dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); |
| | | } |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on", |
| | | IsSelected = function.trait_on_off.state.ToString() == "on", |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | /// </summary> |
| | | public static void UpdataStates(Function updataTemp) |
| | | { |
| | | Application.RunOnMainThread((() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%"; |
| | | bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32( updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); |
| | | if (updataTemp.trait_on_off.curValue.ToString() == "on") |
| | | if (updataTemp.trait_on_off.state.ToString() == "on") |
| | | { |
| | | bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); |
| | | if (!bodyView.onDimmerBar) |
| | |
| | | { |
| | | bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); |
| | | } |
| | | bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); |
| | | if (btnSwitch.IsSelected) |
| | | { |
| | |
| | | ColorImagePath = "FunctionIcon/Light/ColorWheel.png", |
| | | }; |
| | | framePickerBack.AddChidren(colorPicker); |
| | | if(function.trait_on_off.curValue.ToString() == "off") |
| | | if(function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; |
| | | } |
| | |
| | | ThumbImageHeight = Application.GetRealHeight(54), |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor, |
| | | ProgressBarColor = function.trait_on_off.state.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor, |
| | | MaxValue = 100, |
| | | Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | /// </summary> |
| | | public static void UpdataStates(Function updateTemp) |
| | | { |
| | | Application.RunOnMainThread((() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid) |
| | | { |
| | | |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | | if (updateTemp.trait_on_off.state.ToString() == "on") |
| | | { |
| | | //解决部分安卓手机,刷新图片时会变小问题 |
| | | if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheel.png") |
| | |
| | | } |
| | | } |
| | | //状态一样时,不再刷新视图 |
| | | else if (updateTemp.trait_on_off.curValue.ToString() == "off" && bodyView.btnSwitch.IsSelected == true) |
| | | else if (updateTemp.trait_on_off.state.ToString() == "off" && bodyView.btnSwitch.IsSelected == true) |
| | | { |
| | | //解决部分安卓手机,刷新图片时会变小问题 |
| | | if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheelGray.png") |
| | |
| | | int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); |
| | | |
| | | colorPicker.ColorChaged += (sender2, e2) => { |
| | | if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) |
| | | if (function.trait_on_off.state.ToString() == "off" || pointIsRight == false) |
| | | { |
| | | //pointIsRight:点的区域不是圆盘内 |
| | | return; |
| | |
| | | }; |
| | | colorPicker.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | var colorChangeEvent = new System.Threading.Thread(() => { |
| | | while (this.Parent != null) |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) |
| | | if (function.trait_on_off.state.ToString() == "off" || pointIsRight == false) |
| | | { |
| | | //pointIsRight:点的区域不是圆盘内 |
| | | continue; |
| | |
| | | bodyView.colorPicker.ColorImagePath = btnSwitch.IsSelected ? "FunctionIcon/Light/ColorWheel.png" : "FunctionIcon/Light/ColorWheelGray.png"; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.state.ToString()); |
| | | d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); |
| | | if (btnSwitch.IsSelected) |
| | | { |
| | |
| | | { |
| | | btnRestoredPoint.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if(function.trait_on_off.curValue.ToString() == "off") |
| | | if(function.trait_on_off.state.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | Height = Application.GetRealWidth(288), |
| | | UnSelectedImagePath = "FunctionIcon/Light/RelayBg.png", |
| | | SelectedImagePath = "FunctionIcon/Light/RelayOnBg.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitchIcon); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | IsSelected = function.trait_on_off.state.ToString() == "on" |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | |
| | | /// </summary> |
| | | public static void UpdataState(Function updataTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | return; |
| | | if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) |
| | | { |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"RelayPage error {ex.Message}"); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | /// <summary> |
| | | /// 加载事件列表 |
| | |
| | | btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitchIcon.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | finally |
| | | { |
| | | #region 更新其他界面音乐状态 |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | a31MusicModel.trait_on_off.curValue = a31MusicModel.A31PlayStatus.status == "play" ? "on" : "off"; |
| | | a31MusicModel.trait_on_off.state = a31MusicModel.A31PlayStatus.status == "play" ? "on" : "off"; |
| | | //Console.WriteLine($"music : {a31MusicModel.sid} : {a31MusicModel.on_off}"); |
| | | HomePage.UpdataFunctionStates(a31MusicModel); |
| | | foreach (var e in A31MusicModel.A31MusicModelList) |
| | | { |
| | | RoomPage.UpdataStates(a31MusicModel); |
| | | } |
| | | }); |
| | | })); |
| | | #endregion |
| | | } |
| | | } |