From 0ab9960587ececb5d3e13e7fb062e2f67308f9e7 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 30 十一月 2021 13:33:03 +0800 Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。 --- HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 1188 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 1,109 insertions(+), 79 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 522f09c..223b059 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -20,12 +20,14 @@ ///鍚勭鏉′欢鐨刅iew LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView(); inputView.FLayoutView(viewLayout); + //娣诲姞娌℃湁寤舵椂锛岄殣钘忓欢鏃舵寜閽�; + inputView.btnDelay.Visible = false; ///璁板綍鏉′欢绫诲瀷 inputView.btnClick.Name = inputCondition.condition_type; ///璁板綍鏉′欢绱㈠紩 - inputView.btnClick.Tag = inputCondition.sid; + inputView.btnClick.Tag = inputCondition; ///鏉′欢鐘舵�佹暟缁� - List<Dictionary<string, string>> dicList = inputCondition.condition as List<Dictionary<string, string>>; + List<Dictionary<string, string>> dicList = inputCondition.condition; //鏄剧ず鏉′欢鍚勭绫诲瀷鐘舵�� switch (inputCondition.condition_type) { @@ -50,7 +52,7 @@ { strtext = Language.StringByID(StringId.sunrise); statetext = Language.StringByID(StringId.advanced); - + } break; case "before_sunset": @@ -58,8 +60,9 @@ strtext = Language.StringByID(StringId.sunset); statetext = Language.StringByID(StringId.advanced); - - } break; + + } + break; case "before_noon": { strtext = Language.StringByID(StringId.at); @@ -70,12 +73,14 @@ { strtext = Language.StringByID(StringId.sunrise); statetext = Language.StringByID(StringId.delayLogic); - } break; + } + break; case "after_sunset": { strtext = Language.StringByID(StringId.sunset); statetext = Language.StringByID(StringId.delayLogic); - } break; + } + break; case "after_noon": { strtext = Language.StringByID(StringId.at); @@ -120,9 +125,9 @@ case "3": { //鐢╯id鎵惧埌璁惧锛� - var device = LogicMethod.GetDevice(inputCondition.sid); + var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛� - inputView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.spk); + inputView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk); //鏄剧ず璁惧鍚嶇О inputView.btnText.Text = device.name; //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害 @@ -141,10 +146,13 @@ case SPK.CurtainRoller: case SPK.CurtainTrietex: //绌鸿皟 - case SPK.AcStandard: + case SPK.AcStandard:case SPK.HvacAC: //鍦扮儹 - case SPK.FloorHeatStandard: - {//寮�鍏崇伅 + case SPK.HvacFloorHeat:case SPK.FloorHeatStandard: + //鏂伴 + case SPK.AirFreshStandard: + case SPK.HvacAirFresh: + {//寮�鍏崇伅 foreach (var dic in dicList) { @@ -159,6 +167,261 @@ inputView.btnState.Text = Language.StringByID(StringId.offLogic); } } + } + break; + //浼犳劅鍣� + case SPK.SensorSmoke: + case SPK.SensorGas: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "alarm") + { + inputView.btnState.Text = Language.StringByID(StringId.xieluo); + + } + else + { + inputView.btnState.Text = Language.StringByID(StringId.wuxieluo); + } + } + } + break; + case SPK.SensorWater: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "alarm") + { + inputView.btnState.Text = Language.StringByID(StringId.luoshui); + + } + else + { + inputView.btnState.Text = Language.StringByID(StringId.wuluoshui); + } + } + } + break; + case SPK.SensorDryContact: + case SPK.SensorDryContact2: + { + foreach (var dic in dicList) + { + + string value = dic["value"]; + if (value == "on") + { + inputView.btnState.Text = Language.StringByID(StringId.onLogic); + + } + else + { + inputView.btnState.Text = Language.StringByID(StringId.offLogic); + } + } + } + break; + case SPK.SensorShanLan: + case SPK.SensorDuiShe: + case SPK.SensorPir: + { + foreach (var dic in dicList) + { + + string value = dic["value"]; + if (value == "true") + { + inputView.btnState.Text = Language.StringByID(StringId.youren); + + } + else + { + inputView.btnState.Text = Language.StringByID(StringId.wuren); + } + } + } + break; + case SPK.SensorDoorWindow: + { + foreach (var dic in dicList) + { + + string value = dic["value"]; + if (value == "open") + { + inputView.btnState.Text = Language.StringByID(StringId.kaiqi); + + } + else + { + inputView.btnState.Text = Language.StringByID(StringId.bihe); + } + } + } + break; + case SPK.SensorUtrasonic: + { + string str = ""; + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (dic["key"]) + { + case "status": + case "people_status": + { + if (value == "true") + { + str += Language.StringByID(StringId.youren) + ";"; + } + else + { + str += Language.StringByID(StringId.wuren) + ";"; + } + + + } + break; + case "dismantle": + { + if (value == "true") + { + str += Language.StringByID(StringId.zaixian); + } + else + { + str += Language.StringByID(StringId.buzaixian); + } + } + break; + + } + + } + inputView.btnState.Text = str; + } + break; + case SPK.SenesorMegahealth: + case SPK.SenesorMegahealth2: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "fall") + { + inputView.btnState.Text = Language.StringByID(StringId.diedao); + } + else + { + inputView.btnState.Text = Language.StringByID(StringId.wuren); + } + } + } + break; + case SPK.SensorEnvironment: + case SPK.SensorEnvironment2: + case SPK.SensorEnvironment3: + { + string strtext = ""; + foreach (var dic in dicList) + { + string key = dic["key"]; + string value = dic["value"]; + string comparator = dic["comparator"]; + switch (key) + { + + case "temperature": + { + if (comparator == ">") + { + strtext = ">" + value + "鈩�"; + } + else if (comparator == "<") + { + strtext = "<" + value + "鈩�"; + } + + } + break; + case "humidity": + { + if (comparator == ">") + { + strtext = ">" + value + "%"; + } + else if (comparator == "<") + { + strtext = "<" + value + "%"; + } + + } + break; + case "co2": + { + strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value); + } + break; + case "pm25": + { + strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value); + } + break; + case "tvoc": + { + strtext = Language.StringByID(StringId.tvoc) + new PublicInterface { }.GetString("tvoc", value); + } + break; + } + inputView.btnState.Text = strtext; + } + + + } + break; + case SPK.SensorTemperature: + { + + string str =new InpOrOutLogicMethod { }.GetText(dicList, "temperature"); + inputView.btnState.Text = str; + } + break; + case SPK.SensorHumidity: + { + string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity"); + inputView.btnState.Text = str; + + } + break; + case SPK.SensorCO2: + { + string str = new InpOrOutLogicMethod { }.GetText(dicList, "co2"); + inputView.btnState.Text = str; + + } + break; + case SPK.SensorPm25: + { + string str = new InpOrOutLogicMethod { }.GetText(dicList, "pm25"); + inputView.btnState.Text = str; + + } + break; + case SPK.SensorTVOC: + { + string str = new InpOrOutLogicMethod { }.GetText(dicList, "tvoc"); + inputView.btnState.Text = str; + + } + break; + case SPK.SensorHcho: + { + string str = new InpOrOutLogicMethod { }.GetText(dicList, "hcho"); + inputView.btnState.Text = str; + } break; } @@ -179,11 +442,13 @@ { case "outdoor_temp": { - strvalue = value; - if (comparator==">") { + strvalue = value + "鈩�"; + if (comparator == ">") + { strtext = Language.StringByID(StringId.wendugaoyu); } - else if(comparator == "<"){ + else if (comparator == "<") + { strtext = Language.StringByID(StringId.wendudiyu); } @@ -191,7 +456,7 @@ break; case "outdoor_humity": { - strvalue = value; + strvalue = value + "%"; if (comparator == ">") { strtext = Language.StringByID(StringId.shidugaoyu); @@ -206,13 +471,13 @@ case "pm2.5": { strtext = Language.StringByID(StringId.PM25); - strvalue = new OutdoorEnvironment { }.GetString(value); + strvalue = new PublicInterface { }.GetString("pm25", value); } break; } - + } inputView.btnText.Text = strtext; inputView.btnState.Text = strvalue; @@ -245,11 +510,56 @@ strtext = Language.StringByID(StringId.rain); } break; - + } - inputView.btnText.TextID =StringId.tianqibianhua; + inputView.btnText.TextID = StringId.tianqibianhua; inputView.btnState.Text = strtext; } + } + break; + case "9": + { + inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; + foreach (var dic in dicList) + { + string strtext = ""; + string value = dic["value"]; + switch (value) + { + case "excellent": + { + strtext = Language.StringByID(StringId.kongqiyou); + + } + break; + case "good": + { + + strtext = Language.StringByID(StringId.kongqiliang); + + } + break; + case "poor": + { + strtext = Language.StringByID(StringId.kongqicha); + } + break; + + } + inputView.btnText.TextID = StringId.kongqizhiliang; + inputView.btnState.Text = strtext; + } + } + break; + case "10": + { + //鐢╯id鎵惧埌鍦烘櫙锛� + var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid); + inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; + inputView.btnNextIcon.Visible = false; + inputView.btnClick.Visible = false; + //鏄剧ず鍦烘櫙鍚嶇О + inputView.btnText.Text = scene.name; } break; @@ -258,17 +568,34 @@ inputView.btnClick.MouseUpEventHandler += (sen, e) => { Button button = (Button)sen; + //褰撳墠缂栬緫鐨勬潯浠� + Input ckcliInput = inputView.btnClick.Tag as Input; //鎵惧埌褰撳墠缂栬緫鐨勭储寮� int indexVulae = 0; for (int index = 0; index < Logic.currlogic.input.Count; index++) { Input input = Logic.currlogic.input[index]; - if (input.sid == inputView.btnClick.Tag.ToString()) + if (input.sid == ckcliInput.sid) { - //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛� - //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊� - indexVulae = index; - break; + if (button.Name == "3") + { + //鏈変簺璁惧姣旇緝鐗规畩锛堜緥濡傦細娴锋灄浼犳劅鍣ㄨ繕鏄鍒ゆ柇灞炴�у�硷紝娓╂箍搴﹀睘鎬ц繕瑕佸垽鏂瘮杈冨叧绯伙紝鎵嶈兘纭鏄惁宸茬粡瀛樺湪璇ユ潯浠讹紝鍏朵粬璁惧鏉′欢鐩存帴鐢╯id鍒ゆ柇鍗冲彲锛� + //鍔犱竴绾у垽鏂槸涓哄吋瀹圭壒娈婅澶� + if (new ConditionDeviceFunList { }.IsContainsAll(ckcliInput.condition, input.condition)) + { + //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛� + //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊� + indexVulae = index; + break; + } + } + else + { + //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛� + //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊� + indexVulae = index; + break; + } } } //鏍囪缂栬緫鐘舵�� @@ -281,7 +608,7 @@ Input _input = Logic.currlogic.input[indexVulae]; if (_input.condition_type == "1") { - var dicLists = _input.condition as List<Dictionary<string, string>>; + var dicLists = _input.condition; foreach (var dic in dicLists) { string keyValue = dic["key"]; @@ -331,11 +658,121 @@ case "3": { //鐢╯id鎵惧埌璁惧锛� - var device = LogicMethod.GetDevice(inputCondition.sid); - ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); - MainPage.BasePageView.AddChidren(deviceFunList); - deviceFunList.Show(device, indexVulae, edit); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); + if (device.spk == SPK.SensorEnvironment + || device.spk == SPK.SensorEnvironment2 + || device.spk == SPK.SensorEnvironment3 + ) + { + //杩欎釜璁惧姣旇緝鐗规畩 + ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); + ///褰撳墠鐨勭储寮曞�兼暟鎹璞� + Input inputedit = Logic.currlogic.input[indexVulae]; + ///鐘舵�佸�� + string stateValue = ""; + foreach (var dic in inputedit.condition) + { + string key = dic["key"]; + string comparator = dic["comparator"]; + stateValue = dic["value"]; + switch (key) + { + + case "temperature": + { + int titleInt = 0; + if (comparator == ">") + { + titleInt = StringId.wendugaoyu; + } + else if (comparator == "<") + { + titleInt = StringId.wendudiyu; + } + conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); + } + break; + case "humidity": + { + int titleInt = 0; + if (comparator == ">") + { + titleInt = StringId.shidugaoyu; + } + else if (comparator == "<") + { + titleInt = StringId.shidudiyu; + } + conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); + } + break; + case "co2": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); + } + break; + case "pm25": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); + } + break; + case "tvoc": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); + } + break; + case "hcho": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue); + } + break; + } + } + + } + else if (device.spk == SPK.SensorTemperature) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae); + + } + else if ( device.spk == SPK.SensorHumidity) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae); + + } + else if (device.spk == SPK.SensorCO2) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "co2", indexVulae); + + } + else if (device.spk == SPK.SensorPm25) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "pm25", indexVulae); + + } + else if (device.spk == SPK.SensorTVOC) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "tvoc", indexVulae); + + } + else if (device.spk == SPK.SensorHcho) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "hcho", indexVulae); + + } + else + { + ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); + MainPage.BasePageView.AddChidren(deviceFunList); + deviceFunList.Show(device, indexVulae, edit); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } } break; case "4": @@ -357,12 +794,12 @@ { if (comparator == ">") { - intValue=StringId.wendugaoyu; + intValue = StringId.wendugaoyu; } else if (comparator == "<") { intValue = StringId.wendudiyu; - + } } @@ -410,6 +847,16 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } break; + case "9": + { + + AirQuality airQuality = new AirQuality(); + MainPage.BasePageView.AddChidren(airQuality); + airQuality.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + break; + } }; ///鍒犻櫎鎺т欢 @@ -428,7 +875,7 @@ /// <param name="viewLayout">涓婁笅婊戝姩鎺т欢</param> public static void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout) { - + for (int i = 0; i < Logic.currlogic.output.Count; i++) { Output outputTarget = Logic.currlogic.output[i]; @@ -440,22 +887,22 @@ ///璁板綍鏉′欢绱㈠紩 targetView.btnClick.Tag = outputTarget.sid; ///鏉′欢鐘舵�佹暟缁� - List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>; + List<Dictionary<string, string>> dicList = outputTarget.status; + //鏄剧ず鐘舵�佸�� + string stateStr = ""; //鏄剧ず杈撳嚭鏉′欢鍚勭绫诲瀷鐘舵�� switch (outputTarget.target_type) { case "1": { //鐢╯id鎵惧埌璁惧锛� - var device = LogicMethod.GetDevice(outputTarget.sid); + var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛� - targetView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.spk); + targetView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk); //鏄剧ず璁惧鍚嶇О targetView.btnText.Text = device.name; //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害 targetView.btnText.Width = Application.GetRealWidth(80); - //绗竴涓彉閲忔樉绀虹姸鎬佸�� - string stateStr = ""; //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬� switch (device.spk) { @@ -475,7 +922,6 @@ stateStr = Language.StringByID(StringId.offLogic); } } - targetView.btnState.Text = stateStr; } break; case SPK.LightRGB: @@ -501,7 +947,7 @@ { stateStr = brightness + "%"; } - targetView.btnState.Text = stateStr; + } break; case SPK.CurtainSwitch: @@ -530,20 +976,22 @@ break; } } - targetView.btnState.Text = stateStr; } break; - case SPK.AcStandard: { + case SPK.AcStandard: + case SPK.HvacAC: + { string on_off = GetKeyValue("on_off", dicList); string set_temp = GetKeyValue("set_temp", dicList); string mode = GetKeyValue("mode", dicList); string fan = GetKeyValue("fan", dicList); - if (on_off != "") { + if (on_off != "") + { switch (on_off) { case "on": { - stateStr = Language.StringByID(StringId.onLogic)+","; + stateStr = Language.StringByID(StringId.onLogic) + ","; } break; case "off": @@ -551,7 +999,7 @@ stateStr = Language.StringByID(StringId.offLogic) + ","; } break; - + } } @@ -568,7 +1016,7 @@ { case "cool": { - stateStr += Language.StringByID(StringId.coolLogic)+","; + stateStr += Language.StringByID(StringId.coolLogic) + ","; } break; case "heat": @@ -597,7 +1045,7 @@ { case "high": { - stateStr += Language.StringByID(StringId.HighWindSpeed)+","; + stateStr += Language.StringByID(StringId.HighWindSpeed) + ","; } break; case "medium": @@ -620,16 +1068,17 @@ } if (on_off != "" && on_off == "off") { - targetView.btnState.Text = Language.StringByID(StringId.offLogic); + stateStr = Language.StringByID(StringId.offLogic); } - else { - targetView.btnState.Text = stateStr.TrimEnd(','); + else + { + stateStr = stateStr.TrimEnd(','); } } break; - case SPK.FloorHeatStandard: + case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: { string on_off = GetKeyValue("on_off", dicList); string set_temp = GetKeyValue("set_temp", dicList); @@ -663,7 +1112,7 @@ { case "day": { - stateStr += Language.StringByID(StringId.dayMode)+","; + stateStr += Language.StringByID(StringId.dayMode) + ","; } break; case "night": @@ -689,27 +1138,62 @@ break; } + } + if (on_off != "" && on_off == "off") + { + stateStr = Language.StringByID(StringId.offLogic); + } + else + { + stateStr = stateStr.TrimEnd(','); - switch (mode) + } + } + break; + case SPK.AirFreshStandard: + case SPK.HvacAirFresh: + { + string on_off = GetKeyValue("on_off", dicList); + string fan = GetKeyValue("fan", dicList); + if (on_off != "") + { + switch (on_off) { - case "cool": + case "on": { - stateStr += Language.StringByID(StringId.coolLogic) + ","; + stateStr = Language.StringByID(StringId.onLogic) + ","; } break; - case "heat": + case "off": { - stateStr += Language.StringByID(StringId.heatingLogic) + ","; + stateStr = Language.StringByID(StringId.offLogic) + ","; + } + break; + } + } + if (fan != "") + { + + switch (fan) + { + case "high": + { + stateStr += Language.StringByID(StringId.HighWindSpeed) + ","; + } + break; + case "medium": + { + stateStr += Language.StringByID(StringId.MiddleWindSpeed) + ","; + } + break; + case "low": + { + stateStr += Language.StringByID(StringId.LowWindSpeed) + ","; } break; case "auto": { - stateStr += Language.StringByID(StringId.autoLogic) + ","; - } - break; - case "dry": - { - stateStr += Language.StringByID(StringId.dehumidifyLogic) + ","; + stateStr += Language.StringByID(StringId.Auto) + ","; } break; } @@ -717,11 +1201,11 @@ } if (on_off != "" && on_off == "off") { - targetView.btnState.Text =Language.StringByID(StringId.offLogic); + stateStr = Language.StringByID(StringId.offLogic); } else { - targetView.btnState.Text = stateStr.TrimEnd(','); + stateStr = stateStr.TrimEnd(','); } } @@ -732,30 +1216,60 @@ case "2": { //鐢╯id鎵惧埌鍦烘櫙锛� - var scene = LogicMethod.GetSecne(outputTarget.sid); + var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid); targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; targetView.btnNextIcon.Visible = false; //鏄剧ず鍦烘櫙鍚嶇О - targetView.btnText.Text = scene.name; + stateStr = scene.name; } break; case "3": { - targetView.btnIcon.UnSelectedImagePath = "LogicIcon/delayed.png"; + //鐢╯id鎵惧埌瀹夐槻锛� + var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid); + targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png"; + targetView.btnDelay.Visible = false; + //鏄剧ず瀹夐槻鍚嶇О + targetView.btnText.Text = security.name; + string value = GetKeyValue("security", dicList); + if (value == "enable") + { + stateStr = Language.StringByID(StringId.bufang); + + } + else + { + stateStr = Language.StringByID(StringId.chefang); + } + + } + break; + case "4": + { + targetView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; foreach (var dic in dicList) { string value = dic["value"]; - targetView.btnText.Text = value; + stateStr = value; } } break; + } + + if (outputTarget.target_type == "1" || outputTarget.target_type == "3") + { + targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; + } + else + { + targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; } //鍐嶆缂栬緫鏉′欢鐘舵�佺偣鍑讳簨浠� targetView.btnClick.MouseUpEventHandler += (sen, e) => { Button button = (Button)sen; //鎵惧埌褰撳墠缂栬緫鐨勭储寮� - int indexVulae =0; + int indexVulae = 0; for (int index = 0; index < Logic.currlogic.output.Count; index++) { Output target = Logic.currlogic.output[index]; @@ -774,7 +1288,7 @@ case "1": { //鐢╯id鎵惧埌璁惧锛� - var device = LogicMethod.GetDevice(outputTarget.sid); + var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); TargetDeviceFunList deviceFunList = new TargetDeviceFunList(); MainPage.BasePageView.AddChidren(deviceFunList); deviceFunList.Show(device, indexVulae, edit); @@ -783,7 +1297,12 @@ break; case "3": { - + Security security = new Security(); + security.SecurityMethod(thisView, "", edit, indexVulae); + } + break; + case "4": + { FrameLayout fLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, @@ -796,6 +1315,25 @@ } break; } + }; + //寤舵椂鐐瑰嚮浜嬩欢 + targetView.btnDelay.MouseUpEventHandler += (sen, e) => + { + + InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod(); + inpOrOutLogicMethod.Delayed(thisView, outputTarget, (value) => + { + outputTarget.delay = value.ToString(); + if (outputTarget.target_type == "1") + { + targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; + } + else + { + targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; + } + }); + }; ///鍒犻櫎鎺т欢 targetView.btnDel.MouseUpEventHandler += (sender, e) => @@ -858,7 +1396,11 @@ break; case "brightness": { - + if (button2 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } button2.Text = value + "%"; } break; @@ -896,6 +1438,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: { foreach (var dic in dicList) { @@ -921,11 +1464,21 @@ break; case "set_temp": { + if (button2 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } button2.Text = value + "鈩�"; } break; case "mode": { + if (button3 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } switch (value) { case "cool": @@ -956,6 +1509,11 @@ break; case "fan": { + if (button4 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } switch (value) { case "high": @@ -991,7 +1549,7 @@ } break; - case SPK.FloorHeatStandard: + case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: { foreach (var dic in dicList) @@ -1018,11 +1576,21 @@ break; case "set_temp": { + if (button2 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } button2.Text = value + "鈩�"; } break; case "mode": { + if (button3 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } switch (value) { case "day": @@ -1062,6 +1630,215 @@ } + } + break; + case SPK.AirFreshStandard: + case SPK.HvacAirFresh: + { + + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (dic["key"]) + { + case "on_off": + { + switch (value) + { + case "on": + { + button1.Text = Language.StringByID(StringId.onLogic); + } + break; + case "off": + { + button1.Text = Language.StringByID(StringId.offLogic); + } + break; + } + } + break; + + case "fan": + { + if (button2 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } + switch (value) + { + case "high": + { + button2.Text = Language.StringByID(StringId.HighWindSpeed); + } + break; + case "medium": + { + button2.Text = Language.StringByID(StringId.MiddleWindSpeed); + } + break; + case "low": + { + button2.Text = Language.StringByID(StringId.LowWindSpeed); + } + break; + case "auto": + { + button2.Text = Language.StringByID(StringId.Auto); + } + break; + } + + + } + break; + + } + + } + + } + break; + case SPK.SensorGas: + case SPK.SensorSmoke: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "alarm") + { + button1.Text = Language.StringByID(StringId.xieluo); + } + else + { + button1.Text = Language.StringByID(StringId.wuxieluo); + } + } + } + break; + case SPK.SensorWater: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "alarm") + { + button1.Text = Language.StringByID(StringId.luoshui); + } + else + { + button1.Text = Language.StringByID(StringId.wuluoshui); + } + } + } + break; + case SPK.SensorDryContact: + case SPK.SensorDryContact2: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "on") + { + button1.Text = Language.StringByID(StringId.onLogic); + } + else + { + button1.Text = Language.StringByID(StringId.offLogic); + } + } + } + break; + case SPK.SensorShanLan: + case SPK.SensorDuiShe: + case SPK.SensorPir: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "true") + { + button1.Text = Language.StringByID(StringId.youren); + } + else + { + button1.Text = Language.StringByID(StringId.wuren); + } + } + } + break; + case SPK.SensorDoorWindow: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "open") + { + button1.Text = Language.StringByID(StringId.kaiqi); + } + else + { + button1.Text = Language.StringByID(StringId.bihe); + } + } + } + break; + case SPK.SensorUtrasonic: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (dic["key"]) + { + case "status": + case "people_status": + { + if (value == "true") + { + button1.Text = Language.StringByID(StringId.youren); + } + else + { + button1.Text = Language.StringByID(StringId.wuren); + } + + + } + break; + case "dismantle": + { + if (value == "true") + { + button1.Text = Language.StringByID(StringId.zaixian); + } + else + { + button1.Text = Language.StringByID(StringId.buzaixian); + } + } + break; + + } + + } + } + break; + case SPK.SenesorMegahealth: + case SPK.SenesorMegahealth2: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "fall") + { + button1.Text = Language.StringByID(StringId.diedao); + } + else + { + button1.Text = Language.StringByID(StringId.wuren); + } + } } break; } @@ -1116,8 +1893,15 @@ case "3": { //鐢╯id鎵惧埌璁惧锛� - var device = LogicMethod.GetDevice(inputCondition.sid); + var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); name = device.name + "-"; + } + break; + case "10": + { + //鐢╯id鎵惧埌鍦烘櫙锛� + var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid); + name = scene.name + "-"; } break; @@ -1131,7 +1915,7 @@ case "1": { //鐢╯id鎵惧埌璁惧锛� - var device = LogicMethod.GetDevice(outputTarget.sid); + var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); //鏄剧ず璁惧鍚嶇О name += device.name; string stateStr = ""; @@ -1210,7 +1994,8 @@ } break; case SPK.AcStandard: - case SPK.FloorHeatStandard: + case SPK.HvacAC: + case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: { foreach (var dic in dicList) { @@ -1236,15 +2021,260 @@ case "2": { //鐢╯id鎵惧埌鍦烘櫙锛� - var scene = LogicMethod.GetSecne(outputTarget.sid); + var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid); name += scene.name; } break; + case "3": + { + //鐢╯id鎵惧埌瀹夐槻锛� + var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid); + name += security.name; + + } + break; + } + + if (!MainView.IsGatewayType) + { + name += Language.StringByID(StringId.push); } } catch { } return name; } + /// <summary> + /// 寤舵椂鏃堕棿鏂规硶 + /// </summary> + /// <param name="fLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param> + /// <param name="edit">锛坱rue=缂栬緫锛沠alse=鏂板缓锛�</param> + /// <param name="index">缂栬緫鏉′欢鐨勭储寮�</param> + private void Delayed(FrameLayout thisFLayout, Output output, Action<int> action) + { + FrameLayout fLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + thisFLayout.AddChidren(fLayout); + LogicView.TimeView timePointView = new LogicView.TimeView(); + timePointView.FLayoutView(fLayout); + EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) => + { + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); + }; + //鍙栨秷鐐瑰嚮浜嬩欢 + timePointView.btnCancel.MouseUpEventHandler += RemovefLayout; + + //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩) + timePointView.mUIPickerView.setNPicker(timePointView.GetmStringList(), timePointView.GetsStringList(), null); + //榛樿鍒濆閫変腑鐘舵�� + timePointView.mUIPickerView.setCurrentItems(0, 5, 0); + //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 + int timepoint = 5; + + if (output.delay != "0") + { + int intValue = int.Parse(output.delay); + var m = intValue / 60; + var s = intValue % 60; + + string timeValue = m.ToString() + ":" + s.ToString(); + int mIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GetmIntList()); + int sIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList()); + //鏇存柊鍒濆鐘舵�� + timePointView.mUIPickerView.setCurrentItems(mIndex, sIndex, 0); + timepoint = intValue; + } + + + //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� + timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => + { + string minuet = timePointView.GethStringList0()[index1].Split(' ')[0]; + string second = timePointView.GetmStringList()[index2].Split(' ')[0]; + int minuetIntValue = int.Parse(minuet); + int secondIntValue = int.Parse(second); + timepoint = minuetIntValue * 60 + secondIntValue; + }; + //纭畾鐐瑰嚮浜嬩欢 + timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) => + { + if (timepoint == 0) + { + //鎻愮ず + return; + } + fLayout.RemoveFromParent(); + action(timepoint); + }; + } + /// <summary> + /// 鑾峰彇鏃堕棿鏂囨湰鎻忚堪 + /// </summary> + /// <param name="strTimeValue">鏃堕棿鍊硷紙鍗曚綅s绉掞級</param> + /// <returns></returns> + private string GetTimeText(string strTimeValue) + { + var timeValue = int.Parse(strTimeValue); + string state = ""; + var minutes = timeValue / 60; + var seconds = timeValue % 60; + if (minutes != 0) + { + if (seconds == 0) + { + state = minutes.ToString() + Language.StringByID(StringId.minute); + } + else + { + state = minutes.ToString() + Language.StringByID(StringId.minute) + seconds.ToString() + Language.StringByID(StringId.s); + } + } + else + { + if (seconds != 0) + { + state = seconds.ToString() + Language.StringByID(StringId.s); + } + } + if (!string.IsNullOrEmpty(state)) + { + state = Language.StringByID(StringId.delayLogic) + state; + } + return state; + } + /// <summary> + /// 鑾峰彇鏄剧ず闈㈢啛鏂囨湰 + /// </summary> + /// <param name="dicList">鐘舵�佹暟鎹垪琛�</param> + /// <returns></returns> + private string GetText(List<Dictionary<string, string>> dicList,string key) + { + string strtext = ""; + foreach (var dic in dicList) + { + string value = dic["value"]; + string comparator = dic["comparator"]; + switch (key) + { + + case "temperature": + { + if (comparator == ">") + { + strtext = ">" + value + "鈩�"; + } + else if (comparator == "<") + { + strtext = "<" + value + "鈩�"; + } + + } + break; + case "humidity": + { + if (comparator == ">") + { + strtext = ">" + value + "%"; + } + else if (comparator == "<") + { + strtext = "<" + value + "%"; + } + + } + break; + case "co2": + { + strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value); + } + break; + case "pm25": + { + strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value); + } + break; + case "tvoc": + { + strtext = Language.StringByID(StringId.tvoc) + new PublicInterface { }.GetString("tvoc", value); + } + break; + case "hcho": + { + strtext = Language.StringByID(StringId.Formaldehyde) + new PublicInterface { }.GetString("hcho", value); + } + break; + } + } + return strtext; + } + private void SensorView(FrameLayout thisView, Function device,string key, int indexVulae) { + //杩欎釜璁惧姣旇緝鐗规畩 + ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); + ///褰撳墠鐨勭储寮曞�兼暟鎹璞� + Input inputedit = Logic.currlogic.input[indexVulae]; + ///鐘舵�佸�� + string stateValue = ""; + foreach (var dic in inputedit.condition) + { + string comparator = dic["comparator"]; + stateValue = dic["value"]; + switch (key) + { + + case "temperature": + { + int titleInt = 0; + if (comparator == ">") + { + titleInt = StringId.wendugaoyu; + } + else if (comparator == "<") + { + titleInt = StringId.wendudiyu; + } + conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); + } + break; + case "humidity": + { + int titleInt = 0; + if (comparator == ">") + { + titleInt = StringId.shidugaoyu; + } + else if (comparator == "<") + { + titleInt = StringId.shidudiyu; + } + conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); + } + break; + case "co2": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); + } + break; + case "pm25": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); + } + break; + case "tvoc": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); + } + break; + case "hcho": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue); + } + break; + } + } + } } } + -- Gitblit v1.8.0