From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs |  168 +++++++++++++++++++++++++++++++------------------------
 1 files changed, 95 insertions(+), 73 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
index 4e0ee88..23ba748 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
@@ -10,6 +10,7 @@
 {
     public class SkipView:FrameLayout
     {
+        
         /// <summary>
         /// 鍏跺畠鐣岄潰璺宠繘鏉ョ殑鍏ュ彛
         /// </summary>
@@ -20,7 +21,6 @@
             {
                 case 0:
                     {
-
                         //new涓�涓柊閫昏緫瀵硅薄锛�
                         //鏂板姝e父鑷姩鍖栧叆鍙�
                         Common.Logic.CurrentLogic = new Common.Logic();
@@ -31,7 +31,6 @@
                         UserView.HomePage.Instance.AddChidren(addLogicPage);
                         UserView.HomePage.Instance.PageIndex += 1;
                         addLogicPage.Show();
-
                     }
                     break;
                 case 1:
@@ -65,9 +64,8 @@
             }
 
         }
-
-       
         #region 鈼� 鑷姩鍖朹_________________________
+        public static bool If_once = true;//杩涙潵鍙涓�娆℃爣璇�;
         /// <summary>
         /// 鑷姩鍖栧姛鑳戒唬鐮佸叆鍙�
         /// </summary>
@@ -76,6 +74,19 @@
             //functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
             #region   ---鎺ㄨ崘妯℃澘鐨勭粍浠�
             //鎺ㄨ崘妯℃澘鑳屾櫙鎺т欢
+          
+           
+            var bjFrameLayout1 = new FrameLayout
+            {
+                Width = Application.GetRealWidth(1080 - 58),
+                Height = Application.GetRealHeight(50),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                X = Application.GetRealWidth(58),
+                //Radius = (uint)Application.GetRealHeight(50),
+                Y = Application.GetRealHeight(30),
+
+            };
+            functionSceneAutoBodyView.AddChidren(bjFrameLayout1);
             var bjFrameLayout = new FrameLayout
             {
                 Width = Application.GetRealWidth(1080 - 58),
@@ -84,15 +95,15 @@
                 X = Application.GetRealWidth(58),
                 //Radius = (uint)Application.GetRealHeight(50),
                 Y = Application.GetRealHeight(30),
-
             };
             functionSceneAutoBodyView.AddChidren(bjFrameLayout);
-            bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft);
+            bjFrameLayout1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft);
+            bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerBottomLeft);
             //鍥炬爣鎺т欢
             var sigBtn = new Button
             {
-                Width = Application.GetMinRealAverage(84),
-                Height = Application.GetMinRealAverage(84),
+                Width = Application.GetRealWidth(84),
+                Height = Application.GetRealWidth(84),
                 UnSelectedImagePath = "ZigeeLogic/sign.png",
                 X = Application.GetRealWidth(58),
                 Gravity = Gravity.CenterVertical,
@@ -101,8 +112,8 @@
             //鎺ㄨ崘妯℃澘鏂囨湰鎺т欢
             var recommendtextBtn = new Button
             {
-                Width = Application.GetMinRealAverage(300),
-                Height = Application.GetMinRealAverage(84),
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(84),
                 X = sigBtn.Right + Application.GetRealWidth(35),
                 TextAlignment = TextAlignment.CenterLeft,
                 //Text = "鎺ㄨ崘妯℃澘",
@@ -116,7 +127,7 @@
             var recommendswitchBtn = new Button
             {
                 Width = Application.GetRealWidth(104),
-                Height = Application.GetRealHeight(63),
+                Height = Application.GetRealWidth(63),
                 UnSelectedImagePath = "ZigeeLogic/logicclose.png",
                 SelectedImagePath = "ZigeeLogic/logicopen.png",
                 X = bjFrameLayout.Width - Application.GetRealWidth(104 + 58),
@@ -161,14 +172,14 @@
 
                         var frameLayout = new FrameLayout
                         {
-                            Width = Application.GetMinRealAverage(369 + 46),
-                            Height = Application.GetMinRealAverage(246),
+                            Width = Application.GetRealWidth(369 + 46),
+                            Height = Application.GetRealHeight(246),
                         };
                         scenehorizontalScrol.AddChidren(frameLayout);
                         var logiciocnBtn = new Button
                         {
-                            Width = Application.GetMinRealAverage(369),
-                            Height = Application.GetMinRealAverage(246),
+                            Width = Application.GetRealWidth(369),
+                            Height = Application.GetRealWidth(246),
                             UnSelectedImagePath = "ZigeeLogic/" + i + ".png",
                             Tag = i,
                         };
@@ -176,8 +187,8 @@
 
                         var logicnameBtn = new Button
                         {
-                            Width = Application.GetMinRealAverage(250),
-                            Height = Application.GetMinRealAverage(80),
+                            Width = Application.GetRealWidth(250),
+                            Height = Application.GetRealHeight(80),
                             X = Application.GetRealWidth(23),
                             Y = Application.GetRealHeight(246 - 23 - 80),
                             TextAlignment = TextAlignment.CenterLeft,
@@ -241,10 +252,11 @@
             };
             //涓嬫媺鍒锋柊鑷姩鍖栧垪琛ㄧ殑浜嬩欢
             logicScrolView.BeginHeaderRefreshingAction += () =>
-            {
+            {
                 if (!Config.Instance.Home.IsVirtually)
                 {//铏氭嫙鐨勪笉鑾峰彇缃戝叧閫昏緫鍒楄〃
-                    //閲嶆柊鍒锋柊logic鍒楄〃
+                 //閲嶆柊鍒锋柊logic鍒楄〃
+                    If_once = true;
                     Common.Logic.LogicList.Clear();
                     Read(logicScrolView, no);
                 }
@@ -275,35 +287,40 @@
             {
                 if (!Config.Instance.Home.IsVirtually)//铏氭嫙鐨勪笉鑾峰彇缃戝叧閫昏緫鍒楄〃
                 {
-                    if (Common.Logic.LogicList.Count == 0)
+                    if (If_once)
                     {
-                        var Idlist1 = await Send.GetLogicId(0);//
-                        var Idlist2 = await Send.GetLogicId(2);//闂ㄩ攣甯稿紑妯″紡
-                        if (Idlist1.Count != 0)
+                        if (Common.Logic.LogicList.Count == 0)
                         {
-                            var listlogic1 = await Send.ReadList(Idlist1.Count, 0);
-                            for (int j = 0; j < listlogic1.Count; j++)
+                            If_once = false;
+                            var Idlist1 = await Send.GetLogicId(0);//
+                            var Idlist2 = await Send.GetLogicId(2);//闂ㄩ攣甯稿紑妯″紡
+                            if (Idlist1.Count != 0)
                             {
-                                var logic = listlogic1[j];
-                                if (logic.LogicType != 0)
+                                var listlogic1 = await Send.ReadList(Idlist1.Count, 0);
+                                for (int j = 0; j < listlogic1.Count; j++)
                                 {
-                                    continue;
+                                    var logic = listlogic1[j];
+                                    if (logic.LogicType != 0)
+                                    {
+                                        continue;
+                                    }
+                                    Common.Logic.LogicList.Add(logic);
                                 }
-                                Common.Logic.LogicList.Add(logic);
                             }
-                        }
-                        if (Idlist2.Count != 0)
-                        {
-                            var listlogic2 = await Send.ReadList(Idlist2.Count, 2);
-                            for (int j = 0; j < listlogic2.Count; j++)
+                            if (Idlist2.Count != 0)
                             {
-                                var logic = listlogic2[j];
-                                if (logic.LogicType != 2)
+                                var listlogic2 = await Send.ReadList(Idlist2.Count, 2);
+                                for (int j = 0; j < listlogic2.Count; j++)
                                 {
-                                    continue;
+                                    var logic = listlogic2[j];
+                                    if (logic.LogicType != 2)
+                                    {
+                                        continue;
+                                    }
+                                    Common.Logic.LogicList.Add(logic);
                                 }
-                                Common.Logic.LogicList.Add(logic);
                             }
+
                         }
                     }
                 }
@@ -317,6 +334,7 @@
             CommonPage.Loading.Hide();
         }
         static RowLayout selectedRow = new RowLayout() { Tag = "0" };//璁板綍宸︽粦鐘舵��
+       
         /// <summary>
         /// 鍔犺浇鑷姩鍖栧垪琛ㄧ晫闈�
         /// </summary>
@@ -340,8 +358,8 @@
                 var noIconBtn = new Button
                 {
                     Y = Application.GetRealHeight(294 - 55),
-                    Width = Application.GetMinRealAverage(757),
-                    Height = Application.GetMinRealAverage(435),
+                    Width = Application.GetRealWidth(757),
+                    Height = Application.GetRealWidth(435),
                     UnSelectedImagePath = "Item/NoFunction.png",
                     X = Application.GetRealWidth(104),
                 };
@@ -430,8 +448,8 @@
 
                 var logicswitchBtn = new Button
                 {
-                    Width = Application.GetMinRealAverage(104),
-                    Height = Application.GetMinRealAverage(63),
+                    Width = Application.GetRealWidth(104),
+                    Height = Application.GetRealWidth(63),
                     UnSelectedImagePath = "ZigeeLogic/logicclose.png",
                     SelectedImagePath = "ZigeeLogic/logicopen.png",
                     X = logicRowlayout.Width - Application.GetRealWidth(104 + 58),
@@ -512,7 +530,7 @@
                 logicRowlayout.AddRightView(del);
                 del.MouseUpEventHandler += (sender, e) =>
                 {
-                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                    var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm,
                     Language.StringByID(MyInternationalizationString.doyouwanttodelete),
                     Language.StringByID(MyInternationalizationString.confrim));
                     alert.Show();
@@ -609,8 +627,8 @@
 
                 var typeIconBtn = new Button
                 {
-                    Width = Application.GetMinRealAverage(58),
-                    Height = Application.GetMinRealAverage(58),
+                    Width = Application.GetRealWidth(58),
+                    Height = Application.GetRealWidth(58),
                     Gravity = Gravity.Center,
 
                 };
@@ -621,7 +639,7 @@
                     Y = typebjBtn.Y + Application.GetRealHeight(35),
                     X = Application.GetRealWidth(58) + Application.GetRealWidth((12 + 82 + 12) + (12 + 45 + 82 + 12) * i),
                     Width = Application.GetRealWidth(48),
-                    Height = Application.GetRealHeight(15),
+                    Height = Application.GetRealWidth(15),
                     UnSelectedImagePath = "ZigeeLogic/connect.png",
                 };
                 logicRowlayout.AddChidren(connectIconBtn);
@@ -717,15 +735,15 @@
             timeConditionsInfo.Add("EnDelay", "0");
             timeConditionsInfo.Add("DelayTime", "0");
             timeConditionsInfo.Add("StartHour", h);
-            timeConditionsInfo.Add("StartMin", m);
-            if (UserCenter.UserCenterResourse.HideOption.DoorLockNomallyOpenTimeMode == 1)
-            {
-                //寮哄埗鍙樻洿鏃堕棿妯″紡涓哄垎閽�
-                timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 60).ToString());
+            timeConditionsInfo.Add("StartMin", m);
+            if (UserCenter.UserCenterResourse.HideOption.DoorLockNomallyOpenTimeMode == 1)
+            {
+                //寮哄埗鍙樻洿鏃堕棿妯″紡涓哄垎閽�
+                timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 60).ToString());
             }
-            else
-            {
-                timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 3600).ToString());
+            else
+            {
+                timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 3600).ToString());
             }
             Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
             actionsInfo.Add("LinkType", 8);
