From e64dd8689cf4bdf812b43a2f02e51c2100bedd02 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 27 四月 2021 19:06:15 +0800
Subject: [PATCH] 2021-4-27-1
---
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 123 ++++++++++++++++++++++++++--------------
1 files changed, 80 insertions(+), 43 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index 9a56c61..9113330 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -46,11 +46,12 @@
logicView.btnWeekText.Text = GetCyclicText(currLogic);
logicView.btnclick.MouseUpEventHandler += (sen, e) =>
{
- Logic.currlogic = currLogic;
- var addLogic = new AddLogic();
- MainPage.BasePageView.AddChidren(addLogic);
- addLogic.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ //Logic.currlogic = currLogic;
+ //var addLogic = new AddLogic();
+ //MainPage.BasePageView.AddChidren(addLogic);
+ //addLogic.Show();
+ //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ new MainView { }.SkipAddLogicPage(currLogic);
};
//寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢
logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) =>
@@ -123,13 +124,30 @@
/// <summary>
/// 鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉�
/// </summary>
- public void SkipAddLogicPage()
+ public void SkipAddLogicPage(Logic logic=null)
{
- Logic.currlogic = new Logic();
- var addLogic = new AddLogic();
- MainPage.BasePageView.AddChidren(addLogic);
- addLogic.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ if (logic == null)
+ {
+ Logic.currlogic = new Logic();
+ }
+ else {
+ Logic.currlogic = logic;
+ }
+ if (IsGatewayType)
+ {
+ 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;
+ }
}
/// <summary>
///杩斿洖寰幆鎻忚堪鏂囨湰
@@ -209,7 +227,6 @@
}
return weekTextName.TrimEnd(',');
}
-
/// <summary>
/// 鑾峰彇姣忔湀鐨勫瓧绗︿覆
/// </summary>
@@ -262,6 +279,7 @@
var jay = jArray[a];
//鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+ Console.WriteLine("鑾峰彇閫昏緫==="+str);
var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
if (logic != null)
{
@@ -270,37 +288,38 @@
if (if_logic == null)
{
- Logic newlogic = new Logic();
- newlogic.name = logic.name;
- newlogic.userLogicId = logic.userLogicId;
- newlogic.sid = logic.sid;
- newlogic.relation = logic.relation;
- newlogic.enable = logic.enable;
- newlogic.cycle = logic.cycle;
- for (int i = 0; i < logic.input.Count; i++)
- {
- if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type))
- {
- //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
- //闃叉鏈夌┖瀵硅薄锛�
- //姝e父鎯呭喌涓嬩笉浼氬嚭鐜扮殑鐜拌薄锛�
- continue;
- }
- newlogic.input.Add(logic.input[i]);
- }
- for (int i = 0; i < logic.output.Count; i++)
- {
- if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type))
- {
- //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
- //闃叉鏈夌┖瀵硅薄锛�
- //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
- continue;
- }
- newlogic.output.Add(logic.output[i]);
- }
+ //Logic newlogic = new Logic();
+ //newlogic.name = logic.name;
+ //newlogic.userLogicId = logic.userLogicId;
+ //newlogic.sid = logic.sid;
+ //newlogic.relation = logic.relation;
+ //newlogic.enable = logic.enable;
+ //newlogic.cycle = logic.cycle;
+ //for (int i = 0; i < logic.input.Count; i++)
+ //{
+ // if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type))
+ // {
+ // //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
+ // //闃叉鏈夌┖瀵硅薄锛�
+ // //姝e父鎯呭喌涓嬩笉浼氬嚭鐜扮殑鐜拌薄锛�
+ // continue;
+ // }
+ // newlogic.input.Add(logic.input[i]);
+ //}
+ //for (int i = 0; i < logic.output.Count; i++)
+ //{
+ // if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type))
+ // {
+ // //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
+ // //闃叉鏈夌┖瀵硅薄锛�
+ // //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+ // continue;
+ // }
+ // newlogic.output.Add(logic.output[i]);
+ //}
+
//娣诲姞閫昏緫
- Logic.LogicList.Add(newlogic);
+ Logic.LogicList.Add(logic);
}
}
@@ -323,7 +342,6 @@
}
return false;
}
-
/// <summary>
/// 鏄剧ず鏉′欢鎴栬�呯洰鏍囩被鍨嬪浘鏍�
/// </summary>
@@ -477,6 +495,25 @@
btnIcon.UnSelectedImagePath = strIcon;
}
}
+ /// <summary>
+ /// 鍒ゆ柇缃戝叧绫诲瀷
+ /// </summary>
+ /// <returns></returns>
+ public static bool IsGatewayType
+ {
+ get
+ {
+ if (Entity.DB_ResidenceData.Instance.GatewayType == 1)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+
+ }
+ }
+ }
}
class LogicData
{
--
Gitblit v1.8.0