From eed381ca472abb06e386281e604569ebf80bbfe3 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 26 三月 2020 17:51:41 +0800
Subject: [PATCH] 2020-03-26

---
 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
index 354f6bd..2a048de 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -719,9 +719,16 @@
         /// <param name="CurrentLogic">褰撳墠閫昏緫</param>
         public async static void SaveLogic(string if_logic, string name, bool tag, Common.Logic CurrentLogic)
         {
-            //璁板綍閫昏緫绫诲瀷
-            //鍙槸瀵硅烦杞晫闈㈡湁鐢紝鍩烘湰娌″暐鐢�
-            int Type = CurrentLogic.LogicType;
+
+            if (CurrentLogic.Conditions.Count == 0 || CurrentLogic.Actions.Count == 0)
+            {
+                var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+                  Language.StringByID(MyInternationalizationString.addnull),
+                  Language.StringByID(MyInternationalizationString.confrim));
+                alert.Show();
+                return;
+            }
+
             if (string.IsNullOrEmpty(name))
             {
                 var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
@@ -779,7 +786,7 @@
 
             if (LogicView.IfString._Logic == if_logic)
             {
-                if (Type == 0)
+                if (CurrentLogic.LogicType == 0)
                 {
                    
                     UserView.HomePage.Instance.RemoveViewByTag("Logic");
@@ -787,7 +794,7 @@
                     Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
                     // Category.Category.instance?.RefreshBodyView();
                 }
-                else if (Type == 2)
+                else if (CurrentLogic.LogicType == 2)
                 {
                     //鍒锋柊鏁翠釜鍒嗙被锛�
                     //闂ㄩ攣甯稿紑妯″紡鐗规畩;

--
Gitblit v1.8.0