From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28

---
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs |  585 ++++++++++++++++------------------------------------------
 1 files changed, 164 insertions(+), 421 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
index df7d67c..f594023 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -7,18 +7,18 @@
 using Shared.R;
 using ZigBee.Device;
 
-namespace Shared.Phone.Logic.DoorLockLogic
+namespace Shared.Phone.Device.Logic.DoorLockLogic
 {
     public class LockLogicCommunalPage : FrameLayout
     {
 
         public LockLogicCommunalPage()
         {
-            UserView.HomePage.Instance.RemoveViewByTag("Logic");
-            Tag = "Logic";
+            UserView.HomePage.Instance.RemoveViewByTag("LockLogic");
+            Tag = "LockLogic";
         }
         EditText logicTextBox;
-        public void Show(Action action)
+        public async void Show(Action action)
         {
 
             #region  鏈�涓婇潰鐨勫竷灞�浠g爜
@@ -32,23 +32,24 @@
 
             var titleName = new Button
             {
-                TextSize = 16,
+                TextSize = 17,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 TextAlignment = TextAlignment.CenterLeft,
                 X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(400),
+                Width = Application.GetRealWidth(600),
                 Height = Application.GetRealHeight(69),
                 Y = Application.GetRealHeight(92),
                 TextID = MyInternationalizationString.selection,
+                IsBold = true,
             };
             topRowLayout.AddChidren(titleName);
             if (Common.Logic.CurrentLogic.LogicId != 0)
             {
-                titleName.Text = Language.StringByID(MyInternationalizationString.editautomation);
+                titleName.Text = Language.StringByID(MyInternationalizationString.editlinkageevent);
             }
             else
             {
-                titleName.Text = Language.StringByID(MyInternationalizationString.newautomation);
+                titleName.Text = Language.StringByID(MyInternationalizationString.addlinkageevent);
             }
 
             var clickBtn = new Button
@@ -78,9 +79,9 @@
                 action();
                 RemoveFromParent();
             };
-                       
+
             #endregion
-            
+
 
             var middle = new VerticalScrolViewLayout
             {
@@ -109,6 +110,7 @@
                 TextID = MyInternationalizationString.automationname,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 Y = Application.GetRealHeight(35),
+                TextSize = 15,
             };
             logicnamefl.AddChidren(text);
 
@@ -120,7 +122,7 @@
                 X = text.Right,
                 TextAlignment = TextAlignment.CenterLeft,
                 TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                TextSize = 13,
+                TextSize = 14,
                 Text = Common.Logic.CurrentLogic.LogicName,
                 //TextID=MyInternationalizationString.automation1,
             };
@@ -163,7 +165,7 @@
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
-                TextSize = 16,
+                TextSize = 15,
                 Gravity = Gravity.CenterVertical,
             });
 
@@ -192,17 +194,7 @@
             ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
             EventHandler<MouseEventArgs> conditionaddclick = (sender, e) =>
             {
-                if (Common.Logic.CurrentLogic.Conditions.Count == 1)
-                {
-                    ConditionView(false);
-                }
-                else
-                {
-                    var addCondition = new AddCondition();
-                    UserView.HomePage.Instance.AddChidren(addCondition);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    addCondition.Show();
-                }
+                AddCondition(-1);
             };
             conditionadd.MouseUpEventHandler += conditionaddclick;
             conditionadd1.MouseUpEventHandler += conditionaddclick;
@@ -210,40 +202,6 @@
             ListConditions.Clear();
             ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions);
             ListConditions.Add(new Dictionary<string, string>());
