From 94e4e5b9fd3da964c44b7b14227d6fe2bbb426d7 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 13:56:39 +0800
Subject: [PATCH] 2020-04-02-2

---
 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs |  111 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 89 insertions(+), 22 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
old mode 100755
new mode 100644
index db4d658..ee8afb3
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -91,47 +91,53 @@
         /// <summary>
         /// 鎺掑垪鎵�鏈夎澶囩被鍨嬬殑鍒楄〃
         /// </summary>
-        /// <param name="type">鍒ゆ柇瀛楃涓�</param>
         /// <param name="devicelist">璁惧鍒楄〃</param>
         /// <returns></returns>
-        public static List<string> GetDeviceTypeList(string type, List<CommonDevice> devicelist)
+        public static List<string> GetDeviceTypeList(List<CommonDevice> devicelist)
         {
             List<string> devicetypelist = new List<string>();
             devicetypelist.Clear();
-            var lightjosn = devicelist.Find((device) => device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.OnOffOutput);
+
+            var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput);
             if (lightjosn != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights));
             }
-            var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor);
-            if (iASZonejosn != null)
-            {
-                devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor));
-            }
-            var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch);
-            if (onOffSwitchjson != null)
-            {
-                devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch));
-            }
-            var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock);
-            if (doorLock != null)
-            {
-                devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock));
-            }
+
             var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice);
             if (curtainjosn != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains));
             }
+
             var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat);
             if (ac != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC));
             }
+
+            var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch);
+            if (onOffSwitchjson != null)
+            {
+                devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch));
+            }
+
+            var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock);
+            if (doorLock != null)
+            {
+                devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock));
+            }
+
             var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch);
             if (airSwitch != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch));
+            }
+
+            var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor);
+            if (iASZonejosn != null)
+            {
+                devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor));
             }
 
             return devicetypelist;
@@ -326,12 +332,16 @@
                     }
                     break;
                 case "action_logic":
-                    { //鑷姩鍖栨敮鎸佺殑鐩爣璁惧
+                    {
+
+                        //鑷姩鍖栨敮鎸佺殑鐩爣璁惧
                         deviceTypeList.Add(DeviceType.OnOffOutput);
                         deviceTypeList.Add(DeviceType.DimmableLight);
                         deviceTypeList.Add(DeviceType.WindowCoveringDevice);
                         deviceTypeList.Add(DeviceType.Thermostat);
                         deviceTypeList.Add(DeviceType.AirSwitch);
+                        ///闂ㄩ攣鐗规畩
+                       // deviceTypeList.Add(DeviceType.DoorLock);
                     }
                     break;
                 case "condition_mould":
@@ -352,6 +362,8 @@
                         deviceTypeList.Add(DeviceType.WindowCoveringDevice);
                         deviceTypeList.Add(DeviceType.Thermostat);
                         deviceTypeList.Add(DeviceType.AirSwitch);
+                        ///闂ㄩ攣鐗规畩
+                      // deviceTypeList.Add(DeviceType.DoorLock);
                     }
                     break;
 
@@ -649,6 +661,7 @@
             custompushview.iconBtn.Visible = true;
             custompushview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png";
             custompushview.titleBtn.TextID = MyInternationalizationString.custompush;
+            custompushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
             middle.AddChidren(custompushview.AddDeviceView());
 
             EventHandler<MouseEventArgs> customclick = (sender, e) =>
@@ -669,6 +682,7 @@
                     LogicView.IfString.Tag = true;
                     custompushview.frameLayout.Height = Application.GetRealHeight(160);
                     Common.Logic.CurrentLogic.LogicIsCustomPushText = 1;
+                    pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor;
 
                 }
                 else
@@ -676,6 +690,7 @@
                     LogicView.IfString.Tag = false;
                     custompushview.frameLayout.Height = Application.GetRealHeight(0);
                     Common.Logic.CurrentLogic.LogicIsCustomPushText = 0;
