From b2f2494386c4629cf0e0f0a3740e7672919d53a2 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 06 一月 2021 17:09:55 +0800 Subject: [PATCH] 修改了彩灯的百分比计算 --- ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs | 240 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 185 insertions(+), 55 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs index 91c65a7..ca0c158 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs @@ -339,56 +339,166 @@ break; case DeviceType.TemperatureSensor: { - // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; - var dev = deviceinof as TemperatureSensor; - if (conditions["Cluster_ID"] == "1026") + //鑾峰彇璁惧绫诲瀷 + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { deviceinof }); + if (deviceEnumInfo==null) { + continue; + } + //绌烘皵璐ㄩ噺浼犳劅鍣� + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) { - dev.SensorDiv = 1; + icon = "ZigeeLogic/airquality.png"; + string s = ""; + switch (conditions["Range"]) + { + case "0": + { + s = ">"; + } + break; + case "1": + { + s = "="; + } + break; + case "2": + { + s = "<"; + } + break; + case "6": + { + s = "鈮�"; + } + break; + case "7": + { + s = "鈮�"; + } + break; + } + switch (conditions["Cluster_ID"]) { + case "1066": { + if (conditions["AttriButeId"] =="57344") { + if (conditions["AttriButeData1"] == "1") + { + state = Language.StringByID(MyInternationalizationString.you); + } + else if (conditions["AttriButeData1"] == "2") + { + state = Language.StringByID(MyInternationalizationString.liang); + } + else { + state = Language.StringByID(MyInternationalizationString.cha); + } + state = Language.StringByID(MyInternationalizationString.kongqizhiliang) + state; + } else { + ///Pm2.5 + int intValue = int.Parse(conditions["AttriButeData1"]); + if (0< intValue&& intValue<30) { + state = Language.StringByID(MyInternationalizationString.pmyou); + } + else if (36 < intValue && intValue < 75) { + state = Language.StringByID(MyInternationalizationString.pmliang); + } + else if (76 < intValue && intValue < 115) { + state = Language.StringByID(MyInternationalizationString.pmqingdu); + } + else if (intValue >115) { + state = Language.StringByID(MyInternationalizationString.pmzhongdu); + } + state = Language.StringByID(MyInternationalizationString.pm25) + state; + } + }break; + case "1037": + { + ///co2 + int intValue = int.Parse(conditions["AttriButeData1"]); + if (0 < intValue && intValue < 1000) + { + state = Language.StringByID(MyInternationalizationString.co2qingxin); + } + else if (1000 < intValue && intValue < 2000) + { + state = Language.StringByID(MyInternationalizationString.co2huizhuo); + } + else if (2000 < intValue && intValue < 5000) + { + state = Language.StringByID(MyInternationalizationString.co2queyang); + } + else if (intValue > 5000) + { + state = Language.StringByID(MyInternationalizationString.co2yanzhongqueyang); + } + state = Language.StringByID(MyInternationalizationString.co2) + state; + } + break; + case "1026": { + ///杞崲娓╁害鍊�/100 + string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); + state = s + srtValue + "鈩�"; + } break; + case "1029": { + ///杞崲娓╁害鍊�/100 + string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); + state = s + srtValue + "%"; + } break; + } + } else { - dev.SensorDiv = 2; - } - string s = ""; - switch (conditions["Range"]) - { - case "0": - { - s = ">"; - } - break; - case "1": - { - s = "="; - } - break; - case "2": - { - s = "<"; - } - break; - case "6": - { - s = "鈮�"; - } - break; - case "7": - { - s = "鈮�"; - } - break; - } - ///杞崲娓╁害鍊�/100 - string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); - if (conditions["Cluster_ID"] == "1026") - { - icon = "ZigeeLogic/temperature.png"; - state = s + srtValue + "鈩�"; - } - else - { - icon = "ZigeeLogic/humidity.png"; - state = s + srtValue + "%"; + + var dev = deviceinof as TemperatureSensor; + if (conditions["Cluster_ID"] == "1026") + { + dev.SensorDiv = 1; + } + else + { + dev.SensorDiv = 2; + } + string s = ""; + switch (conditions["Range"]) + { + case "0": + { + s = ">"; + } + break; + case "1": + { + s = "="; + } + break; + case "2": + { + s = "<"; + } + break; + case "6": + { + s = "鈮�"; + } + break; + case "7": + { + s = "鈮�"; + } + break; + } + ///杞崲娓╁害鍊�/100 + string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); + if (conditions["Cluster_ID"] == "1026") + { + icon = "ZigeeLogic/temperature.png"; + state = s + srtValue + "鈩�"; + } + else + { + icon = "ZigeeLogic/humidity.png"; + state = s + srtValue + "%"; + } } break; @@ -468,9 +578,17 @@ selecteddevice.selecetddevicestateBtn.Text = state; } ///缂栬緫 - selecteddevice.edit.Tag = i.ToString(); + selecteddevice.edit.Tag = conditions; selecteddevice.edit.MouseUpEventHandler += (sender, e) => { + var dic = selecteddevice.edit.Tag as Dictionary<string, string>; + int isInt = 0; + if (dic != null) + { + //涔嬪墠鏍囪绱㈠紩鍊硷紝涓�鏃﹀垹闄ゆ暟鎹储寮曞�间細鍙戠敓鏀瑰彉锛� + //鎵惧埌鏁版嵁鍦ㄥ垪琛ㄩ噷鏈�鏂扮储寮曪紝骞朵笖鏇存柊绱㈠紩鍊� + isInt = Common.Logic.CurrentLogic.Conditions.IndexOf(dic); + } switch (Type) { @@ -481,7 +599,7 @@ UserView.HomePage.Instance.AddChidren(timePoint); UserView.HomePage.Instance.PageIndex += 1; timePoint.IsEditor = true; - timePoint.Show(conditions); + timePoint.Show(dic); } break; case 5: @@ -501,7 +619,7 @@ { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; frameLayout.AddChidren(flMain); - CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic",int.Parse(selecteddevice.edit.Tag.ToString())); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic", isInt); } else { @@ -509,7 +627,7 @@ UserView.HomePage.Instance.AddChidren(memberList); UserView.HomePage.Instance.PageIndex += 1; MemberList.edit = true; - memberList.Show(deviceinof, conditions); + memberList.Show(deviceinof, dic); } } break; @@ -1026,8 +1144,7 @@ { state = seconds.ToString() + Language.StringByID(MyInternationalizationString.second); } - //璁板綍寤舵椂锛� - actiondevice.edit.Tag = i; + }; break; } @@ -1054,9 +1171,18 @@ actiondevice.selecetddevicestateBtn.Text = state; } ///缂栬緫 - actiondevice.edit.Tag = i.ToString(); + //璁板綍锛� + actiondevice.edit.Tag = actions; actiondevice.edit.MouseUpEventHandler += (sender, e) => { + var dic = actiondevice.edit.Tag as Dictionary<string, object>; + int isInt = 0; + if (dic != null) + { + //涔嬪墠鏍囪绱㈠紩鍊硷紝涓�鏃﹀垹闄ゆ暟鎹储寮曞�间細鍙戠敓鏀瑰彉锛� + //鎵惧埌鏁版嵁鍦ㄥ垪琛ㄩ噷鏈�鏂扮储寮曪紝骞朵笖鏇存柊绱㈠紩鍊� + isInt = Common.Logic.CurrentLogic.Actions.IndexOf(dic); + } switch (linkType) { case 8: @@ -1065,7 +1191,7 @@ var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; frameLayout.AddChidren(flMain); - CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic", int.Parse(actiondevice.edit.Tag.ToString())); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic", isInt); } break; case 6: @@ -1079,10 +1205,11 @@ break; case 7: { + var delayTime = new DelayTime(); UserView.HomePage.Instance.AddChidren(delayTime); UserView.HomePage.Instance.PageIndex += 1; - delayTime.Show(int.Parse(actiondevice.edit.Tag.ToString()), true); + delayTime.Show(isInt, true); } break; @@ -1185,5 +1312,8 @@ } + + + } } -- Gitblit v1.8.0