-            if (Common.Logic.CurrentLogic.Conditions.Count > 1)
-            {
-                var row = new FrameLayout
-                {
-                    Height = Application.GetRealHeight(60),
-                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                };
-                middle.AddChidren(row);
-                var relationship = new Button
-                {
-                    Width = Application.GetRealWidth(600),
-                    Height = Application.GetRealHeight(60),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    X = Application.GetRealWidth(58),
-                    TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
-                };
-                row.AddChidren(relationship);
-                if (Common.Logic.CurrentLogic.Relationship == 0)
-                {
-                    relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.Allconditions);
-                }
-                else
-                {
-                    relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.anycondition);
-                }
-                EventHandler<MouseEventArgs> editclick = (sender, e) =>
-                {
-
-                    ConditionView(true);
-                };
-                row.MouseUpEventHandler += editclick;
-                relationship.MouseUpEventHandler += editclick;
-
-            }
             for (int i = 0; i < ListConditions.Count; i++)
             {
                 if (i == (ListConditions.Count - 1))
@@ -269,27 +227,18 @@
                     var addtextbtn = new Button
                     {
                         Height = Application.GetRealHeight(58),
-                        Width = Application.GetRealWidth(300),
+                        Width = Application.GetRealWidth(500),
                         Y = Application.GetRealHeight(45 + 30),
                         TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                        TextID = MyInternationalizationString.addconditions,
-                        X = Application.GetRealWidth(390),
+                        TextID = MyInternationalizationString.selectunlockingmode,
+                        X = Application.GetRealWidth(290),
+                        TextSize = 14,
                     };
                     addfl.AddChidren(addtextbtn);
 
                     EventHandler<MouseEventArgs> addconditionsclick = (sender, e) =>
                     {
-                        if (Common.Logic.CurrentLogic.Conditions.Count == 1)
-                        {
-                            ConditionView(false);
-                        }
-                        else
-                        {
-                            var addCondition = new AddCondition();
-                            UserView.HomePage.Instance.AddChidren(addCondition);
-                            UserView.HomePage.Instance.PageIndex += 1;
-                            addCondition.Show();
-                        }
+                        AddCondition(-1);
                     };
                     addbtn.MouseUpEventHandler += addconditionsclick;
                     addtextbtn.MouseUpEventHandler += addconditionsclick;
@@ -334,7 +283,8 @@
                                 var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; });
                                 if (deviceinof == null)
                                 {
-                                    continue;
+                                    deviceinof = new ZigBee.Device.CommonDevice();
+                                    //continue;
                                 }
                                 ///鏄剧ず璁惧鍚嶇О
                                 var btndevice = new Button
@@ -345,6 +295,7 @@
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Text = deviceinof.DeviceEpointName,
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextSize = 14,
                                 };
                                 conditionsRowLayout.AddChidren(btndevice);
 
@@ -368,26 +319,14 @@
                                     BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
                                     TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
+                                    Tag = i,
                                 };
                                 conditionsRowLayout.AddRightView(deviceedit);
                                 deviceedit.MouseUpEventHandler += (sender, e) =>
                                 {
 
-                                    if (deviceinof.Type != DeviceType.DoorLock)
-                                    {
-                                        var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                        this.AddChidren(flMain);
-                                      //  DeviceStateCondition.CurrentDeviceView(flMain, deviceinof, true);
-                                    }
-                                    else
-                                    {
-                                        //var memberList = new MemberList();
-                                        //UserView.HomePage.Instance.AddChidren(memberList);
-                                        //UserView.HomePage.Instance.PageIndex += 1;
-                                        //MemberList.edit = true;
-                                        //memberList.Show(deviceinof);
-                                    }
-
+                                    int intvalue = int.Parse(deviceedit.Tag.ToString());
+                                    AddCondition(intvalue);
                                 };
 
                                 ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
@@ -399,36 +338,32 @@
                                     TextAlignment = TextAlignment.CenterRight,
                                     X = Application.GetRealWidth(400),
                                     TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                    TextSize = 14,
                                 };
                                 conditionsRowLayout.AddChidren(devicestatus);
 
                                 switch (deviceinof.Type)
                                 {
-                                    
                                     case DeviceType.DoorLock:
                                         {
+                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/doorlock.png";
                                             for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++)
                                             {
                                                 if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1")
                                                 {
                                                     if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
                                                     {
-                                                        devicestatus.Text = conditions["Account"];
+                                                        devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"];
                                                         break;
-
                                                     }
                                                 }
-
                                             }
                                         }
                                         break;
