From 6eb21769c74cfcd10084f73ff3f212355849a3c7 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 17 五月 2021 15:00:13 +0800
Subject: [PATCH] 2021-5-17-2
---
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 330 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 219 insertions(+), 111 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 6d5a498..47f2d15 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -55,48 +55,124 @@
//鍦扮儹
case SPK.FloorHeatStandard:
{
- LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
- lightSwitchView.btnText.TextID = StringId.switchLogic;
- lightSwitchView.btnState.Text = "";
- fLayout.AddChidren(lightSwitchView.FLayoutView());
- lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
- {
- FrameLayout frame = new FrameLayout
- {
- BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
- };
- this.AddChidren(frame);
- LogicView.SwitchView switchView = new LogicView.SwitchView();
- switchView.FLayoutView(frame, 2, lightSwitchView.btnState.Text, (strValue) =>
- {
- int id = 0;
- switch (strValue)
- {
- case "on":
- {
- id = StringId.onLogic;
- }
- break;
- case "off":
- {
- id = StringId.offLogic;
- }
- break;
- }
- //鏄剧ず鏂囨湰
- lightSwitchView.btnState.TextID = id;
- selectedState = device.functionType + "_" + strValue;
- //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
- string keyVlaue = "on_off";
- AddDictionary(keyVlaue, strValue);
- });
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.switchLogic;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.onLogic, StringId.offLogic);
};
if (edit)
{
- GetEditState(device, index, lightSwitchView.btnState, null, null, null);
+ GetEditState(device, index, view.btnState, null, null, null);
+ }
+ }
+ break;
+ case SPK.SensorWater:
+ {
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.luoshuiandwuluoshui;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.luoshui, StringId.wuluoshui);
+ };
+ if (edit)
+ {
+ GetEditState(device, index, view.btnState, null, null, null);
}
+ }
+ break;
+ case SPK.SensorSmoke:
+ case SPK.SensorGas:
+ {
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.xieluoandwuxieluo;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.xieluo, StringId.wuxieluo);
+ };
+ if (edit)
+ {
+ GetEditState(device, index, view.btnState, null, null, null);
+ }
+
+ }
+ break;
+ case SPK.SensorDryContact:
+ {
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.switchLogic;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.onLogic, StringId.offLogic);
+ };
+ if (edit)
+ {
+ GetEditState(device, index, view.btnState, null, null, null);
+ }
+
+ }
+ break;
+ case SPK.SensorShanLan:
+ case SPK.SensorDuiShe:
+ case SPK.SensorPir:
+ {
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.yourenandwuren;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.youren, StringId.wuren);
+ };
+ if (edit)
+ {
+ GetEditState(device, index, view.btnState, null, null, null);
+ }
+ }
+ break;
+ case SPK.SensorDoorWindow:
+ {
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.kaiqiandbihe;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.kaiqi, StringId.bihe);
+ };
+ if (edit)
+ {
+ GetEditState(device, index, view.btnState, null, null, null);
+ }
+ }
+ break;
+ case SPK.SensoruUtrasonic:
+ {
+
+ LogicView.FunTypeView view = new LogicView.FunTypeView();
+ view.btnText.TextID = StringId.yourenandwuren;
+ fLayout.AddChidren(view.FLayoutView());
+ view.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view.btnState, StringId.youren, StringId.wuren);
+ };
+ LogicView.FunTypeView view1 = new LogicView.FunTypeView();
+ view1.frameLayout.Y = view.frameLayout.Bottom;
+ view1.btnText.TextID = StringId.fangchaigongneng;
+ fLayout.AddChidren(view1.FLayoutView());
+ view1.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ DeviceView(device, view1.btnState, StringId.zaixian, StringId.buzaixian);
+ };
+
+ if (edit)
+ {
+ GetEditState(device, index, view.btnState, view1.btnState, null, null);
+ }
}
break;
@@ -139,53 +215,119 @@
return;
}
LogicMethod.RemoveAllView();
- AddLogic addLogic = new AddLogic();
- MainPage.BasePageView.AddChidren(addLogic);
- addLogic.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+ if (MainView.IsGatewayType)
+ { //A缃戝叧
+ var addLogic = new AddLogic();
+ MainPage.BasePageView.AddChidren(addLogic);
+ addLogic.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
+ else
+ {
+ //涓�绔彛缃戝叧
+ var onePortAutomation = new OnePortAutomation();
+ MainPage.BasePageView.AddChidren(onePortAutomation);
+ onePortAutomation.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
};
#endregion
}
/// <summary>
- /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰
+ /// 璁惧閫夋嫨鏉′欢鐣岄潰
/// </summary>
- /// <param name="frame"></param>
- /// <param name="device"></param>
- /// <param name="button"></param>
- /// <param name="len"></param>
- public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len)
- {
-
+ /// <param name="device">璁惧</param>
+ /// <param name="button">閫変腑鐘舵�佹樉绀烘枃鏈珺tn鎺т欢</param>
+ /// <param name="btnText1">灞炴�х姸鎬佸�兼枃鏈�1</param>
+ /// <param name="btnText2">灞炴�х姸鎬佸�兼枃鏈�2</param>
+ private void DeviceView(Entity.Function device,Button button,int btnText1,int btnText2) {
+ FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence };
+ this.AddChidren(frame);
LogicView.SwitchView switchView = new LogicView.SwitchView();
- switchView.FLayoutView(frame, len, button.Text, (Action<string>)((strValue) =>
+ switchView.FLayoutView(frame, btnText1, btnText2, button.Text, (intValue) =>
{
- int id = 0;
- switch (strValue)
+ //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
+ string keyVlaue = "on_off";
+ string value = "";
+ switch (device.spk)
{
- case "on":
+ //浼犳劅鍣�
+ case SPK.SensorWater:
+ case SPK.SensorSmoke:
+ case SPK.SensorGas:
+ case SPK.SensorDryContact:
+ case SPK.SensorShanLan:
+ case SPK.SensorDuiShe:
+ case SPK.SensorPir:
+ case SPK.SensorDoorWindow:
+ case SPK.SensoruUtrasonic:
{
- id = StringId.onLogic;
+ keyVlaue = "status";
}
break;
- case "off":
- {
- id = StringId.offLogic;
- }
- break;
- }
- button.TextID = id;
- keyVlaue = "on_off";
- Dictionary<string, string> dic = new Dictionary<string, string>();
- LogicMethod.dictionary(dic, "key", "on_off");
- LogicMethod.dictionary(dic, "comparator", "=");
- LogicMethod.dictionary(dic, "data_type", "string");
- LogicMethod.dictionary(dic, "value", strValue);
- AddDictionaryData(dicSateteList, keyVlaue, dic);
- selectedState = device.spk + "_" + strValue;
- }));
+ }
+ switch (intValue)
+ {
+ case StringId.xieluo:
+ case StringId.luoshui:
+ {
+ value = "alarm";
+ }
+ break;
+ case StringId.wuxieluo:
+ case StringId.wuluoshui:
+ {
+ value = "normal";
+ }
+ break;
+ case StringId.onLogic:
+ {
+ value = "on";
+ }
+ break;
+ case StringId.offLogic:
+ {
+ value = "off";
+ }
+ break;
+ case StringId.youren: {
+ value = "true";
+ }
+ break;
+ case StringId.wuren: {
+ value = "false";
+ }
+ break;
+ case StringId.kaiqi:
+ {
+ value = "open";
+ }
+ break;
+ case StringId.bihe:
+ {
+ value = "close";
+ }
+ break;
+ case StringId.zaixian: {
+ keyVlaue = "dismantle";
+ value = "true";
+ };break;
+ case StringId.buzaixian:
+ {
+ keyVlaue = "dismantle";
+ value = "false";
+ }; break;
+ }
+ //鏄剧ず鏂囨湰
+ button.TextID = intValue;
+ selectedState = device.spk + "_" + value;
+ AddDictionary(keyVlaue, value);
+
+ });
}
/// <summary>
@@ -208,39 +350,6 @@
//鏈夋暟鎹噸鏂拌祴鍊�
dicSateteList = dicList;
}
- switch (device.spk)
- {
- //寮�鍏崇伅鍏� light.Switch
- case SPK.LightDimming:
- case SPK.LightRGB:
- case SPK.LightRGBW:
- case SPK.LightCCT:
- case SPK.LightSwitch:
- //绐楀笜
- case SPK.CurtainSwitch:
- case SPK.CurtainRoller:
- case SPK.CurtainTrietex:
- //绌鸿皟
- case SPK.AcStandard:
- //鍦扮儹
- case SPK.FloorHeatStandard:
- {
- 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;
-
- }
InpOrOutLogicMethod.EditState(device, dicList, button1, button2, button3, button4);
}
/// <summary>
@@ -256,21 +365,20 @@
LogicMethod.dictionary(dic, "comparator", "=");
LogicMethod.dictionary(dic, "data_type", "string");
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))
{
//鍒ゆ柇鏄惁瀛樺湪
@@ -282,14 +390,14 @@
if (indexValue != -1)
{
//瀛樺湪绉婚櫎
- dicList.RemoveAt(indexValue);
+ dicSateteList.RemoveAt(indexValue);
//閲嶆柊娣诲姞
- dicList.Insert(indexValue, dictionary);
+ dicSateteList.Insert(indexValue, dictionary);
}
else
{
//鏂版坊鍔�
- dicList.Add(dictionary);
+ dicSateteList.Add(dictionary);
}
}
--
Gitblit v1.8.0