@@ -764,37 +782,32 @@
         /// </summary>
         public static async System.Threading.Tasks.Task<int> Exist(int valueInt, ZigBee.Device.DoorLock doorLock)
         {
+            
             int exist = 0;
-            var Idlist = await Send.GetLogicId(valueInt);
-            if (Idlist.Count != 0)
+            var IdList = await Send.GetLogicId(valueInt);
+            if (IdList.Count != 0)
             {
-                //榛樿鍙栫涓�涓�昏緫ID
-                var id = Idlist[0];
-                if (valueInt != 3)
+                for (int i = 0; i < IdList.Count; i++)
                 {
-                    exist = id;
-                }
-                else
-                {
-                    var logic = await Send.GetLogic(id, 3);
+                    var id = IdList[i];
+                    var logic = await Send.GetLogic(id, valueInt);
                     if (logic != null)
                     {
                         if (ExistLogic(logic, doorLock))
                         {
                             exist = id;
-                        }
-                        else
-                        {
-                            exist = 0;
+                            ///鎵惧埌閫�鍑�
+                            break;
                         }
                     }
+
                 }
             }
             return exist;
         }
 
         ///<summary>
-        ///鑾峰彇闂ㄩ攣閫昏緫淇℃伅
+        ///鑾峰彇闂ㄩ攣鏃舵晥鎬ч�昏緫淇℃伅
         /// 杩斿洖鍊硷細null涓嶅瓨鍦�;鍏跺畠鍊奸兘瀛樺湪;
         /// </summary>
         public static async System.Threading.Tasks.Task<Common.Logic> GetLogicIfon(ZigBee.Device.DoorLock doorLock)