- 
                                 }
 
                             }
                             break;
-                       
-
                     }
                     ///鍒犻櫎鎺т欢
                     var del = new Button
@@ -437,23 +372,20 @@
                         Text = Language.StringByID(MyInternationalizationString.del),
                     };
                     conditionsRowLayout.AddRightView(del);
-
                     del.MouseUpEventHandler += (sender, e) =>
                     {
-
-                        var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                                              Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
-                        alert.ResultEventHandler += (sender1, e1) =>
-                        {
-                            if (e1)
-                            {
-                                var lockLogicCommunalPage = new LockLogicCommunalPage();
-                                UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
-                                UserView.HomePage.Instance.PageIndex += 1;
-                                lockLogicCommunalPage.Show(()=> { });
-                            }
-                        };
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                       Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                       Language.StringByID(MyInternationalizationString.confrim));
                         alert.Show();
+                        alert.ConfirmClickEvent += () =>
+                        {
+                            Common.Logic.CurrentLogic.Conditions.Remove(conditions);
+                            var lockLogicCommunalPage = new LockLogicCommunalPage();
+                            UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+                            UserView.HomePage.Instance.PageIndex += 1;
+                            lockLogicCommunalPage.Show(() => { });
+                        };
 
                     };
 
@@ -492,7 +424,7 @@
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
-                TextSize = 16,
+                TextSize = 15,
                 Gravity = Gravity.CenterVertical,
             };
             targetRowLayout.AddChidren(btntargettitle);
@@ -519,7 +451,7 @@
             EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) =>
             {
                 Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-                var addAction = new Device.Logic.DoorLockLogic.AddAction();
+                var addAction = new AddAction();
                 UserView.HomePage.Instance.AddChidren(addAction);
                 UserView.HomePage.Instance.PageIndex += 1;
                 addAction.Show();
@@ -560,14 +492,15 @@
                         Width = Application.GetRealWidth(300),
                         Y = Application.GetRealHeight(45 + 30),
                         TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                        TextID = MyInternationalizationString.addfunction,
+                        TextID = MyInternationalizationString.lockaddaction,
                         X = Application.GetRealWidth(390),
+                        TextSize = 14,
                     };
                     addfl.AddChidren(addtextbtn);
                     EventHandler<MouseEventArgs> addfunctionclick = (sender, e) =>
                     {
                         Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-                        var addAction = new Device.Logic.DoorLockLogic.AddAction();
+                        var addAction = new AddAction();
                         UserView.HomePage.Instance.AddChidren(addAction);
                         UserView.HomePage.Instance.PageIndex += 1;
                         addAction.Show();
@@ -620,7 +553,8 @@
                                 var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); });
                                 if (deviceinof == null)
                                 {
-                                    continue;
+                                    deviceinof = new ZigBee.Device.CommonDevice();
+                                    //continue;
                                 }
 
                                 ///璁惧鍚嶇ОButton
@@ -632,6 +566,7 @@
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Text = deviceinof.DeviceEpointName,
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextSize = 14,
                                 };
                                 actionsrowLayout.AddChidren(btndevicename);
 
@@ -657,6 +592,7 @@
                                     TextAlignment = TextAlignment.CenterRight,
                                     X = Application.GetRealWidth(450),
                                     TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                    TextSize = 14,
                                 };
                                 actionsrowLayout.AddChidren(devicestatus);
 
@@ -672,16 +608,10 @@
                                 ///缂栬緫鐐瑰嚮浜嬩欢
                                 deviceedit.MouseUpEventHandler += (sender, e) =>
                                 {
-                                    //var deviceStatePage = new DeviceStatePage();
-                                    //UserView.HomePage.Instance.AddChidren(deviceStatePage);
-                                    //UserView.HomePage.Instance.PageIndex += 1;
-                                    //deviceStatePage.IsDeviceEditor = true;
-                                    //deviceStatePage.Show(deviceinof);
 
-                                    //ActionModifyDeviceStateView(deviceinof);
                                     var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                                     this.AddChidren(flMain);
-                                    //LogicDevicePage.CurrentDeviceStateView(flMain, deviceinof, true);
+                                    LockAddDevice.CurrentDeviceStateView(flMain, deviceinof, true);
                                 };
 
 
