From cc57e8d53611813232e8f5761aca452a020e031a Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 06 十一月 2023 16:59:03 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into wjc
---
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 1208 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 897 insertions(+), 311 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index d88fe55..c5fbf03 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -7,12 +7,27 @@
{
public class InpOrOutLogicMethod
{
+
+ private static InpOrOutLogicMethod s_Current = null;
+
+ public static InpOrOutLogicMethod Current
+ {
+ get
+ {
+ if (s_Current == null)
+ {
+ s_Current = new InpOrOutLogicMethod();
+
+ }
+ return s_Current;
+ }
+ }
/// <summary>
/// 杈撳叆鏉′欢澶勭悊鏂规硶
/// </summary>
/// <param name="thisView">褰撳墠鐣岄潰</param>
/// <param name="viewLayout">涓婁笅婊戝姩鎺т欢</param>
- public static void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
+ public void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
{
for (int i = 0; i < Logic.currlogic.input.Count; i++)
{
@@ -33,6 +48,7 @@
{
case "1":
{
+
inputView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
foreach (var dic in dicList)
{
@@ -114,20 +130,17 @@
case "2":
{
inputView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
- foreach (var dic in dicList)
- {
- string value = dic["value"];
- inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value;
- }
-
+ string value = this.GetKeyValue("timesection", dicList);
+ inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value;
}
break;
case "3":
+ case "9"://鍙瀵硅:9
{
//鐢╯id鎵惧埌璁惧锛�
- var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
+ var device = LogicMethod.Current.GetDevice(inputCondition.sid);
//鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
- inputView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk);
+ inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
//鏄剧ず璁惧鍚嶇О
inputView.btnText.Text = device.name;
//鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -149,6 +162,7 @@
//绌鸿皟
case SPK.AcStandard:
case SPK.HvacAC:
+ case SPK.AcIr:
//鍦扮儹
case SPK.HvacFloorHeat:
case SPK.FloorHeatStandard:
@@ -159,91 +173,56 @@
case SPK.PanelSocket:
case SPK.ElectricSocket:
{//寮�鍏崇伅
- foreach (var dic in dicList)
+ string value = this.GetKeyValue("on_off", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.offLogic);
+ if (value == "on")
{
-
- string value = dic["value"];
- if (value == "on")
- {
- inputView.btnState.Text = Language.StringByID(StringId.onLogic);
-
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.offLogic);
- }
+ inputView.btnState.Text = Language.StringByID(StringId.onLogic);
}
}
break;
- //浼犳劅鍣�
+ //绱ф�ユ眰鍔╀紶鎰熷櫒
case SPK.SensorHelp:
{
- foreach (var dic in dicList)
+ string value = this.GetKeyValue("alarm_status", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.zhengchang);
+ if (value == "alarm")
{
- string value = dic["value"];
- if (value == "alarm")
- {
- inputView.btnState.Text = Language.StringByID(StringId.qiujiu);
-
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.zhengchang);
- }
+ inputView.btnState.Text = Language.StringByID(StringId.qiujiu);
}
}
break;
case SPK.SensorSmoke:
case SPK.SensorGas:
{
- foreach (var dic in dicList)
+ string value = this.GetKeyValue("alarm_status", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.wuxieluo);
+ if (value == "alarm")
{
- string value = dic["value"];
- if (value == "alarm")
- {
- inputView.btnState.Text = Language.StringByID(StringId.xieluo);
+ 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 = this.GetKeyValue("alarm_status", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.wuluoshui);
+ if (value == "alarm")
{
- string value = dic["value"];
- if (value == "alarm")
- {
- inputView.btnState.Text = Language.StringByID(StringId.luoshui);
-
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.wuluoshui);
- }
+ inputView.btnState.Text = Language.StringByID(StringId.luoshui);
}
}
break;
case SPK.SensorDryContact:
case SPK.SensorDryContact2:
{
- foreach (var dic in dicList)
+
+ string value = this.GetKeyValue("contact_status", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.offLogic);
+ if (value == "open")
{
-
- string value = dic["value"];
- if (value == "on")
- {
- inputView.btnState.Text = Language.StringByID(StringId.onLogic);
-
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.offLogic);
- }
+ inputView.btnState.Text = Language.StringByID(StringId.onLogic);
}
}
break;
@@ -251,131 +230,91 @@
case SPK.SensorDuiShe:
case SPK.SensorPir:
{
- foreach (var dic in dicList)
+ string value = this.GetKeyValue("people_status", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.wuren);
+ if (value == "true")
{
+ inputView.btnState.Text = Language.StringByID(StringId.youren);
- 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 = this.GetKeyValue("contact_status", dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.bihe);
+ if (value == "open")
{
-
- string value = dic["value"];
- if (value == "open")
- {
- inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
-
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.bihe);
- }
+ inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
}
+
}
break;
case SPK.SensorUtrasonic:
{
+ string key = this.GetKey(dicList);
+ string value = this.GetValue(dicList);
string str = "";
- foreach (var dic in dicList)
+ switch (key)
{
- string value = dic["value"];
- switch (dic["key"])
- {
- case "status":
- case "people_status":
+ case "status":
+ case "people_status":
+ {
+ str = Language.StringByID(StringId.wuren);
+ if (value == "true")
{
- if (value == "true")
- {
- str = Language.StringByID(StringId.youren);
- }
- else
- {
- str = Language.StringByID(StringId.wuren);
- }
-
-
+ str = Language.StringByID(StringId.youren);
}
- break;
- case "dismantle":
+ }
+ break;
+ case "dismantle":
+ {
+ str = Language.StringByID(StringId.buzaixian);
+ if (value == "true")
{
- if (value == "true")
- {
- str = Language.StringByID(StringId.zaixian);
- }
- else
- {
- str = Language.StringByID(StringId.buzaixian);
- }
+ str = Language.StringByID(StringId.zaixian);
}
- break;
-
- }
+ }
+ break;
}
inputView.btnState.Text = str;
}
break;
case SPK.SenesorMegahealth:
+ case SPK.SensorMmvPose:
{
- foreach (var dic in dicList)
+ string key = this.GetKey(dicList);
+ string value = this.GetValue(dicList);
+ if (key == "people_status")
{
- string value = dic["value"];
- switch (dic["key"])
+ inputView.btnState.Text = Language.StringByID(StringId.wuren);
+ if (value == "true")
{
- case "people_status":
- {
- if (value == "true")
- {
- inputView.btnState.Text = Language.StringByID(StringId.youren);
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.wuren);
- }
-
- }
- break;
- case "target_status":
- {
- if (value == "4")
- {
- inputView.btnState.Text = Language.StringByID(StringId.shi);
- }
- }
- break;
+ inputView.btnState.Text = Language.StringByID(StringId.youren);
}
-
}
- }break;
- case SPK.SenesorMegahealth2:
- {
- foreach (var dic in dicList)
+ else if (key == "target_status")
{
- string value = dic["value"];
- if (value == "fall")
+ if (value == "4")
{
- inputView.btnState.Text = Language.StringByID(StringId.diedao);
- }
- else
- {
- inputView.btnState.Text = Language.StringByID(StringId.wuren);
+ inputView.btnState.Text = Language.StringByID(StringId.shi);
}
}
}
break;
+ case SPK.SenesorMegahealth2:
+ {
+ string value = this.GetValue(dicList);
+ inputView.btnState.Text = Language.StringByID(StringId.wuren);
+ if (value == "fall")
+ {
+ inputView.btnState.Text = Language.StringByID(StringId.diedao);
+ }
+ }
+ break;
case SPK.SensorEnvironment:
+ case SPK.SensorEnvironmentHailin:
case SPK.SensorEnvironment2:
case SPK.SensorEnvironment3:
{
@@ -439,43 +378,146 @@
case SPK.SensorTemperature:
{
- string str = new InpOrOutLogicMethod { }.GetText(dicList, "temperature");
+ string str = this.GetText(dicList, "temperature");
inputView.btnState.Text = str;
}
break;
case SPK.SensorHumidity:
{
- string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity");
+ string str = this.GetText(dicList, "humidity");
inputView.btnState.Text = str;
}
break;
+ case SPK.SensorPm10:
case SPK.SensorCO2:
case SPK.SensorPm25:
case SPK.SensorTVOC:
case SPK.SensorHcho:
{
- string strvalue = "";
- foreach (var dic in dicList)
- {
- strvalue = dic["value"];
- break;
- }
- string str = new PublicInterface().GetSensorLevelText(device, strvalue, true);
+ string value = this.GetValue(dicList);
+ string str = new PublicInterface().GetSensorLevelText(device, value, true);
inputView.btnState.Text = str;
+ }
+ break;
+ case SPK.SensorLight:
+ {
+ string str = this.GetText(dicList, "illuminance");
+ inputView.btnState.Text = str;
+
}
break;
case SPK.DoorLock:
{
- foreach (var dic in dicList)
+ string value = this.GetValue(dicList);
+ if (value == "open")
{
- string value = dic["value"];
- if (value == "open")
+ inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
+ }
+ }
+ break;
+ case SPK.VideoDoorLock:
+ {
+ string userName = string.Empty;
+ string tag = string.Empty;
+ for (int b = 0; b < dicList.Count; b++)
+ {
+ var dic = dicList[b];
+ //var userId = dic["value"].ToString();
+ //var FaceItem = this.GetVideoDoorLockUserItem(userId, device);
+ //s += FaceItem.userName;
+ //s += ",";
+ //tag += FaceItem.userId;
+ //tag += "_";
+ userName = dic["value"].ToString();
+ }
+ inputView.btnState.Text = RemoveLastStr(userName);
+ }
+ break;
+ case SPK.doorgate:
+ {
+ string s = string.Empty;
+ if (inputCondition.identifier == "door_call_cloud_event")
+ {
+ s = Language.StringByID(StringId.shipintonghuahujiao);
+ }
+ else
+ {
+ for (int b = 0; b < dicList.Count; b++)
{
- inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
+ var dic = dicList[b];
+ var key = dic["key"].ToString();
+ if (key != "user_id")
+ {
+ continue;
+ }
+ var userId = dic["value"].ToString();
+ var FaceItem = this.GetFaceItem(userId, device.deviceId);
+ s += FaceItem.userName;
+ s += ",";
+
+
}
}
+ inputView.btnState.Text = s;
+ }
+ break;
+ case SPK.IpCam_Imou:
+ {
+ if (inputCondition.identifier == "ipcam_region_alram_event")
+ {
+ inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing);
+ }
+
+ }
+ break;
+ case SPK.Ev_Ipcam:
+ if (inputCondition.identifier == Constant.intelligentDetection_event)
+ {
+ inputView.btnState.Text = Language.StringByID(StringId.shi);
+ }
+ break;
+ case SPK.Peephole:
+ if (inputCondition.identifier == "pir_event")
+ {
+ inputView.btnState.Text = Language.StringByID(StringId.shi);
+ }
+ break;
+ case SPK.SensorPirHold:
+ {
+ string value = this.GetKeyValue("people_status", dicList);
+ if (string.IsNullOrEmpty(value))
+ {
+ inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", "");
+ break;
+
+ }
+
+ inputView.btnState.Text = Language.StringByID(StringId.wuren);
+ if (value == "true")
+ {
+ inputView.btnState.Text = Language.StringByID(StringId.youren);
+
+ }
+ if (!string.IsNullOrEmpty(inputCondition.hold_time) && int.Parse(inputCondition.hold_time) > 0)
+ {
+ int time = int.Parse(inputCondition.hold_time);
+ inputView.btnState.Text += "鎸佺画" + LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", "");
+ }
+ if (!string.IsNullOrEmpty(inputCondition.detect_type))
+ {
+ if (inputCondition.detect_type == "1")
+ {
+ inputView.btnState.Text += "," + Language.StringByID(StringId.gaibiancaizhixing);
+ }
+ else
+ {
+ inputView.btnState.Text += "," + Language.StringByID(StringId.shoudaojiuzhixing);
+ }
+ }
+
+
}
break;
}
@@ -598,32 +640,24 @@
case "8":
{
inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
- foreach (var dic in dicList)
+ string value = this.GetValue(dicList);
+ if (value == "arrive")
{
- string strtext = "";
- string value = dic["value"];
- switch (value)
- {
- case "arrive":
- {
- strtext = Language.StringByID(StringId.daoda);
- }
- break;
- case "leave":
- {
- strtext = Language.StringByID(StringId.likai);
- }
- break;
- }
- inputView.btnText.TextID = StringId.likiadaoda;
- inputView.btnState.Text = strtext;
+ value = Language.StringByID(StringId.daoda);
}
+ else if (value == "leave")
+ {
+ value = Language.StringByID(StringId.likai);
+ }
+
+ inputView.btnText.TextID = StringId.likiadaoda;
+ inputView.btnState.Text = value;
}
break;
case "10":
{
//鐢╯id鎵惧埌鍦烘櫙锛�
- var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+ var scene = LogicMethod.Current.GetSecne(inputCondition.sid);
inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
inputView.btnNextIcon.Visible = false;
inputView.btnClick.Visible = false;
@@ -638,19 +672,19 @@
{
Button button = (Button)sen;
//褰撳墠缂栬緫鐨勬潯浠�
- Input ckcliInput = inputView.btnClick.Tag as Input;
+ Input clickInput = 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 == ckcliInput.sid)
+ if (input.sid == clickInput.sid)
{
- if (button.Name == "3")
+ if (button.Name == "3" || button.Name == "9")
{
//鏈変簺璁惧姣旇緝鐗规畩锛堜緥濡傦細娴锋灄浼犳劅鍣ㄨ繕鏄鍒ゆ柇灞炴�у�硷紝娓╂箍搴﹀睘鎬ц繕瑕佸垽鏂瘮杈冨叧绯伙紝鎵嶈兘纭鏄惁宸茬粡瀛樺湪璇ユ潯浠讹紝鍏朵粬璁惧鏉′欢鐩存帴鐢╯id鍒ゆ柇鍗冲彲锛�
//鍔犱竴绾у垽鏂槸涓哄吋瀹圭壒娈婅澶�
- if (new ConditionDeviceFunList { }.IsContainsAll(ckcliInput.condition, input.condition))
+ if (new ConditionDeviceFunList { }.IsContainsAll(clickInput.condition, input.condition))
{
//鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛�
//閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊�
@@ -724,17 +758,17 @@
timeTpye.TimeHorizon(fLayout, edit, indexVulae);
}
break;
+ case "9":
case "3":
{
//鐢╯id鎵惧埌璁惧锛�
- var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
- if (device.spk == SPK.SensorEnvironment
+ var device = LogicMethod.Current.GetDevice(inputCondition.sid);
+ if (device.spk == SPK.SensorEnvironment || device.spk == SPK.SensorEnvironmentHailin
|| device.spk == SPK.SensorEnvironment2
|| device.spk == SPK.SensorEnvironment3
+ || device.spk == SPK.SensorLight
)
{
- //杩欎釜璁惧姣旇緝鐗规畩
- ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList();
///褰撳墠鐨勭储寮曞�兼暟鎹璞�
Input inputedit = Logic.currlogic.input[indexVulae];
///鐘舵�佸��
@@ -747,6 +781,20 @@
switch (key)
{
+ case "illuminance":
+ {
+ int titleInt = 0;
+ if (comparator == ">")
+ {
+ titleInt = StringId.zhaomingdugaoyu;
+ }
+ else if (comparator == "<")
+ {
+ titleInt = StringId.zhaomingdudiyu;
+ }
+ ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+ }
+ break;
case "temperature":
{
int titleInt = 0;
@@ -758,7 +806,7 @@
{
titleInt = StringId.wendudiyu;
}
- conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
}
break;
case "humidity":
@@ -772,27 +820,27 @@
{
titleInt = StringId.shidudiyu;
}
- conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
}
break;
case "co2":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
}
break;
case "pm25":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
}
break;
case "tvoc":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
}
break;
case "hcho":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
}
break;
}
@@ -802,37 +850,43 @@
else if (device.spk == SPK.SensorTemperature)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae);
+ this.SensorView(thisView, device, "temperature", indexVulae);
}
else if (device.spk == SPK.SensorHumidity)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae);
+ this.SensorView(thisView, device, "humidity", indexVulae);
}
else if (device.spk == SPK.SensorCO2)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "co2", indexVulae);
+ this.SensorView(thisView, device, "co2", indexVulae);
+
+ }
+ else if (device.spk == SPK.SensorPm10)
+ {
+
+ this.SensorView(thisView, device, "pm10", indexVulae);
}
else if (device.spk == SPK.SensorPm25)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "pm25", indexVulae);
+ this.SensorView(thisView, device, "pm25", indexVulae);
}
else if (device.spk == SPK.SensorTVOC)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "tvoc", indexVulae);
+ this.SensorView(thisView, device, "tvoc", indexVulae);
}
else if (device.spk == SPK.SensorHcho)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "hcho", indexVulae);
+ this.SensorView(thisView, device, "hcho", indexVulae);
}
else
@@ -957,7 +1011,7 @@
/// </summary>
/// <param name="thisView">褰撳墠鐣岄潰</param>
/// <param name="viewLayout">涓婁笅婊戝姩鎺т欢</param>
- public static void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
+ public void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
{
for (int i = 0; i < Logic.currlogic.output.Count; i++)
@@ -978,11 +1032,12 @@
switch (outputTarget.target_type)
{
case "1":
+ case "5":
{
//鐢╯id鎵惧埌璁惧锛�
- var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
+ var device = LogicMethod.Current.GetDevice(outputTarget.sid);
//鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
- targetView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk);
+ targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
//鏄剧ず璁惧鍚嶇О
targetView.btnText.Text = device.name;
//鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -991,11 +1046,33 @@
//鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
switch (device.spk)
{
+
+ case SPK.CommonSeries:
+ targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
+ stateStr = GetKeyValue("on_off", dicList) == "on" ? Language.StringByID(StringId.onLogic) : Language.StringByID(StringId.offLogic);
+ break;
+ //鎻掑骇(鏈塙SB)
+ case SPK.PanelSocket:
+ {
+ //string on_off = GetKeyValue("on_off_master", dicList);
+ string on_off = GetKeyValue("on_off", dicList);
+ if (on_off == "on")
+ {
+ stateStr = Language.StringByID(StringId.onLogic);
+ }
+ else
+ {
+ stateStr = stateStr = Language.StringByID(StringId.offLogic);
+ }
+ }
+ break;
+ case SPK.OtherCommon:
case SPK.AirSwitch:
case SPK.LightSwitch:
//鎻掑骇
- case SPK.PanelSocket:
case SPK.ElectricSocket:
+ //鏈烘鎵�
+ case SPK.MechanicalArm:
{//寮�鍏�
foreach (var dic in dicList)
@@ -1013,11 +1090,14 @@
}
}
break;
+
+
case SPK.LightRGB:
case SPK.LightRGBW:
case SPK.LightCCT:
case SPK.LightDimming:
{
+
string on_off = GetKeyValue("on_off", dicList);
string brightness = GetKeyValue("brightness", dicList);
if (on_off == "on" && brightness != "")
@@ -1036,9 +1116,91 @@
{
stateStr = brightness + "%";
}
+ if (device.spk == SPK.LightCCT)
+ {
+ //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥
+ if (stateStr != Language.StringByID(StringId.offLogic) && GetKeyValue("cct", dicList) != "")
+ {
+ stateStr += "," + GetKeyValue("cct", dicList) + "k";
+ }
+ }
+ if (device.spk == SPK.LightRGB)
+ {
+ string rgb = GetKeyValue("rgb", dicList);
+ if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+ {
+ targetView.btnStateColor.Visible = true;
+ targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+ }
+ }
+ if (device.spk == SPK.LightRGBW)
+ {
+ string rgb = GetKeyValue("rgbw", dicList);
+ if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+ {
+ targetView.btnStateColor.Visible = true;
+ targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+ }
+ }
}
break;
+ case SPK.GroupControl: //缇ゆ帶
+ {
+ targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
+ string on_off = GetKeyValue("on_off", dicList);
+ string brightness = GetKeyValue("brightness", dicList);
+ string cct = GetKeyValue(FunctionAttributeKey.CCT, dicList);
+ //鑷姩鍖栫粍鎺� 鐐僵鍔熻兘
+ //string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList);
+ string rgb = GetKeyValue("rgb", dicList);
+
+
+ if (on_off == "on" && brightness != "")
+ {
+ stateStr = Language.StringByID(StringId.onLogic) + brightness + "%";
+ }
+ else if (on_off == "on")
+ {
+ stateStr = Language.StringByID(StringId.onLogic);
+ }
+ else if (on_off == "off")
+ {
+ stateStr = Language.StringByID(StringId.offLogic);
+ }
+ else if (brightness != "")
+ {
+ stateStr = brightness + "%";
+ }
+ //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥
+ if (!string.IsNullOrEmpty(cct))
+ {
+ stateStr += "," + Language.StringByID(StringId.ColorTemperature) + cct + "k";
+ }
+
+ //if (!string.IsNullOrEmpty(colorful))
+ //{
+ // stateStr += "," + Language.StringByID(StringId.ColorfulFunction);
+ // if (colorful == "on")
+ // {
+ // stateStr += Language.StringByID(StringId.onLogic);
+ // }
+ // else if (colorful == "off")
+ // {
+ // stateStr += Language.StringByID(StringId.offLogic);
+ // }
+ //}
+
+ if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+ {
+ targetView.btnStateColor.Visible = true;
+ targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+ }
+
+
+ }
+ break;
+
case SPK.CurtainSwitch:
{
foreach (var dic in dicList)
@@ -1069,7 +1231,7 @@
case SPK.CurtainRoller:
{
string on_off = GetKeyValue("on_off", dicList);
- string percent = GetKeyValue("percent", dicList);
+ string percent = GetKeyValue("percent", dicList);
if (on_off == "on" && percent != "")
{
stateStr = Language.StringByID(StringId.onLogic) + percent + "%";
@@ -1095,7 +1257,7 @@
if (percent != "" && angle != "")
{
stateStr += Language.StringByID(StringId.onLogic) + percent + "%;";
- stateStr +=Language.StringByID(StringId.Angle)+angle + "掳";
+ stateStr += Language.StringByID(StringId.Angle) + angle + "掳";
}
else if (percent != "")
{
@@ -1109,6 +1271,7 @@
break;
case SPK.AcStandard:
case SPK.HvacAC:
+ case SPK.AcIr:
{
string on_off = GetKeyValue("on_off", dicList);
string set_temp = GetKeyValue("set_temp", dicList);
@@ -1134,8 +1297,8 @@
if (set_temp != "")
{
-
- stateStr += set_temp + "鈩�,";
+ string unit = GetTemperatureUnit(device);
+ stateStr += set_temp + unit + ",";
}
if (mode != "")
@@ -1207,7 +1370,8 @@
}
break;
- case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+ case SPK.FloorHeatStandard:
+ case SPK.HvacFloorHeat:
{
string on_off = GetKeyValue("on_off", dicList);
string set_temp = GetKeyValue("set_temp", dicList);
@@ -1231,8 +1395,8 @@
}
if (set_temp != "")
{
-
- stateStr += set_temp + "鈩�,";
+ string unit = GetTemperatureUnit(device);
+ stateStr += set_temp + unit + ",";
}
if (mode != "")
{
@@ -1339,13 +1503,69 @@
}
}
break;
+ case SPK.MusicStandard:
+ case SPK.AvMusic:
+ {
+ string song_name = GetKeyValue("song_name", dicList);
+ string volume = GetKeyValue("volume", dicList);
+ stateStr = song_name + ";" + Language.StringByID(StringId.volumeMusic) + volume;
+ if (stateStr.StartsWith(";"))
+ {
+ stateStr = stateStr.Substring(1, stateStr.Length - 1);
+ }
+ else if (stateStr.EndsWith(Language.StringByID(StringId.volumeMusic)))
+ {
+ stateStr = stateStr.Substring(0, stateStr.Length - 3);
+ }
+ }
+ break;
+ case SPK.ElectricalTvHisense:
+ {
+ string on = GetKeyValue("wol", dicList);
+ string off = GetKeyValue("on_off", dicList);
+ string volumet = GetKeyValue("set_volume", dicList);
+ string signal = GetKeyValue("signal", dicList);
+
+ if (!string.IsNullOrEmpty(off))
+ {
+ stateStr = Language.StringByID(StringId.offLogic);
+ //濡傛灉鍏充簡锛屽叾瀹冨睘鎬т笉鏄剧ず
+ break;
+ }
+
+ if (!string.IsNullOrEmpty(on))
+ {
+ stateStr = Language.StringByID(StringId.onLogic);
+ }
+ if (!string.IsNullOrEmpty(stateStr))
+ {
+ stateStr += ",";
+ }
+ if (!string.IsNullOrEmpty(volumet))
+ {
+ stateStr += Language.StringByID(StringId.yinliang) + volumet;
+ }
+
+ if (!string.IsNullOrEmpty(stateStr))
+ {
+ stateStr += ",";
+ }
+ if (!string.IsNullOrEmpty(signal))
+ {
+ var p = new PublicInterface();
+ string key = p.GetKey(p.GetHisenseSignalSourceDic(), signal);
+ stateStr += key;
+ }
+ stateStr = stateStr.TrimEnd(',');
+ }
+ break;
}
}
break;
case "2":
{
//鐢╯id鎵惧埌鍦烘櫙锛�
- var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid);
+ var scene = LogicMethod.Current.GetSecne(outputTarget.sid);
targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
targetView.btnNextIcon.Visible = false;
//鏄剧ず鍦烘櫙鍚嶇О
@@ -1355,7 +1575,7 @@
case "3":
{
//鐢╯id鎵惧埌瀹夐槻锛�
- var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+ var security = LogicMethod.Current.GetSecurity(outputTarget.sid);
targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
targetView.btnDelay.Visible = false;
//鏄剧ず瀹夐槻鍚嶇О
@@ -1385,13 +1605,16 @@
break;
}
- if (outputTarget.target_type == "1" || outputTarget.target_type == "3")
+ if (outputTarget.target_type == "1"
+ || outputTarget.target_type == "3"
+ || outputTarget.target_type == "5"
+ )
{
- targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+ targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr;
}
else
{
- targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+ targetView.btnText.Text = this.GetTimeText(outputTarget.delay) + stateStr;
}
//鍐嶆缂栬緫鏉′欢鐘舵�佺偣鍑讳簨浠�
targetView.btnClick.MouseUpEventHandler += (sen, e) =>
@@ -1415,9 +1638,10 @@
switch (button.Name)
{
case "1":
+ case "5":
{
//鐢╯id鎵惧埌璁惧锛�
- var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
+ var device = LogicMethod.Current.GetDevice(outputTarget.sid);
TargetDeviceFunList deviceFunList = new TargetDeviceFunList();
MainPage.BasePageView.AddChidren(deviceFunList);
deviceFunList.Show(device, indexVulae, edit);
@@ -1448,20 +1672,19 @@
//寤舵椂鐐瑰嚮浜嬩欢
targetView.btnDelay.MouseUpEventHandler += (sen, e) =>
{
-
- InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod();
- inpOrOutLogicMethod.Delayed(thisView, outputTarget.delay, (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;
- }
- });
+ this.Delayed(thisView, outputTarget.delay, (value) =>
+ {
+ outputTarget.delay = value.ToString();
+ if (outputTarget.target_type == "1"
+ || outputTarget.target_type == "5")
+ {
+ targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr;
+ }
+ else
+ {
+ targetView.btnText.Text = this.GetTimeText(outputTarget.delay) + stateStr;
+ }
+ });
};
///鍒犻櫎鎺т欢
@@ -1480,16 +1703,35 @@
/// <param name="button2">鏄剧ずBtn</param>
/// <param name="button3">鏄剧ずBtn</param>
/// <param name="button4">鏄剧ずBtn</param>
- public static void EditState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4)
+ /// <param name="attribute">灞炴�х储寮�</param>
+ public void EditDeviceState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4, string attribute)
{
switch (device.spk)
{
- //鎻掑骇
+ //鎻掑骇(鏈塙SB)
case SPK.PanelSocket:
+ {
+ 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.ElectricSocket:
//寮�鍏崇伅鍏�
+ case SPK.OtherCommon:
case SPK.AirSwitch:
case SPK.LightSwitch:
+ //鏈烘鎵�
+ case SPK.MechanicalArm:
{
foreach (var dic in dicList)
{
@@ -1537,9 +1779,102 @@
button2.Text = value + "%";
}
break;
+ case "cct":
+ {
+ if (button3 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ button3.Text = value + "k";
+ }
+ break;
+ case "rgb":
+ case "rgbw":
+ {
+ if (button3 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ if (!string.IsNullOrEmpty(value) && value.Length > 6)
+ {
+ button3.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(value);
+ button3.Tag = value;
+ }
+ }
+ break;
+
}
}
+ }
+ break;
+ case SPK.GroupControl://缇ゆ帶
+ {
+ foreach (var dic in dicList)
+ {
+ string key = dic["key"];
+ if (key != attribute)
+ {
+ continue;
+ }
+ string value = dic["value"];
+ switch (key)
+ {
+ case "on_off":
+ case "colorful":
+ {
+ if (value == "on")
+ {
+ button1.Text = Language.StringByID(StringId.onLogic);
+ }
+ else
+ {
+ button1.Text = Language.StringByID(StringId.offLogic);
+ }
+ }
+ break;
+ case "brightness":
+ {
+ if (button1 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ button1.Text = value + "%";
+ }
+ break;
+ case "cct":
+ {
+ if (button1 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ button1.Text = value + "k";
+ }
+ break;
+ case "rgb":
+ {
+ if (button1 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ if (!string.IsNullOrEmpty(value) && value.Length > 6)
+ {
+ button1.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(value);
+ button1.Tag = value;
+ }
+ }
+ break;
+
+
+
+ }
+ }
+
}
break;
case SPK.CurtainSwitch:
@@ -1611,7 +1946,7 @@
}
}
-
+
}
break;
case SPK.CurtainDream:
@@ -1649,6 +1984,7 @@
break;
case SPK.AcStandard:
case SPK.HvacAC:
+ case SPK.AcIr:
{
foreach (var dic in dicList)
{
@@ -1679,7 +2015,7 @@
//鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
break;
}
- button2.Text = value + "鈩�";
+ button2.Text = value + GetTemperatureUnit(device); ;
}
break;
case "mode":
@@ -1759,7 +2095,8 @@
}
break;
- case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+ case SPK.FloorHeatStandard:
+ case SPK.HvacFloorHeat:
{
foreach (var dic in dicList)
@@ -1791,7 +2128,7 @@
//鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
break;
}
- button2.Text = value + "鈩�";
+ button2.Text = value + GetTemperatureUnit(device); ;
}
break;
case "mode":
@@ -1926,6 +2263,7 @@
}
}
break;
+
case SPK.SensorGas:
case SPK.SensorSmoke:
{
@@ -1965,7 +2303,7 @@
foreach (var dic in dicList)
{
string value = dic["value"];
- if (value == "on")
+ if (value == "on"|| value == "open")
{
button1.Text = Language.StringByID(StringId.onLogic);
}
@@ -1992,6 +2330,23 @@
button1.Text = Language.StringByID(StringId.wuren);
}
}
+ }
+ break;
+ case SPK.SensorPirHold:
+ {
+ 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:
@@ -2051,13 +2406,14 @@
}
break;
case SPK.SenesorMegahealth:
+ case SPK.SensorMmvPose:
{
foreach (var dic in dicList)
{
string value = dic["value"];
switch (dic["key"])
{
-
+
case "target_status":
{
if (value == "4")
@@ -2109,10 +2465,126 @@
{
button1.Text = Language.StringByID(StringId.shi);
}
-
+
}
}
break;
+ case SPK.VideoDoorLock:
+ {
+ string userName = string.Empty;
+ string tag = string.Empty;
+ for (int b = 0; b < dicList.Count; b++)
+ {
+ var dic = dicList[b];
+ //var userId = dic["value"].ToString();
+ //var FaceItem = this.GetVideoDoorLockUserItem(userId, device);
+ //s += FaceItem.userName;
+ //s += ",";
+ //tag += FaceItem.userId;
+ //tag += "_";
+ userName = dic["value"].ToString();
+
+ }
+ button1.Text = RemoveLastStr(userName);
+ button1.Tag = tag;
+ }
+ break;
+ case SPK.MusicStandard:
+ case SPK.AvMusic:
+ {
+ foreach (var dic in dicList)
+ {
+ if (dic["key"] == "song_name")
+ {
+ button1.Text = dic["value"]?.ToString();
+ }
+ else if (dic["key"] == "volume")
+ {
+ button2.Text = dic["value"]?.ToString();
+ }
+ }
+ }
+ break;
+ case SPK.doorgate:
+ {
+ string s = string.Empty;
+ string tag = string.Empty;
+ for (int b = 0; b < dicList.Count; b++)
+ {
+ var dic = dicList[b];
+ var key = dic["key"].ToString();
+ if (key != "user_id")
+ {
+ continue;
+ }
+ var userId = dic["value"].ToString();
+ var FaceItem = this.GetFaceItem(userId, device.deviceId);
+ s += FaceItem.userName;
+ s += ",";
+ tag += FaceItem.userId;
+ tag += "_";
+ }
+ button2.Text = s;
+ button2.Tag = tag;
+ }
+ break;
+ case SPK.ElectricalTvHisense:
+ {
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ switch (dic["key"])
+ {
+ case "on_off":
+ {
+ if (value == "off")
+ {
+ button1.Text = Language.StringByID(StringId.offLogic);
+
+ }
+
+ }
+ break;
+ case "wol":
+ {
+ if (value == "on")
+ {
+ button1.Text = Language.StringByID(StringId.onLogic);
+
+ }
+
+ }
+ break;
+
+ case "set_volume":
+ {
+ if (button2 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ button2.Text = value;
+ }
+ break;
+ case "signal":
+ {
+ if (button3 == null)
+ {
+ //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+ break;
+ }
+ var p = new PublicInterface();
+ string key = p.GetKey(p.GetHisenseSignalSourceDic(), value);
+ button3.Text = key;
+ }
+ break;
+ }
+
+ }
+ }
+ break;
+
+
}
}
/// <summary>
@@ -2121,7 +2593,7 @@
/// <param name="keyValue"></param>
/// <param name="dicList"></param>
/// <returns></returns>
- public static string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList)
+ public string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList)
{
string valueStr = "";
@@ -2137,10 +2609,55 @@
return valueStr;
}
/// <summary>
+ /// 鑾峰彇Key鍊�
+ /// </summary>
+ /// <param name="dicList">娉ㄦ剰:姘歌繙榛樿绗竴涓厓绱�</param>
+ /// <returns></returns>
+ public string GetKey(List<Dictionary<string, string>> dicList)
+ {
+ if (dicList.Count == 0)
+ {
+ return "";
+ }
+ return dicList[0]["key"].ToString();
+ }
+ /// <summary>
+ /// 鑾峰彇value鍊�
+ /// </summary>
+ /// <param name="dicList">娉ㄦ剰:姘歌繙榛樿绗竴涓厓绱�</param>
+ /// <returns></returns>
+ public string GetValue(List<Dictionary<string, string>> dicList)
+ {
+ if (dicList.Count == 0)
+ {
+ return "";
+ }
+ return dicList[0]["value"].ToString();
+ }
+ /// <summary>
+ /// 鑾峰彇娓╁害鍗曚綅
+ /// </summary>
+ /// <param name="device"></param>
+ /// <returns></returns>
+ public string GetTemperatureUnit(Entity.Function device)
+ {
+ string unit = string.Empty;
+ if (device.GetAttribute("temperature_type") != null)
+ {
+ unit = device.GetAttribute("temperature_type").unit;
+ }
+ if (string.IsNullOrEmpty(unit))
+ {
+ //璋冭瘯杞欢鏈夌┖鑳戒笂浼犱负绌�
+ unit = "鈩�";
+ }
+ return unit;
+ }
+ /// <summary>
///鑾峰彇鑷姩鍖栧悕绉�
/// </summary>
/// <returns> 鏂板缓鑷姩鍖栧懡鍚嶈鍒�</returns>
- public static string GetLogicName(Logic logic)
+ public string GetLogicName(Logic logic)
{
string name = "";
@@ -2163,16 +2680,17 @@
}
break;
case "3":
+ case "9":
{
//鐢╯id鎵惧埌璁惧锛�
- var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
+ var device = LogicMethod.Current.GetDevice(inputCondition.sid);
name = device.name + "-";
}
break;
case "10":
{
//鐢╯id鎵惧埌鍦烘櫙锛�
- var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+ var scene = LogicMethod.Current.GetSecne(inputCondition.sid);
name = scene.name + "-";
}
break;
@@ -2187,29 +2705,23 @@
case "1":
{
//鐢╯id鎵惧埌璁惧锛�
- var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
+ var device = LogicMethod.Current.GetDevice(outputTarget.sid);
//鏄剧ず璁惧鍚嶇О
name += device.name;
string stateStr = "";
//鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
switch (device.spk)
{
+ case SPK.MechanicalArm:
case SPK.AirSwitch:
case SPK.LightSwitch:
{//寮�鍏崇伅
-
- foreach (var dic in dicList)
+ string value = this.GetValue(dicList);
+ stateStr = Language.StringByID(StringId.offLogic);
+ if (value == "on")
{
- string value = dic["value"];
- if (value == "on")
- {
- stateStr = Language.StringByID(StringId.onLogic);
+ stateStr = Language.StringByID(StringId.onLogic);
- }
- else
- {
- stateStr = Language.StringByID(StringId.offLogic);
- }
}
}
break;
@@ -2218,8 +2730,8 @@
case SPK.LightCCT:
case SPK.LightDimming:
{
- string on_off = InpOrOutLogicMethod.GetKeyValue("on_off", dicList);
- string brightness = InpOrOutLogicMethod.GetKeyValue("brightness", dicList);
+ string on_off = this.GetKeyValue("on_off", dicList);
+ string brightness = this.GetKeyValue("brightness", dicList);
if (on_off == "on" && brightness != "")
{
stateStr = Language.StringByID(StringId.onLogic) + brightness + "%";
@@ -2268,20 +2780,16 @@
break;
case SPK.AcStandard:
case SPK.HvacAC:
- case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+ case SPK.AcIr:
+ case SPK.FloorHeatStandard:
+ case SPK.HvacFloorHeat:
{
- foreach (var dic in dicList)
+ string value = this.GetValue(dicList);
+ stateStr = Language.StringByID(StringId.offLogic);
+ if (value == "on")
{
- string value = dic["value"];
- if (value == "on")
- {
- stateStr = Language.StringByID(StringId.onLogic);
+ stateStr = Language.StringByID(StringId.onLogic);
- }
- else if (value == "off")
- {
- stateStr = Language.StringByID(StringId.offLogic);
- }
}
}
@@ -2294,7 +2802,7 @@
case "2":
{
//鐢╯id鎵惧埌鍦烘櫙锛�
- var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid);
+ var scene = LogicMethod.Current.GetSecne(outputTarget.sid);
name += scene.name;
}
@@ -2302,7 +2810,7 @@
case "3":
{
//鐢╯id鎵惧埌瀹夐槻锛�
- var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+ var security = LogicMethod.Current.GetSecurity(outputTarget.sid);
name += security.name;
}
@@ -2390,40 +2898,43 @@
/// <returns></returns>
private string GetTimeText(string strTimeValue)
{
- var timeValue = int.Parse(strTimeValue);
+ //鍥犱负璋冭瘯杞欢涓婁紶涓虹┖杩�;
+ string intTimeValue = string.IsNullOrEmpty(strTimeValue) ? "0" : strTimeValue;
+ var timeValue = int.Parse(intTimeValue);
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;
+ return LogicMethod.Current.getTimeStr(strTimeValue).Replace("0s","");
+ //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)
+ private string GetText(List<Dictionary<string, string>> dicList, string key)
{
string strtext = "";
foreach (var dic in dicList)
@@ -2433,6 +2944,19 @@
switch (key)
{
+ case "illuminance":
+ {
+ if (comparator == ">")
+ {
+ strtext = ">" + value;
+ }
+ else if (comparator == "<")
+ {
+ strtext = "<" + value;
+ }
+
+ }
+ break;
case "temperature":
{
if (comparator == ">")
@@ -2464,6 +2988,11 @@
strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value);
}
break;
+ case "pm10":
+ {
+ strtext = Language.StringByID(StringId.pm10) + new PublicInterface { }.GetString("pm25", value);
+ }
+ break;
case "pm25":
{
strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value);
@@ -2483,15 +3012,16 @@
}
return strtext;
}
- private void SensorView(FrameLayout thisView, Function device,string key, int indexVulae) {
+ 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)
+ for (int i = 0; i < inputedit.condition.Count; i++)
{
+ var dic = inputedit.condition[i];
string comparator = dic["comparator"];
stateValue = dic["value"];
switch (key)
@@ -2508,7 +3038,7 @@
{
titleInt = StringId.wendudiyu;
}
- conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
}
break;
case "humidity":
@@ -2522,32 +3052,88 @@
{
titleInt = StringId.shidudiyu;
}
- conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
}
break;
case "co2":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
+ }
+ break;
+ case "pm10":
+ {
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm10", StringId.pm10, indexVulae, true, stateValue);
}
break;
case "pm25":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
}
break;
case "tvoc":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
}
break;
case "hcho":
{
- conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
+ ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
}
break;
}
}
}
+ /// <summary>
+ /// 鏌ユ壘鎸囧畾鍙瀵硅userId
+ /// </summary>
+ /// <param name="userId"></param>
+ /// <returns></returns>
+ public Face GetFaceItem(string userId, string deviceId)
+ {
+ if (Send.Current.faceList.Count == 0)
+ {
+ Send.Current.GetListHomeFace(deviceId, false);
+ }
+ var face = Send.Current.faceList.Find((o) => { return o.userId == userId; });
+ if (face == null)
+ {
+ face = new Face();
+ }
+ return face;
+ }
+ /// <summary>
+ /// 鏌ユ壘鎸囧畾钀ょ煶瑙嗛闂ㄩ攣userId
+ /// </summary>
+ /// <param name="userId"></param>
+ /// <returns></returns>
+ public Face GetVideoDoorLockUserItem(string userId, Function device)
+ {
+ if (Send.Current.VideoDoorLockUserListInfo.Count == 0)
+ {
+ Send.Current.GetVideoDoorLockUserListInfo(device);
+ }
+ var face = Send.Current.VideoDoorLockUserListInfo.Find((o) => { return o.userId == userId; });
+ if (face == null)
+ {
+ face = new Face();
+ }
+ return face;
+ }
+
+ /// <summary>
+ /// 鍒犻櫎鏈�鍚庝竴涓� ","
+ /// </summary>
+ /// <param name="s">瀛楃涓�</param>
+ /// <returns></returns>
+ public string RemoveLastStr(string s)
+ {
+ if (string.IsNullOrEmpty(s))
+ {
+ return string.Empty;
+ }
+ return s.Replace("[","").Replace("]","").Replace("\"","").TrimEnd(',');
+ }
+
}
}
--
Gitblit v1.8.0