| | |
| | | using System; |
| | | using System; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | | public class TargetDeviceFunList : FrameLayout |
| | |
| | | this.AddChidren(saveView.FLayoutView()); |
| | | #endregion |
| | | #region 编辑设备状态 |
| | | switch (device.functionType) |
| | | switch (device.spk) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.ColorTemperature: |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | case FunctionType.Relay: |
| | | case SPK.LightSwitch: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | } |
| | | break; |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | case FunctionType.MotorCurtain: |
| | | case FunctionType.RollingShutter: |
| | | case SPK.CurtainSwitch: |
| | | case SPK.CurtainTrietex: |
| | | case SPK.CurtainRoller: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | case FunctionType.AC: |
| | | case SPK.AcStandard: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | temperatureView.btnState.Text = stateStr; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "set_temp"; |
| | | selectedState = device.functionType + "_" + keyVlaue; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | string set_temp_value = stateStr.Replace("℃", ""); |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, set_temp_value); |
| | |
| | | string currText = acModehView.btnState.Text; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "mode"; |
| | | selectedState = device.functionType + "_" + keyVlaue; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | PublicInterface modeView = new PublicInterface(); |
| | | var modeListStr = modeView.GetViewList(keyVlaue); |
| | | modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText |
| | |
| | | string currText = acSpeedView.btnState.Text; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "fan"; |
| | | selectedState = device.functionType + "_" + keyVlaue; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | PublicInterface speedView = new PublicInterface(); |
| | | var speedListStr = speedView.GetViewList(keyVlaue); |
| | | speedView.SingleSelectionShow(this, speedListStr, Language.StringByID(StringId.speedLogic), currText |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | case SPK.FloorHeatStandard: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | temperatureView.btnState.Text = stateStr; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "set_temp"; |
| | | selectedState = device.functionType + "_" + keyVlaue; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | string set_temp_value = stateStr.Replace("℃", ""); |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, set_temp_value); |
| | |
| | | string currText = floorHeatingModehView.btnState.Text; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "mode"; |
| | | selectedState = device.functionType + "_" + keyVlaue; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | PublicInterface modeView = new PublicInterface(); |
| | | var modeListStr = modeView.GetViewList("floorheatingmode"); |
| | | modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText |
| | |
| | | Output outputDevice = new Output(); |
| | | outputDevice.target_type = "1"; |
| | | outputDevice.sid = device.sid; |
| | | switch (device.functionType) |
| | | switch (device.spk) |
| | | { |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.ColorTemperature: |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | { |
| | | //调光做了一个特殊处理; |
| | | if (dicSateteList.Count > 1) |
| | |
| | | } |
| | | break; |
| | | } |
| | | case FunctionType.AC: |
| | | case FunctionType.FloorHeating: |
| | | case SPK.AcStandard: |
| | | case SPK.FloorHeatStandard: |
| | | { |
| | | |
| | | //(空调/地热)做了一个特殊处理; |
| | |
| | | private void SwitchViewMethod(Entity.Function device, Button button, int len) |
| | | { |
| | | #region 界面 |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | | this.AddChidren(frame); |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, len, button.Text, (strValue) => |
| | |
| | | } |
| | | //界面显示选中值 |
| | | button.TextID = id; |
| | | selectedState = device.functionType + "_" + strValue; |
| | | selectedState = device.spk + "_" + strValue; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "on_off"; |
| | | //数据封装 |
| | |
| | | { |
| | | //界面显示选中值 |
| | | button.Text = brightnesValue + "%"; |
| | | selectedState = device.functionType + brightnesValue.ToString(); |
| | | selectedState = device.spk + brightnesValue.ToString(); |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = ""; |
| | | switch (device.functionType) |
| | | switch (device.spk) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.ColorTemperature: |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | { |
| | | keyVlaue = "brightness"; |
| | | } |
| | | break; |
| | | case FunctionType.MotorCurtain: |
| | | case FunctionType.RollingShutter: |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | { |
| | | keyVlaue = "percent"; |
| | | } |
| | |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(KeyValue, dic, dicSateteList); |
| | | AddDictionaryList(KeyValue, dic); |
| | | } |
| | | /// <summary> |
| | | /// 更新数据列表 |
| | | /// </summary> |
| | | /// <param name="keyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="dictionary">选中数据</param> |
| | | /// <param name="dicList">存储数据列表</param> |
| | | /// <param name="dictionary">添加选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary, List<Dictionary<string, string>> dicList) |
| | | private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | for (int i = 0; i < dicSateteList.Count; i++) |
| | | { |
| | | var dic = dicList[i]; |
| | | var dic = dicSateteList[i]; |
| | | if (dic.ContainsValue(keyValue)) |
| | | { |
| | | //判断是否存在 |
| | |
| | | if (indexValue != -1) |
| | | { |
| | | //存在移除 |
| | | dicList.RemoveAt(indexValue); |
| | | dicSateteList.RemoveAt(indexValue); |
| | | //重新添加 |
| | | dicList.Insert(indexValue, dictionary); |
| | | dicSateteList.Insert(indexValue, dictionary); |
| | | } |
| | | else |
| | | { |
| | | //新添加 |
| | | dicList.Add(dictionary); |
| | | dicSateteList.Add(dictionary); |
| | | } |
| | | |
| | | } |