@@ -831,22 +761,19 @@
                                             bool ifclose = false;
                                             foreach (var status in TaskList)
                                             {
-                                                if (status["TaskType"].ToString() == "1")
+                                                if (TaskList.Count == 1)
                                                 {
-                                                    if (status["Data1"].ToString() == "0")
-                                                    {
-                                                        // devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
-
-                                                        ifclose = false;
-                                                    }
-                                                    else if (status["Data1"].ToString() == "1")
-                                                    {
-                                                        //devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
-                                                        ifclose = true;
-                                                    }
-
+                                                    //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱
+                                                    ifclose = false;
+                                                    //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛�
+                                                    break;
                                                 }
-                                                else if (status["TaskType"].ToString() == "5")
+                                                else
+                                                {
+                                                    ifclose = true;
+                                                }
+
+                                                if (status["TaskType"].ToString() == "5")
                                                 {
                                                     if (status["Data1"] == "3")
                                                     {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍)
@@ -937,11 +864,33 @@
                         case 2:
                             {
 
+                                //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙;
                                 var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); });
+                                //鏈湴娌℃湁瀛樺湪;
                                 if (sceneinof == null)
                                 {
-                                    continue;
+                                    //瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄�
+                                    sceneinof = new SceneUI();
+                                    #region -----
+                                    ////鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙;
+                                    ////鏍囪闂:缃戠粶璇锋眰锛屽瓨鍦ㄨ鍥惧姞杞藉揩鎱㈢殑闂锛�
+                                    //sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString()));
+                                    ////缃戝叧娌℃湁瀛樺湪;
+                                    //if (sceneinof == null)
+                                    //{
+                                    //    //娉ㄨВ:鏈湴鍜岀綉鍏抽兘涓嶅瓨鍦ㄨ鍦烘櫙,鐣岄潰灏嗕笉浼氭樉绀鸿鍦烘櫙;
+                                    //    //sceneinof = new SceneUI();
+                                    //    //绉婚櫎璇ュ満鏅暟鎹�;
+                                    //    Common.Logic.CurrentLogic.Actions.Remove(actions);
+                                    //    //绉婚櫎璇ュ満鏅鍥�;
+                                    //    devicesFrameLayout.RemoveFromParent();
+                                    //    continue;
+                                    //}
+                                    #endregion
                                 }
+
+
+
 
                                 actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png";
                                 ///璁惧鍚嶇ОButton
@@ -953,6 +902,7 @@
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Text = sceneinof.Name,
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextSize = 14,
                                 };
                                 actionsrowLayout.AddChidren(btndevicename);
 
@@ -976,7 +926,7 @@
 
                             }
                             break;
-                     
+
                     }
                     ///鍒犻櫎鎺т欢
                     var del = new Button
@@ -988,20 +938,19 @@
 
                     del.MouseUpEventHandler += (sender, e) =>
                     {
-                        var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                                               Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
-                        alert.ResultEventHandler += (sender1, e1) =>
-                        {
-                            if (e1)
-                            {
-                                Common.Logic.CurrentLogic.Actions.Remove(actions);
-                                //var logicCommunalPage = new LogicCommunalPage();
-                                //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-                                //UserView.HomePage.Instance.PageIndex += 1;
-                                //logicCommunalPage.Show(() => { });
-                            }
-                        };
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+           Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+          Language.StringByID(MyInternationalizationString.confrim));
                         alert.Show();