+                    pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
                 }
                 Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic);
             };
@@ -685,12 +700,14 @@
                 LogicView.IfString.Tag = false;
                 pushview.switchBtn.IsSelected = false;
                 custompushview.frameLayout.Height = Application.GetRealHeight(0);
+                pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
             }
             else
             {
                 LogicView.IfString.Tag = true;
                 pushview.switchBtn.IsSelected = true;
                 custompushview.frameLayout.Height = Application.GetRealHeight(160);
+                pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor;
             }
         }
         /// <summary>
@@ -702,6 +719,16 @@
         /// <param name="CurrentLogic">褰撳墠閫昏緫</param>
         public async static void SaveLogic(string if_logic, string name, bool tag, Common.Logic CurrentLogic)
         {
+
+            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,
@@ -730,7 +757,17 @@
                 {
                     succeed = true;
                     CurrentLogic.LogicId = logicifon.LogicId;
-                    Common.Logic.LogicList.Add(CurrentLogic);
+                    if (LogicView.IfString._LockLogic == if_logic)
+                    {
+                        //闂ㄩ攣鑱斿姩浜嬩欢閫昏緫鍒楄〃
+                        Common.Logic.LockLogicList.Add(CurrentLogic);
+                    }
+                    else
+                    {
+                        //鑷姩鍖栭�昏緫鍒楄〃
+                        Common.Logic.LogicList.Add(CurrentLogic);
+
+                    }
                     if (tag)
                     {
                         Send.Zj(tag, CurrentLogic);
@@ -755,13 +792,29 @@
                 //TipView("娣诲姞鑷姩鍖栧け璐�");
                 //return;
             }
-            UserView.HomePage.Instance.RemoveViewByTag("Logic");
+          
+
             if (LogicView.IfString._Logic == if_logic)
             {
-                Category.Category.instance?.RefreshBodyView();
+                UserView.HomePage.Instance.RemoveViewByTag("Logic");
+                if (CurrentLogic.LogicType == 0)
+                {
+                    //鍙埛鏂板垎绫讳笂涓嬫粦鍔╲iew锛�
+                    Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
+                    // Category.Category.instance?.RefreshBodyView();
+                }
+                else if (CurrentLogic.LogicType == 2)
+                {
+                    //鍒锋柊鏁翠釜鍒嗙被锛�
+                    //闂ㄩ攣甯稿紑妯″紡鐗规畩;
+                    UserView.UserPage.Instance.ShowCategoryAutoListForm();
+
+                }
             }
             else if (LogicView.IfString._LockLogic == if_logic)
             {
+                UserView.HomePage.Instance.RemoveViewByTag("Logic");//绉婚櫎鎵�鏈夋爣璁癓ogic鐣岄潰
+                UserView.HomePage.Instance.RemoveViewByTag("LockListView");//绉婚櫎鎵�鏈夋爣璁癓ockListView鐣岄潰
                 var doorLockLogicList = new DoorLockLogic.LockLogicList();
                 UserView.HomePage.Instance.AddChidren(doorLockLogicList);
                 UserView.HomePage.Instance.PageIndex += 1;
@@ -769,6 +822,20 @@
             }
 
         }
+        /// <summary>
+        /// 璺冲叆杈撳嚭鐩爣鍔熻兘鐣岄潰鐨勬柟娉�
+        /// </summary>
+        /// <param name="str1">璁惧鐣岄潰璇嗗埆瀛楃涓�</param>
+        /// <param name="str2">鍦烘櫙鐣岄潰璇嗗埆瀛楃涓�</param>
+        public static void View(string str1, string str2)
+        {
+            var deviceTarget = new DeviceTarget();
+            UserView.HomePage.Instance.AddChidren(deviceTarget);
+            UserView.HomePage.Instance.PageIndex += 1;
+            deviceTarget.Show(str1, str2);
+        }
+
+        
 
     }
 }

--
Gitblit v1.8.0