From a56a485926a8927f904d7f4795c371c25b35753a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 22 十二月 2020 18:18:15 +0800
Subject: [PATCH] Merge branch 'WJC' into NewFilePath
---
/dev/null | 21 -
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 274 +++++++++++++
HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 106 ----
HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store | 0
HDL_ON/UI/UI2/3-Intelligence/Automation/InterfaceDsplaysLogic.cs | 340 ++++++++++++++++
HDL_ON/HDL_ON.projitems | 2
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 485 +---------------------
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 18
8 files changed, 678 insertions(+), 568 deletions(-)
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 29a4403..6c1be56 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -164,7 +164,6 @@
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneFunctionListChoosePage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SetSceneFunctionInfoPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SetSceneLocationPage.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\AutomationMenuPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Panel\PanelPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\SearchDevice\SearchDevicePage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\SearchDevice\VoicePanelScenePage.cs" />
@@ -267,6 +266,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Common\Utlis\FloorRoomSelectPopupView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\DiySelectPopupDialog.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\BrightnessView.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\InterfaceDsplaysLogic.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)UI\" />
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
index 641e1de..c761de7 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index f6bb95b..7bebd3c 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -103,7 +103,7 @@
LogicView.LogicTypeTitleView cyclicTitle = new LogicView.LogicTypeTitleView();
cyclicTitle.frameLayout.Height = Application.GetRealHeight(50);
cyclicTitle.frameLayout.Radius = (uint)Application.GetRealHeight(12);
- cyclicTitle.btnText.Text = MainView.GetWeekText(Logic.currlogic);
+ cyclicTitle.btnText.Text = MainView.GetCyclicText(Logic.currlogic);
viewLayout.AddChidren(cyclicTitle.FLayoutView());
#endregion
@@ -160,7 +160,7 @@
this.AddChidren(fLayout);
AndOrMethod(fLayout, titleCondition.btnText);
};
- ///鏉′欢鐐瑰嚮浜嬩欢
+ ///鏉′欢娣诲姞鐐瑰嚮浜嬩欢
addInputIcon.btnClick.MouseUpEventHandler += (sen, e) =>
{
var addInputType = new AddInputType();
@@ -168,7 +168,7 @@
addInputType.Show();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
- ///鐩爣鐐瑰嚮浜嬩欢
+ ///鐩爣娣诲姞鐐瑰嚮浜嬩欢
addOutputIcon.btnClick.MouseUpEventHandler += (sen, e) =>
{
var addTarget = new AddTarget();
@@ -209,7 +209,7 @@
{
list.Add(logic.name);
}
- new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
+ new LogicView.TipPopView().InputBox(StringId.editName, InterfaceDsplaysLogic.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
{
Logic.currlogic.name = logicName;
Logic.currlogic.sid = LogicMethod.NewSid();
@@ -477,7 +477,7 @@
weekStateList.Clear();
if (Logic.currlogic.cycle.type == "week")
{
- var list = GetWeekString(Logic.currlogic.cycle.value, "int");
+ var list = InterfaceDsplaysLogic.GetWeekString(Logic.currlogic.cycle.value, "int");
//鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹�
weekStateList.AddRange(list);
}
@@ -485,7 +485,7 @@
weekView.MultiSelectShow(fLayout, weekStr, Language.StringByID(StringId.cyclic), weekStateList
, (list) =>
{
- var statelist = GetWeekString(list, "str");
+ var statelist = InterfaceDsplaysLogic.GetWeekString(list, "str");
Logic.currlogic.cycle.type = "week";
Logic.currlogic.cycle.value = statelist;
button.Text = MainView.GetWeekString(statelist);
@@ -541,98 +541,8 @@
}
- /// <summary>
- /// 鏄熸湡鍛ㄦ湡杞崲鍊肩殑鏂规硶
- /// </summary>
- /// <param name="list"></param>
- /// <param name="str_or_int"></param>
- /// <returns></returns>
- public List<string> GetWeekString(List<string> list, string str_or_int)
- {
- string weekTextName = "";
- List<string> stateList = new List<string>();
- for (int i = 0; i < list.Count; i++)
- {
- var s = list[i];
- if (str_or_int == "int")
- {
- switch (s)
- {
- case "1":
- {
- weekTextName = Language.StringByID(StringId.monday);
- }
- break;
- case "2":
- {
- weekTextName = Language.StringByID(StringId.tuesday);
- }
- break;
- case "3":
- {
- weekTextName = Language.StringByID(StringId.wednesday);
- }
- break;
- case "4":
- {
- weekTextName = Language.StringByID(StringId.thursday);
- }
- break;
- case "5":
- {
- weekTextName = Language.StringByID(StringId.friday);
- }
- break;
- case "6":
- {
- weekTextName = Language.StringByID(StringId.saturday);
- }
- break;
- case "0":
- {
- weekTextName = Language.StringByID(StringId.sunday);
- }
- break;
- }
-
- }
- else
- {
- if (Language.StringByID(StringId.monday) == s)
- {
- weekTextName = "1";
- }
- else if (Language.StringByID(StringId.tuesday) == s)
- {
- weekTextName = "2";
- }
- else if (Language.StringByID(StringId.wednesday) == s)
- {
- weekTextName = "3";
- }
- else if (Language.StringByID(StringId.thursday) == s)
- {
- weekTextName = "4";
- }
- else if (Language.StringByID(StringId.friday) == s)
- {
- weekTextName = "5";
- }
- else if (Language.StringByID(StringId.saturday) == s)
- {
- weekTextName = "6";
- }
- else if (Language.StringByID(StringId.sunday) == s)
- {
- weekTextName = "0";
- }
- }
- stateList.Add(weekTextName);
-
- }
-
- return stateList;
- }
+
+
}
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AutomationMenuPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AutomationMenuPage.cs
deleted file mode 100755
index 93f4e2f..0000000
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AutomationMenuPage.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-锘縰sing System;
-using Shared;
-using HDL_ON.UI.CSS;
-namespace HDL_ON.UI
-{
- public class AutomationMenuPage : FrameLayout
- {
- FrameLayout bodyView;
- public AutomationMenuPage()
- {
- bodyView = this;
- }
-
- public void LoadPage()
- {
- //new TopViewDiv(bodyView, Language.StringByID(StringId.Automation)).LoadTopView();
-
-
- }
- }
-}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 350280b..b520c56 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -15,6 +15,12 @@
for (int i = 0; i < Logic.currlogic.input.Count; i++)
{
Input inputCondition = Logic.currlogic.input[i];
+ if (inputCondition == null)
+ {
+ //闃叉鏈夌殑绌哄璞★紱
+ //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+ continue;
+ }
///鍚勭鏉′欢鐨刅iew
LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView();
inputView.FLayoutView(viewLayout);
@@ -177,6 +183,12 @@
for (int i = 0; i < Logic.currlogic.output.Count; i++)
{
Output outputTarget = Logic.currlogic.output[i];
+ if (outputTarget == null)
+ {
+ //闃叉鏈夌殑绌哄璞★紱
+ //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+ continue;
+ }
///鍚勭鏉′欢鐨刅iew
LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView();
targetView.FLayoutView(viewLayout);
@@ -550,14 +562,274 @@
};
}
}
+ /// <summary>
+ /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
+ /// </summary>
+ /// <param name="device">缂栬緫璁惧</param>
+ /// <param name="button1">鏄剧ずBtn</param>
+ /// <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)
+ {
+ switch (device.functionType)
+ {
+ //寮�鍏崇伅鍏�
+ case FunctionType.Relay:
+ {
+ 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 FunctionType.Dimmer:
+ case FunctionType.RGB:
+ case FunctionType.RGBW:
+ case FunctionType.ColorTemperature:
+ {
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ switch (dic["key"])
+ {
+ case "on_off":
+ {
+ if (value == "on")
+ {
+ button1.Text = Language.StringByID(StringId.onLogic);
+ }
+ else
+ {
+ button1.Text = Language.StringByID(StringId.offLogic);
+ }
+ }
+ break;
+ case "brightness":
+ {
+ button2.Text = value + "%";
+ }
+ break;
+ }
+
+ }
+ }
+ break;
+ case FunctionType.Curtain:
+ case FunctionType.MotorCurtain:
+ case FunctionType.RollingShutter:
+ {
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ switch (value)
+ {
+ case "on":
+ {
+ button1.Text = Language.StringByID(StringId.onLogic);
+ }
+ break;
+ case "off":
+ {
+ button1.Text = Language.StringByID(StringId.offLogic);
+ }
+ break;
+ case "stop":
+ {
+ button1.Text = Language.StringByID(StringId.stop);
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case FunctionType.AC:
+ {
+ 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 "set_temp":
+ {
+ button2.Text = value + "鈩�";
+ }
+ break;
+ case "mode":
+ {
+ switch (value)
+ {
+ case "cool":
+ {
+ button3.Text = Language.StringByID(StringId.coolLogic);
+ }
+ break;
+ case "heat":
+ {
+ button3.Text = Language.StringByID(StringId.heatingLogic);
+ }
+ break;
+ case "auto":
+ {
+ button3.Text = Language.StringByID(StringId.autoLogic);
+ }
+ break;
+ case "dry":
+ {
+ button3.Text = Language.StringByID(StringId.dehumidifyLogic);
+ }
+ break;
+ }
+
+
+
+ }
+ break;
+ case "fan":
+ {
+ switch (value)
+ {
+ case "high":
+ {
+ button4.Text = Language.StringByID(StringId.HighWindSpeed);
+ }
+ break;
+ case "medium":
+ {
+ button4.Text = Language.StringByID(StringId.MiddleWindSpeed);
+ }
+ break;
+ case "low":
+ {
+ button4.Text = Language.StringByID(StringId.LowWindSpeed);
+ }
+ break;
+ case "auto":
+ {
+ button4.Text = Language.StringByID(StringId.Auto);
+ }
+ break;
+ }
+
+
+ }
+ break;
+
+
+ }
+
+ }
+
+ }
+ break;
+ case FunctionType.FloorHeating:
+ {
+
+ 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 "set_temp":
+ {
+ button2.Text = value + "鈩�";
+ }
+ break;
+ case "mode":
+ {
+ switch (value)
+ {
+ case "day":
+ {
+ button3.Text = Language.StringByID(StringId.dayMode);
+ }
+ break;
+ case "night":
+ {
+ button3.Text = Language.StringByID(StringId.nightMode);
+ }
+ break;
+
+ case "away":
+ {
+ button3.Text = Language.StringByID(StringId.leaveMode);
+ }
+ break;
+ case "normal":
+ {
+ button3.Text = Language.StringByID(StringId.ordinaryMode);
+ }
+ break;
+ case "timer":
+ {
+ button3.Text = Language.StringByID(StringId.timeMode);
+ }
+ break;
+ }
+
+
+
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ }
+ }
/// <summary>
/// 鑾峰彇value閿��
/// </summary>
/// <param name="keyValue"></param>
/// <param name="dicList"></param>
/// <returns></returns>
- private static string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList)
+ public static string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList)
{
string valueStr = "";
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InterfaceDsplaysLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InterfaceDsplaysLogic.cs
new file mode 100644
index 0000000..768f037
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InterfaceDsplaysLogic.cs
@@ -0,0 +1,340 @@
+锘縰sing System;
+using Shared;
+using System.Collections.Generic;
+
+namespace HDL_ON.UI.UI2.Intelligence.Automation
+{
+ public class InterfaceDsplaysLogic
+ {
+ /// <summary>
+ ///鑾峰彇鑷姩鍖栧悕绉�
+ /// </summary>
+ /// <returns> 鏂板缓鑷姩鍖栧懡鍚嶈鍒�</returns>
+ public static string GetLogicName(Logic logic)
+ {
+
+ string name = "";
+ try
+ {
+ //榛樿鍙栫涓�涓潯浠�
+ Input inputCondition = logic.input[0];
+ //鏄剧ず鏉′欢鍚勭绫诲瀷鐘舵��
+ switch (inputCondition.condition_type)
+ {
+ case "1":
+ {
+ name = Language.StringByID(StringId.hour) + "-";
+ }
+ break;
+ case "2":
+ {
+ name = Language.StringByID(StringId.timeHorizon) + "-";
+
+ }
+ break;
+ case "3":
+ {
+ //鐢╯id鎵惧埌璁惧锛�
+ var device = LogicMethod.GetDevice(inputCondition.sid);
+ name = device.name + "-";
+ }
+ break;
+
+ }
+ //榛樿鍙栫涓�涓洰鏍�
+ Output outputTarget = logic.output[0];
+ List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>;
+ //鏄剧ず杈撳嚭鏉′欢鍚勭绫诲瀷鐘舵��
+ switch (outputTarget.target_type)
+ {
+ case "1":
+ {
+ //鐢╯id鎵惧埌璁惧锛�
+ var device = LogicMethod.GetDevice(outputTarget.sid);
+ //鏄剧ず璁惧鍚嶇О
+ name += device.name;
+ string stateStr = "";
+ //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
+ switch (device.functionType)
+ {
+ case FunctionType.Relay:
+ {//寮�鍏崇伅
+
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ if (value == "on")
+ {
+ stateStr = Language.StringByID(StringId.onLogic);
+
+ }
+ else
+ {
+ stateStr = Language.StringByID(StringId.offLogic);
+ }
+ }
+ }
+ break;
+ case FunctionType.RGB:
+ case FunctionType.RGBW:
+ case FunctionType.ColorTemperature:
+ case FunctionType.Dimmer:
+ {
+ string on_off = InpOrOutLogicMethod.GetKeyValue("on_off", dicList);
+ string brightness = InpOrOutLogicMethod.GetKeyValue("brightness", 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 + "%";
+ }
+ }
+ break;
+ case FunctionType.Curtain:
+ case FunctionType.MotorCurtain:
+ case FunctionType.RollingShutter:
+ {
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ switch (value)
+ {
+ case "on":
+ {
+ stateStr = Language.StringByID(StringId.onLogic);
+ }
+ break;
+ case "off":
+ {
+ stateStr = Language.StringByID(StringId.offLogic);
+ }
+ break;
+ case "stop":
+ {
+ stateStr = Language.StringByID(StringId.stop);
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case FunctionType.AC:
+ case FunctionType.FloorHeating:
+ {
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ if (value == "on")
+ {
+ stateStr = Language.StringByID(StringId.onLogic);
+
+ }
+ else if (value == "off")
+ {
+ stateStr = Language.StringByID(StringId.offLogic);
+ }
+ }
+
+ }
+ break;
+
+ }
+ name += stateStr;
+ }
+ break;
+ case "2":
+ {
+ //鐢╯id鎵惧埌鍦烘櫙锛�
+ var scene = LogicMethod.GetSecne(outputTarget.sid);
+ name += scene.name;
+
+ }
+ break;
+ }
+ }
+ catch { }
+ return name;
+ }
+ /// <summary>
+ /// 鏄熸湡int鍜宻tring浜掔浉杞崲鍊肩殑鏂规硶
+ /// </summary>
+ /// <param name="list"></param>
+ /// <param name="str_or_int"></param>
+ /// <returns></returns>
+ public static List<string> GetWeekString(List<string> list, string str_or_int)
+ {
+ string weekTextName = "";
+ List<string> stateList = new List<string>();
+ for (int i = 0; i < list.Count; i++)
+ {
+ var s = list[i];
+ if (str_or_int == "int")
+ {
+ switch (s)
+ {
+ case "1":
+ {
+ weekTextName = Language.StringByID(StringId.monday);
+ }
+ break;
+ case "2":
+ {
+ weekTextName = Language.StringByID(StringId.tuesday);
+ }
+ break;
+ case "3":
+ {
+ weekTextName = Language.StringByID(StringId.wednesday);
+ }
+ break;
+ case "4":
+ {
+ weekTextName = Language.StringByID(StringId.thursday);
+ }
+ break;
+ case "5":
+ {
+ weekTextName = Language.StringByID(StringId.friday);
+ }
+ break;
+ case "6":
+ {
+ weekTextName = Language.StringByID(StringId.saturday);
+ }
+ break;
+ case "0":
+ {
+ weekTextName = Language.StringByID(StringId.sunday);
+ }
+ break;
+ }
+
+ }
+ else
+ {
+ if (Language.StringByID(StringId.monday) == s)
+ {
+ weekTextName = "1";
+ }
+ else if (Language.StringByID(StringId.tuesday) == s)
+ {
+ weekTextName = "2";
+ }
+ else if (Language.StringByID(StringId.wednesday) == s)
+ {
+ weekTextName = "3";
+ }
+ else if (Language.StringByID(StringId.thursday) == s)
+ {
+ weekTextName = "4";
+ }
+ else if (Language.StringByID(StringId.friday) == s)
+ {
+ weekTextName = "5";
+ }
+ else if (Language.StringByID(StringId.saturday) == s)
+ {
+ weekTextName = "6";
+ }
+ else if (Language.StringByID(StringId.sunday) == s)
+ {
+ weekTextName = "0";
+ }
+ }
+ stateList.Add(weekTextName);
+
+ }
+
+ return stateList;
+ }
+
+ /// <summary>
+ /// 妯″紡/椋庨�熶簰鐩歌浆鎹㈠�肩殑鏂规硶
+ /// </summary>
+ /// <param name="text"></param>
+ /// <param name="type"></param>
+ /// <returns></returns>
+ public static string GetModeValueString(string text, string type)
+ {
+ string str = "";
+ switch (type)
+ {
+ case "mode":
+ {
+ if (text == Language.StringByID(StringId.coolLogic))
+ {
+ str = "cool";
+ }
+ else if (text == Language.StringByID(StringId.heatingLogic))
+ {
+ str = "heat";
+ }
+ else if (text == Language.StringByID(StringId.autoLogic))
+ {
+ str = "auto";
+ }
+ else if (text == Language.StringByID(StringId.dehumidifyLogic))
+ {
+ str = "dry";
+ }
+ }
+ break;
+ case "fan":
+ {
+ if (text == Language.StringByID(StringId.HighWindSpeed))
+ {
+ str = "high";
+ }
+ else if (text == Language.StringByID(StringId.MiddleWindSpeed))
+ {
+ str = "medium";
+ }
+ else if (text == Language.StringByID(StringId.LowWindSpeed))
+ {
+ str = "low";
+ }
+ else if (text == Language.StringByID(StringId.Auto))
+ {
+ str = "auto";
+ }
+ }
+ break;
+ case "FloorHeating":
+ {
+ if (text == Language.StringByID(StringId.dayMode))
+ {
+ str = "day";
+ }
+ else if (text == Language.StringByID(StringId.nightMode))
+ {
+ str = "night";
+ }
+ else if (text == Language.StringByID(StringId.leaveMode))
+ {
+ str = "away";
+ }
+ else if (text == Language.StringByID(StringId.ordinaryMode))
+ {
+ str = "normal";
+ }
+ else if (text == Language.StringByID(StringId.timeMode))
+ {
+ str = "timer";
+ }
+ }
+ break;
+ }
+ return str;
+ }
+ }
+}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index b5ba7b4..2497cbb 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -43,7 +43,7 @@
LogicView.SingleLogicView logicView = new LogicView.SingleLogicView();
vv.AddChidren(logicView.FLayoutView());
logicView.btnLogicName.Text = currLogic.name;
- logicView.btnWeekText.Text = GetWeekText(currLogic);
+ logicView.btnWeekText.Text = GetCyclicText(currLogic);
logicView.btnclick.MouseUpEventHandler += (sen, e) =>
{
Logic.currlogic = currLogic;
@@ -135,7 +135,7 @@
///杩斿洖寰幆鎻忚堪鏂囨湰
/// </summary>
/// <param name="logic"></param>
- public static string GetWeekText(Logic logic)
+ public static string GetCyclicText(Logic logic)
{
string weekName = "";
@@ -168,7 +168,7 @@
return weekName;
}
/// <summary>
- /// 鑾峰彇鏄熸湡鐨勫瓧绗︿覆
+ /// 杩斿洖鏄熸湡鎻忚堪鏂囨湰
/// </summary>
/// <param name="weekList"></param>
/// <returns></returns>
@@ -311,6 +311,12 @@
//2-鍔熻兘鍥炬爣
for (int i = 0; i < logic.input.Count; i++)
{
+ if (logic.input[i] == null)
+ {
+ //闃叉鏈夌殑绌哄璞★紱
+ //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+ continue;
+ }
var int1 = int.Parse(logic.input[i].condition_type);
int iconInt = 0;
@@ -347,6 +353,12 @@
//14-寤舵椂鍥炬爣
for (int i = 0; i < logic.output.Count; i++)
{
+ if (logic.output[i] == null)
+ {
+ //闃叉鏈夌殑绌哄璞★紱
+ //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+ continue;
+ }
var int1 = int.Parse(logic.output[i].target_type);
int iconInt = 0;
switch (int1)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index efd0aab..48bcd24 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -183,65 +183,28 @@
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
};
this.AddChidren(frame);
- LogicView.DateView modeView = new LogicView.DateView();
- modeView.btnTitle.TextID = StringId.modeLogic;
- modeView.FLayoutView(frame, modeStr.Count);
- modeView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
- {
- frame.RemoveFromParent();
- };
- ///瀹氫箟涓�涓狟tn璁板綍閫変腑鐘舵��
- Button checkBtn = new Button
- {
- Tag = "unknown",
- };
- for (int i = 0; i < modeStr.Count; i++)
- {
- LogicView.CheckView modeTypeView = new LogicView.CheckView();
- modeTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
- modeView.frameLayout.AddChidren(modeTypeView.FLayoutView());
- modeTypeView.btnText.Text = modeStr[i];
- modeTypeView.btnClick.Tag = modeStr[i];//鏍囪
- if (acModehView.btnState.Text == modeStr[i])
- {
- //鏄剧ず涔嬪墠鐨勯�変腑鐘舵��
- checkBtn.IsSelected = false;
- modeTypeView.btnCheckIcon.IsSelected = true;
- checkBtn = modeTypeView.btnCheckIcon;
- checkBtn.Tag = modeTypeView.btnClick.Tag.ToString();
- }
- //鏄熸湡鐨勭偣鍑讳簨浠�
- modeTypeView.btnClick.MouseUpEventHandler += (sender1, e1) =>
- {
- checkBtn.IsSelected = false;
- modeTypeView.btnCheckIcon.IsSelected = true;
- checkBtn = modeTypeView.btnCheckIcon;
- checkBtn.Tag = modeTypeView.btnClick.Tag.ToString();
- };
- }
- modeView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
- {
- if (checkBtn.Tag.ToString() == "unknown")
- {
- return;
- }
+ ///涔嬪墠鐨勭姸鎬佹枃鏈�
+ string currText = acModehView.btnState.Text;
+ PublicInterface modeView = new PublicInterface();
+ modeView.SingleSelectionShow(frame, modeStr, Language.StringByID(StringId.modeLogic), currText
+ , (stateValue) =>
+ {
+ string keyVlaue = "mode";
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ LogicMethod.dictionary(dic, "key", "mode");
+ LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "mode"));
+ AddDictionaryData(dicSateteList, keyVlaue, dic);
+ acModehView.btnState.Text = stateValue;
+ selectedState = device.functionType + "_mode";
- Dictionary<string, string> dic = new Dictionary<string, string>();
- LogicMethod.dictionary(dic, "key", "mode");
- string keyVlaue = "mode";
- LogicMethod.dictionary(dic, "value", GetModeValueString(checkBtn.Tag.ToString(), keyVlaue));
- acModehView.btnState.Text = checkBtn.Tag.ToString();
- selectedState = device.functionType + "_mode";
- AddDictionaryData(dicSateteList, keyVlaue, dic);
- RemView(frame);
- };
+ });
+
};
///椋庨�熺偣鍑讳簨浠�
acSpeedView.btnClick.MouseUpEventHandler += (sender, e) =>
{
-
List<string> speedStr = new List<string> {
Language.StringByID(StringId.LowWindSpeed),
Language.StringByID(StringId.MiddleWindSpeed),
@@ -253,60 +216,21 @@
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
};
this.AddChidren(frame);
- LogicView.DateView speedView = new LogicView.DateView();
- speedView.btnTitle.TextID = StringId.modeLogic;
- speedView.FLayoutView(frame, speedStr.Count);
- speedView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
- {
- frame.RemoveFromParent();
- };
- ///瀹氫箟涓�涓狟tn璁板綍閫変腑鐘舵��
- Button checkBtn = new Button
- {
- Tag = "unknown",
- };
- for (int i = 0; i < speedStr.Count; i++)
- {
- LogicView.CheckView speedTypeView = new LogicView.CheckView();
- speedTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
- speedView.frameLayout.AddChidren(speedTypeView.FLayoutView());
- speedTypeView.btnText.Text = speedStr[i];
- speedTypeView.btnClick.Tag = speedStr[i];//鏍囪
- if (acSpeedView.btnState.Text == speedStr[i])
- {
- //鏄剧ず涔嬪墠鐨勯�変腑鐘舵��
- checkBtn.IsSelected = false;
- speedTypeView.btnCheckIcon.IsSelected = true;
- checkBtn = speedTypeView.btnCheckIcon;
- checkBtn.Tag = speedTypeView.btnClick.Tag.ToString();
- }
- //鏄熸湡鐨勭偣鍑讳簨浠�
- speedTypeView.btnClick.MouseUpEventHandler += (sender1, e1) =>
- {
- checkBtn.IsSelected = false;
- speedTypeView.btnCheckIcon.IsSelected = true;
- checkBtn = speedTypeView.btnCheckIcon;
- checkBtn.Tag = speedTypeView.btnClick.Tag.ToString();
- };
-
- }
- speedView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
- {
- if (checkBtn.Tag.ToString() == "unknown")
- {
- return;
- }
-
- Dictionary<string, string> dic = new Dictionary<string, string>();
- LogicMethod.dictionary(dic, "key", "fan");
- string keyVlaue = "fan";
- LogicMethod.dictionary(dic, "value", GetModeValueString(checkBtn.Tag.ToString(), keyVlaue));
- acSpeedView.btnState.Text = checkBtn.Tag.ToString();
- selectedState = device.functionType + "_fan";
- AddDictionaryData(dicSateteList, keyVlaue, dic);
- RemView(frame);
- };
+ ///涔嬪墠鐨勭姸鎬佹枃鏈�
+ string currText = acSpeedView.btnState.Text;
+ PublicInterface modeView = new PublicInterface();
+ modeView.SingleSelectionShow(frame, speedStr, Language.StringByID(StringId.speedLogic), currText
+ , (stateValue) =>
+ {
+ string keyVlaue = "fan";
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ LogicMethod.dictionary(dic, "key", "fan");
+ LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "fan"));
+ AddDictionaryData(dicSateteList, keyVlaue, dic);
+ acSpeedView.btnState.Text = stateValue;
+ selectedState = device.functionType + "_fan";
+ });
};
if (edit)
{
@@ -434,7 +358,7 @@
string keyVlaue = "mode";
Dictionary<string, string> dic = new Dictionary<string, string>();
LogicMethod.dictionary(dic, "key", "mode");
- LogicMethod.dictionary(dic, "value", GetModeValueString(stateValue, "FloorHeating"));
+ LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "FloorHeating"));
AddDictionaryData(dicSateteList, keyVlaue, dic);
floorHeatingModehView.btnState.Text = stateValue;
selectedState = device.functionType + "_mode";
@@ -452,7 +376,7 @@
}
#endregion
- #region 淇濆瓨鐐瑰嚮鏃堕棿
+ #region 淇濆瓨鐐瑰嚮浜嬩欢
saveView.btnClick.MouseUpEventHandler += (sen, e) =>
{
@@ -462,7 +386,6 @@
Output outputDevice = new Output();
outputDevice.target_type = "1";
outputDevice.sid = device.sid;
-
switch (device.functionType)
{
case FunctionType.Dimmer:
@@ -557,84 +480,7 @@
#endregion
}
- /// <summary>
- /// 鑾峰彇妯″紡/椋庨�熼敭鍊�
- /// </summary>
- /// <param name="text"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- private string GetModeValueString(string text, string type)
- {
- string str = "";
- switch (type)
- {
- case "mode":
- {
- if (text == Language.StringByID(StringId.coolLogic))
- {
- str = "cool";
- }
- else if (text == Language.StringByID(StringId.heatingLogic))
- {
- str = "heat";
- }
- else if (text == Language.StringByID(StringId.autoLogic))
- {
- str = "auto";
- }
- else if (text == Language.StringByID(StringId.dehumidifyLogic))
- {
- str = "dry";
- }
- }
- break;
- case "fan":
- {
- if (text == Language.StringByID(StringId.HighWindSpeed))
- {
- str = "high";
- }
- else if (text == Language.StringByID(StringId.MiddleWindSpeed))
- {
- str = "medium";
- }
- else if (text == Language.StringByID(StringId.LowWindSpeed))
- {
- str = "low";
- }
- else if (text == Language.StringByID(StringId.Auto))
- {
- str = "auto";
- }
- }
- break;
- case "FloorHeating":
- {
- if (text == Language.StringByID(StringId.dayMode))
- {
- str = "day";
- }
- else if (text == Language.StringByID(StringId.nightMode))
- {
- str = "night";
- }
- else if (text == Language.StringByID(StringId.leaveMode))
- {
- str = "away";
- }
- else if (text == Language.StringByID(StringId.ordinaryMode))
- {
- str = "normal";
- }
- else if (text == Language.StringByID(StringId.timeMode))
- {
- str = "timer";
- }
- }
- break;
- }
- return str;
- }
+
/// <summary>
///寮�鍏�=鐣岄潰
/// </summary>
@@ -799,14 +645,6 @@
}
/// <summary>
- /// 绉婚櫎鎺т欢
- /// </summary>
- /// <param name="frame"></param>
- private void RemView(FrameLayout frame)
- {
- frame.RemoveFromParent();
- }
- /// <summary>
/// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
/// </summary>
/// <param name="device">缂栬緫璁惧</param>
@@ -826,256 +664,7 @@
//鏈夋暟鎹噸鏂拌祴鍊�
dicSateteList = dicList;
}
- switch (device.functionType)
- {
- //寮�鍏崇伅鍏�
- case FunctionType.Relay:
- {
- 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 FunctionType.Dimmer:
- case FunctionType.RGB:
- case FunctionType.RGBW:
- case FunctionType.ColorTemperature:
- {
- foreach (var dic in dicList)
- {
- string value = dic["value"];
- switch (dic["key"])
- {
- case "on_off":
- {
- if (value == "on")
- {
- button1.Text = Language.StringByID(StringId.onLogic);
- }
- else
- {
- button1.Text = Language.StringByID(StringId.offLogic);
- }
- }
- break;
- case "brightness":
- {
-
- button2.Text = value+"%";
- }
- break;
- }
-
- }
- }
- break;
- case FunctionType.Curtain:
- case FunctionType.MotorCurtain:
- case FunctionType.RollingShutter:
- {
- foreach (var dic in dicList)
- {
- string value = dic["value"];
- switch (value)
- {
- case "on":
- {
- button1.Text = Language.StringByID(StringId.onLogic);
- }
- break;
- case "off":
- {
- button1.Text = Language.StringByID(StringId.offLogic);
- }
- break;
- case "stop":
- {
- button1.Text = Language.StringByID(StringId.stop);
- }
- break;
- }
- }
- }
- break;
- case FunctionType.AC:
- {
- 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 "set_temp":
- {
- button2.Text = value + "鈩�";
- }
- break;
- case "mode":
- {
- switch (value)
- {
- case "cool":
- {
- button3.Text = Language.StringByID(StringId.coolLogic);
- }
- break;
- case "heat":
- {
- button3.Text = Language.StringByID(StringId.heatingLogic);
- }
- break;
- case "auto":
- {
- button3.Text = Language.StringByID(StringId.autoLogic);
- }
- break;
- case "dry":
- {
- button3.Text = Language.StringByID(StringId.dehumidifyLogic);
- }
- break;
- }
-
-
-
- }
- break;
- case "fan":
- {
- switch (value)
- {
- case "high":
- {
- button4.Text = Language.StringByID(StringId.HighWindSpeed);
- }
- break;
- case "medium":
- {
- button4.Text = Language.StringByID(StringId.MiddleWindSpeed);
- }
- break;
- case "low":
- {
- button4.Text = Language.StringByID(StringId.LowWindSpeed);
- }
- break;
- case "auto":
- {
- button4.Text = Language.StringByID(StringId.Auto);
- }
- break;
- }
-
-
- }
- break;
-
-
- }
-
- }
-
- }
- break;
- case FunctionType.FloorHeating:
- {
-
- 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 "set_temp":
- {
- button2.Text = value + "鈩�";
- }
- break;
- case "mode":
- {
- switch (value)
- {
- case "day":
- {
- button3.Text = Language.StringByID(StringId.dayMode);
- }
- break;
- case "night":
- {
- button3.Text = Language.StringByID(StringId.nightMode);
- }
- break;
-
- case "away":
- {
- button3.Text = Language.StringByID(StringId.leaveMode);
- }
- break;
- case "normal":
- {
- button3.Text = Language.StringByID(StringId.ordinaryMode);
- }
- break;
- case "timer":
- {
- button3.Text = Language.StringByID(StringId.timeMode);
- }
- break;
- }
-
-
-
- }
- break;
-
- }
-
- }
-
- }
- break;
- }
+ InpOrOutLogicMethod.EditState(device, dicList, button1, button2, button3, button4);
}
/// <summary>
/// 娣诲姞澶勭悊閫変腑鏁版嵁
@@ -1139,6 +728,14 @@
}
}
+ /// <summary>
+ /// 绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="frame"></param>
+ private void RemView(FrameLayout frame)
+ {
+ frame.RemoveFromParent();
+ }
}
--
Gitblit v1.8.0