+
+                        alert.ConfirmClickEvent += () =>
+                        {
+                            Common.Logic.CurrentLogic.Actions.Remove(actions);
+                            var lockLogicCommunalPage = new LockLogicCommunalPage();
+                            UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+                            UserView.HomePage.Instance.PageIndex += 1;
+                            lockLogicCommunalPage.Show(() => { });
+                        };
 
                     };
 
@@ -1043,6 +992,7 @@
                 Height = Application.GetRealHeight(60),
                 Gravity = Gravity.CenterVertical,
                 TextID = MyInternationalizationString.pushswitch,
+                TextSize = 14,
             };
             pushswitchRowlayout.AddChidren(btnswitchtxet);
 
@@ -1056,23 +1006,11 @@
                 Gravity = Gravity.CenterVertical,
             };
             pushswitchRowlayout.AddChidren(btnswitch);
-            btnswitch.MouseUpEventHandler += (sender1, e1) =>
-            {
-                btnswitch.IsSelected = !btnswitch.IsSelected;
-                if (btnswitch.IsSelected)
-                {
-
-                }
-                else
-                {
-
-                }
-            };
-
+           
 
             var custompushFrameLayout = new FrameLayout
             {
-                Height = Application.GetRealHeight(160),
+                Height = Application.GetRealHeight(0),
                 BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
             };
             middle.AddChidren(custompushFrameLayout);
@@ -1095,6 +1033,7 @@
                 Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
                 Gravity = Gravity.CenterVertical,
+                TextSize = 14,
             };
             custompushRowLayout.AddChidren(btncustompush);
 
@@ -1110,7 +1049,7 @@
             custompushRowLayout.AddChidren(custompushback);
             EventHandler<MouseEventArgs> customclick = (sender, e) =>
             {
-                var CustomText = new Device.Logic.CustomText();
+                var CustomText = new CustomText();
                 UserView.HomePage.Instance.AddChidren(CustomText);
                 UserView.HomePage.Instance.PageIndex += 1;
                 CustomText.Show();
@@ -1122,7 +1061,37 @@
 
             #endregion
 
+            bool tag = false;//鏍囪寮�鍏崇姸鎬�;
+            btnswitch.MouseUpEventHandler += (sender1, e1) =>
+            {
+                btnswitch.IsSelected = !btnswitch.IsSelected;
+                if (btnswitch.IsSelected)
+                {
+                    tag = true;
+                    custompushFrameLayout.Height = Application.GetRealHeight(160);
+                    Common.Logic.CurrentLogic.LogicIsCustomPushText = 1;
 
+                }
+                else
+                {
+                    tag = false;
+                    custompushFrameLayout.Height = Application.GetRealHeight(0);
+                    Common.Logic.CurrentLogic.LogicIsCustomPushText = 0;
+                }
+                Send.Zj(tag, Common.Logic.CurrentLogic);
+            };
+            if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0)
+            {
+                tag = false;
+                btnswitch.IsSelected = false;
+                custompushFrameLayout.Height = Application.GetRealHeight(0);
+            }
+            else
+            {
+                tag = true;
+                btnswitch.IsSelected = true;
+                custompushFrameLayout.Height = Application.GetRealHeight(160);
+            }
             var saveFrameLayout = new FrameLayout
             {
                 Y = middle.Bottom,
@@ -1140,26 +1109,26 @@
                 BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
                 TextID = MyInternationalizationString.Save,
                 TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
+                TextSize = 16,
             };
             saveFrameLayout.AddChidren(btnsave);
             btnsave.MouseUpEventHandler += async (sender, e) =>
             {
                 var name = logicTextBox.Text.Trim();
-                //if (Common.Logic.CurrentLogic.Conditions.Count != 0 && Common.Logic.CurrentLogic.Actions.Count != 0)
-                //{
-                //    AddChidren(btnsave);
-                //}
                 if (string.IsNullOrEmpty(logicTextBox.Text.Trim()))
                 {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show();
+                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+            Language.StringByID(MyInternationalizationString.PleaseEnterLogicName),
+            Language.StringByID(MyInternationalizationString.confrim));
+                    alert.Show();
                     return;
                 }