@@ -818,14 +831,12 @@
         ///鍒犻櫎璇ラ棬閿佹墍鏈夋椂鏁堟�ц嚜鍔ㄥ寲
         /// 杩斿洖鍊硷細true鎴愬姛;false澶辫触;
         /// </summary>
-        public static async System.Threading.Tasks.Task<bool> GetLogicAll(ZigBee.Device.DoorLock doorLock)
+        public static async System.Threading.Tasks.Task<bool> DelAllLogic(ZigBee.Device.DoorLock doorLock)
         {
             bool _if = false;
             var Idlist = await Send.GetLogicId(3);
             if (Idlist.Count != 0)
             {
-                _if = true;
-
                 for (int i = 0; i < Idlist.Count; i++)
                 {
                     int id = Idlist[i];
@@ -836,7 +847,16 @@
                         {
                             //鏈潵鍙湁涓�鏉℃椂鏁堟�ц嚜鍔ㄥ寲锛�
                             //闃叉鐗规畩鎯呭喌,鎵惧埌灏卞垹闄ゆ帀;
+                            //var valueInt = await Send.DelLogic(id);
+                            //if (valueInt == 0)
+                            //{
+                            //    _if = true;
+                            //}
+                            //(鑰冭檻鎬ц兘榛樿鍒犻櫎鎴愬姛锛岀洿鎺ヨ繑鍥炴垚鍔熺粨鏋渢rue)
+                            _if = true;
                             Send.DelLogic(id);
+                           
+
                         }
                     }
                 }
@@ -852,7 +872,7 @@
         {
             for (int j = 0; j < logic.Accounts.Count; j++)
             {
-                //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱
+                //Option4鏄澶噈ac锛�
                 if (logic.Accounts[j]["Option4"].ToString() == doorLock.DeviceAddr)
                 {
                     //鏌ユ壘鏄惁鏄偅涓棬閿侊紱
@@ -864,6 +884,8 @@
             return false;
         }
 
+  
+
     }
 }
 

--
Gitblit v1.8.0