-                var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
-                if (logicname != null)
-                {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
-                    return;
-                }
+                //var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
+                //if (logicname != null)
+                //{
+                //    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
+                //    return;
+                //}
 
                 Common.Logic.CurrentLogic.LogicName = name;
 
@@ -1168,267 +1137,41 @@
                 if (Common.Logic.CurrentLogic.LogicId == 0)
                 {
                     //鍙戦�佹坊鍔犻�昏緫鍛戒护
-                    var logicifon = await Device.Logic.Send.AddModifyLogic(Common.Logic.CurrentLogic);
+                    var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic);
                     if (logicifon != null && logicifon.LogicId != 0)
                     {
                         Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
-                        Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
+                        Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic);
+                        if (tag)
+                        {
+                            Send.Zj(tag, Common.Logic.CurrentLogic);
+                        }
                     }
                 }
                 else
                 {
                     //鍙戦�佷慨鏀归�昏緫鍛戒护
-                    Device.Logic.Send.AddModifyLogic(Common.Logic.CurrentLogic);
+                    Send.AddModifyLogic(Common.Logic.CurrentLogic);
                 }
 
                 CommonPage.Loading.Hide();
-                //UserView.HomePage.Instance.RemoveViewByTag("Logic");
-                //Category.Category.instance?.RefreshBodyView();
-                //UserView.HomePage.Instance.RemoveAt("Logic1");
-                //Category.Category category = new Category.Category();
-                //UserView.HomePage.Instance.AddChidren(category);
-                //UserView.HomePage.Instance.PageIndex += 1;
-                //category.Show(2);
+                UserView.HomePage.Instance.RemoveViewByTag("LockLogic");
+                UserView.HomePage.Instance.RemoveViewByTag("LockLogicList");
+                var doorLockLogicList = new LockLogicList();
+                UserView.HomePage.Instance.AddChidren(doorLockLogicList);
+                UserView.HomePage.Instance.PageIndex += 1;
+                doorLockLogicList.Show();
             };
-
 
         }
-        
-
-        void ConditionView(bool edit)
+        public  void AddCondition(int value)
         {
-            Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-
-            #region 缁勫悎鏉′欢View
-            FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 };
-            this.AddChidren(flMain);
-            flMain.MouseUpEventHandler += (sender2, e2) =>
-            {
-                flMain.RemoveFromParent();
-            };
-
-            var timetypeframelayout1 = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(100),
-                Y = Application.GetRealHeight(1920 - 100),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            flMain.AddChidren(timetypeframelayout1);
-            var framelayout = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(530),
-                Y = Application.GetRealHeight(1920 - 530),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                Radius = (uint)Application.GetRealHeight(60),
-            };
-            flMain.AddChidren(framelayout);
-
-            #region  -------鍙栨秷   瀹屾垚
-            var timetype = new RowLayout
-            {
-                Height = Application.GetRealHeight(140),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            framelayout.AddChidren(timetype);
-            var Btncancel = new Button
-            {
-                TextID = MyInternationalizationString.cancel,
-                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                X = Application.GetRealWidth(80),
-                TextAlignment = TextAlignment.CenterLeft,
-            };
-            timetype.AddChidren(Btncancel);
-            Btncancel.MouseUpEventHandler += (sender16, e16) =>
-            {
-                flMain.RemoveFromParent();
-                UserView.HomePage.Instance.ScrollEnabled = true;
-            };
-
-            var Btntitle = new Button
-            {
-                TextID = MyInternationalizationString.condition,
-                TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(320),
-                TextAlignment = TextAlignment.Center,
-                X = Btncancel.Right + Application.GetRealWidth(100),
-                TextSize = 16,
-            };
-            timetype.AddChidren(Btntitle);
-            var Btncomplete = new Button
-            {
-                TextID = MyInternationalizationString.complete,
-                TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                TextAlignment = TextAlignment.CenterRight,
-                X = Btntitle.Right + Application.GetRealWidth(100),
-
-            };
-            timetype.AddChidren(Btncomplete);
-            #endregion
-
-            #region  -------婊¤冻鎵�鏈夋潯浠�   婊¤冻鍏朵腑涓�涓潯浠�
-
-
-            #region  -------婊¤冻鎵�鏈夋潯浠�
-
-
-            var andFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = timetype.Bottom + Application.GetRealHeight(20),
-            };
-            framelayout.AddChidren(andFrameLayout);
-
-
-            var androw = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            andFrameLayout.AddChidren(androw);
-            var andbtn = new Button
-            {
-
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.Allconditions,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-
-            };
-            androw.AddChidren(andbtn);
-
-            var andSelected = new Device.Logic.SelectedButton();
-            androw.AddChidren(andSelected);
-            #endregion
-            #region  -------婊¤冻鍏朵腑涓�涓潯浠�
-
-            var orFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = andFrameLayout.Bottom,
-
-            };
-            framelayout.AddChidren(orFrameLayout);
-
-
-
-            var orrow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            orFrameLayout.AddChidren(orrow);
-            var orbtn = new Button
-            {
-
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.anycondition,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-            };
-            orrow.AddChidren(orbtn);
-
-            var orSelected = new Device.Logic.SelectedButton();
-            orrow.AddChidren(orSelected);
-            #endregion
-            ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠�
-            EventHandler<MouseEventArgs> andclick = (sedner14, e14) =>
-            {
-                andSelected.Visible = true;
-                orSelected.Visible = false;
-                andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-            };
-            androw.MouseUpEventHandler += andclick;
-            andbtn.MouseUpEventHandler += andclick;
-            andSelected.MouseUpEventHandler += andclick;
-            andFrameLayout.MouseUpEventHandler += andclick;
-
-
-            ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠�
-            EventHandler<MouseEventArgs> orclick = (sedner15, e15) =>
-            {
-                andSelected.Visible = false;
-                orSelected.Visible = true;
-                andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-            };
-            orrow.MouseUpEventHandler += orclick;
-            orbtn.MouseUpEventHandler += orclick;
-            orSelected.MouseUpEventHandler += orclick;
-            orFrameLayout.MouseUpEventHandler += orclick;
-
-            #endregion
-            #endregion
-
-            if (edit)
-            {
-                if (Common.Logic.CurrentLogic.Relationship == 0)
-                {
-                    andSelected.Visible = true;
-                    orSelected.Visible = false;
-                    andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                    orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                }
-                else
-                {
-                    andSelected.Visible = false;
-                    orSelected.Visible = true;
-                    andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                    orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                }
-            }
-            Btncomplete.MouseUpEventHandler += (sender, e) =>
-            {
-                if (!andSelected.Visible && !orSelected.Visible)
-                {
-                    ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
-                    return;
-                }
-                flMain.RemoveFromParent();
-
-                if (andSelected.Visible)
-                {
-                    Common.Logic.CurrentLogic.Relationship = 0;
-
-                }
-                if (orSelected.Visible)
-                {
-                    Common.Logic.CurrentLogic.Relationship = 1;
-
-                }
-                if (edit)
-                {
-                    if (Common.Logic.CurrentLogic.LogicId != 0)
-                    {
-                        Device.Logic.Send.LogicControlSwitch(Common.Logic.CurrentLogic);
-                    }
-                    var addCondition = new AddCondition();
-                    UserView.HomePage.Instance.AddChidren(addCondition);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    addCondition.Show();
-                }
-                else
-                {
-                    var addCondition = new AddCondition();
-                    UserView.HomePage.Instance.AddChidren(addCondition);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    addCondition.Show();
-                }
-            };
-
+            var addCondition = new AddCondition();
+            addCondition.conditionsIndex = value;
+            UserView.HomePage.Instance.AddChidren(addCondition);
+            UserView.HomePage.Instance.PageIndex += 1;
+            addCondition.Show();
+      
         }
     }
 }

--
Gitblit v1.8.0