From 081ea8d273048fd03756718ac6fb48a3c09218e9 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 29 十月 2019 13:10:00 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 1766 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 1,132 insertions(+), 634 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index 171aa2f..4f954b9 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -20,33 +20,28 @@
         EditText logicTextBox;
         public void Show(Action action)
         {
-
-            this.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
-
-            var topFrameLayout1 = new FrameLayout
+            
+            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
+            var topRowLayout = new RowLayout
             {
-                Height = Application.GetRealHeight(80),
-                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
+                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
+                Height = Application.GetRealHeight(184),
+                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
             };
-            AddChidren(topFrameLayout1);
-
-            var topFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(140),
-                Y = Application.GetRealHeight(80),
-                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
-            };
-            AddChidren(topFrameLayout);
+            this.AddChidren(topRowLayout);
 
             var titleName = new Button
             {
-
-                TextSize = 17,
+                TextSize = 16,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(150),
+                X = Application.GetRealWidth(176),
+                Width = Application.GetRealWidth(400),
+                Height = Application.GetRealHeight(69),
+                Y = Application.GetRealHeight(92),
+                TextID = MyInternationalizationString.selection,
             };
-            topFrameLayout.AddChidren(titleName);
+            topRowLayout.AddChidren(titleName);
             if (Common.Logic.CurrentLogic.LogicId != 0)
             {
                 titleName.Text = Language.StringByID(MyInternationalizationString.editautomation);
@@ -56,195 +51,183 @@
                 titleName.Text = Language.StringByID(MyInternationalizationString.newautomation);
             }
 
+            var clickBtn = new Button
+            {
+                Width = Application.GetRealWidth(81 + 51),
+                Height = Application.GetRealHeight(58 + 40),
+                Y = Application.GetRealHeight(98 - 40),
+            };
+            topRowLayout.AddChidren(clickBtn);
+            clickBtn.MouseDownEventHandler += (sender, e) =>
+            {
+                RemoveFromParent();
+            };
+
             var back = new Button
             {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(110),
-                X = Application.GetRealWidth(20),
-                Gravity = Gravity.CenterVertical,
-                UnSelectedImagePath = "ZigeeLogic/Back.png",
+                Width = Application.GetRealWidth(30),
+                Height = Application.GetRealHeight(51),
+                X = Application.GetRealWidth(81),
+                Y = Application.GetRealHeight(98),
+                //Gravity = Gravity.CenterVertical;
+                UnSelectedImagePath = "ZigeeLogic/back.png",
             };
-            topFrameLayout.AddChidren(back);
-           
+            topRowLayout.AddChidren(back);
             back.MouseDownEventHandler += (sender, e) =>
             {
-                //if (Common.Logic.CurrentLogic.LogicId != 0)
-                //{
-                //    Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-                //    action();
-                //    Send.AddModifyLogic(Common.Logic.CurrentLogic);
-                //}
                 action();
                 RemoveFromParent();
             };
 
 
-            var middle = new VerticalScrolViewLayout();
-            middle.Y = topFrameLayout.Bottom;
-            middle.Height = Application.GetRealHeight(1920 - 220 - 194);
-            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+
+            #endregion
+
+
+
+            var middle = new VerticalScrolViewLayout
+            {
+                Y = topRowLayout.Bottom,
+                Height = Application.GetRealHeight(1920 - 184-180),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
             this.AddChidren(middle);
 
-            var fl = new FrameLayout
-            {
-                Height = Application.GetRealHeight(280),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            middle.AddChidren(fl);
-
-            #region -----姣忓ぉ 璁剧疆鍛ㄦ湡-----
-            var weekfl = new FrameLayout
-            {
-                Height = Application.GetRealHeight(140),
-                Y = Application.GetRealHeight(20),
-            };
-            fl.AddChidren(weekfl);
-
-            var btnweektext = new Button
-            {
-                Width = Application.GetRealWidth(900 - 300),
-                Height = Application.GetRealHeight(70),
-                X = Application.GetRealWidth(140 + 300),
-                TextAlignment = TextAlignment.CenterRight,
-                //Text = "姣忓ぉ",
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextID = MyInternationalizationString.everyday,
-            };
-            weekfl.AddChidren(btnweektext);
-            var settxet = new Button
-            {
-                Width = Application.GetRealWidth(900 - 500),
-                Height = Application.GetRealHeight(70),
-                X = Application.GetRealWidth(140 + 500),
-                TextAlignment = TextAlignment.CenterRight,
-                Y = btnweektext.Bottom,
-                //Text = "璁剧疆鍛ㄦ湡",
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextID = MyInternationalizationString.setupcycle,
-            };
-            weekfl.AddChidren(settxet);
-
-            UpdateWeek(btnweektext);
-
-            EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
-            {
-                /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
-                //var cycle = new Cycle(() => { UpdateWeek(btnweektext); });
-                //UserView.HomePage.Instance.AddChidren(cycle);
-                //UserView.HomePage.Instance.PageIndex += 1;
-                //cycle.Show();
-
-                var cyclicCycle = new CyclicCycle(() => { UpdateWeek(btnweektext); });
-                UserView.HomePage.Instance.AddChidren(cyclicCycle);
-                UserView.HomePage.Instance.PageIndex += 1;
-                cyclicCycle.Show();
-            };
-            btnweektext.MouseUpEventHandler += cycleclick;
-            settxet.MouseUpEventHandler += cycleclick;
-            #endregion
 
             #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О-----
             var logicnamefl = new FrameLayout
             {
-                Height = Application.GetRealHeight(140),
-                Y = weekfl.Bottom,
-                //BackgroundColor=0xff453736,
+                Height = Application.GetRealHeight(130),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
             };
-            fl.AddChidren(logicnamefl);
+            middle.AddChidren(logicnamefl);
 
             var text = new Button
             {
-                Width = Application.GetRealWidth(600),
+                Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
-                X = Application.GetRealWidth(50),
+                X = Application.GetRealWidth(58),
                 TextAlignment = TextAlignment.CenterLeft,
                 //Text = "鑷姩鍖栧悕绉�",
                 TextID = MyInternationalizationString.automationname,
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Y = Application.GetRealHeight(35),
             };
             logicnamefl.AddChidren(text);
 
             logicTextBox = new EditText
             {
-                Width = Application.GetRealWidth(900),
+                Y = Application.GetRealHeight(35),
+                Width = Application.GetRealWidth(1080-58-300),
                 Height = Application.GetRealHeight(60),
-                X = Application.GetRealWidth(40 + 20),
-                Y = text.Bottom + Application.GetRealHeight(10),
+                X = text.Right,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                 TextSize = 13,
                 Text = Common.Logic.CurrentLogic.LogicName,
                 //TextID=MyInternationalizationString.automation1,
             };
             logicnamefl.AddChidren(logicTextBox);
 
-            var btnline = new Button
+            var fraline = new FrameLayout
             {
-                Height = Application.GetRealHeight(4),
-                Y = Application.GetRealHeight(140 - 4),
-                BackgroundColor = ZigbeeColor.Current.LogicLineColor,
+                Height = Application.GetRealHeight(30),
             };
-            logicnamefl.AddChidren(btnline);
+            middle.AddChidren(fraline);
             #endregion
 
             #region -----鏄剧ず閫昏緫鏉′欢-----
+
+
+            var conditionFrameLayout = new FrameLayout
+            {
+                Height = Application.GetRealHeight(160),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+            };
+            middle.AddChidren(conditionFrameLayout);
+
+
             var conditionRowLayout = new RowLayout
             {
-                Height = Application.GetRealHeight(150),
-                //BackgroundColor = 0xff323232,
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(965),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(58),
+                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
             };
-            middle.AddChidren(conditionRowLayout);
+            conditionFrameLayout.AddChidren(conditionRowLayout);
+
 
             conditionRowLayout.AddChidren(new Button
             {
+
+                Text = Language.StringByID(MyInternationalizationString.ifcondition),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
-                //Text = "濡傛灉",
-                TextID = MyInternationalizationString.ifcondition,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                // Gravity = Gravity.CenterVertical,
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                Y = Application.GetRealHeight(90),
                 TextSize = 16,
+                Gravity = Gravity.CenterVertical,
             });
+
+            var conditionadd1 = new Button
+            {
+
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(57),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(965 + 58),
+
+            };
+            conditionFrameLayout.AddChidren(conditionadd1);
 
             var conditionadd = new Button
             {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(100),
+
+                Width = Application.GetRealWidth(58),
+                Height = Application.GetRealHeight(58),
                 UnSelectedImagePath = "ZigeeLogic/add.png",
-                X = Application.GetRealWidth(1080 - 140),
+                X = Application.GetRealWidth(965 - 58),
                 Gravity = Gravity.CenterVertical,
+
             };
             conditionRowLayout.AddChidren(conditionadd);
             ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
-            conditionadd.MouseUpEventHandler += (sender, e) =>
+            EventHandler<MouseEventArgs> conditionaddclick = (sender, e) =>
             {
-                ConditionView();
+                if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+                {
+                    ConditionView(false);
+                }
+                else
+                {
+                    var addLogicPage = new AddLogicPage();
+                    UserView.HomePage.Instance.AddChidren(addLogicPage);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    addLogicPage.Show();
+                }
             };
-
-
+            conditionadd.MouseUpEventHandler += conditionaddclick;
+            conditionadd1.MouseUpEventHandler += conditionaddclick;
             List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>();
             ListConditions.Clear();
             ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions);
             ListConditions.Add(new Dictionary<string, string>());
             if (Common.Logic.CurrentLogic.Conditions.Count > 1)
             {
-                //inputVerticalScrolViewLayout.Height = Application.GetRealHeight(160 * ListConditions.Count) + Application.GetRealHeight(60);
                 var row = new FrameLayout
                 {
                     Height = Application.GetRealHeight(60),
+                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                 };
-                //inputVerticalScrolViewLayout.AddChidren(row);
                 middle.AddChidren(row);
                 var relationship = new Button
                 {
                     Width = Application.GetRealWidth(600),
                     Height = Application.GetRealHeight(60),
                     TextAlignment = TextAlignment.CenterLeft,
-                    X = Application.GetRealWidth(40),
-                    TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
+                    X = Application.GetRealWidth(58),
+                    TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
                 };
                 row.AddChidren(relationship);
                 if (Common.Logic.CurrentLogic.Relationship == 0)
@@ -255,6 +238,14 @@
                 {
                     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++)
             {
@@ -263,34 +254,80 @@
 
                     var addfl = new FrameLayout
                     {
-                        Height = Application.GetRealHeight(160),
+                        Height = Application.GetRealHeight(160 + 30 + 50),
+                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                     };
                     middle.AddChidren(addfl);
                     var addbtn = new Button
                     {
-                        Height = Application.GetRealHeight(120),
-                        Width = Application.GetRealWidth(1000),
-                        X = Application.GetRealWidth(40),
-                        Y = Application.GetRealHeight(40),
-                        Radius = (uint)Application.GetRealHeight(30),
-                        //Text = "娣诲姞鏉′欢",
-                        BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                        TextID = MyInternationalizationString.addconditions,
+                        Height = Application.GetRealHeight(130 + 50),
+                        Width = Application.GetRealWidth(908),
+                        Y = Application.GetRealHeight(30),
+                        X = Application.GetRealWidth(86),
+                        UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png",
                     };
                     addfl.AddChidren(addbtn);
-                    addbtn.MouseUpEventHandler += (sender, e) =>
+
+
+                    var addtextbtn = new Button
                     {
-                        ConditionView();
+                        Height = Application.GetRealHeight(58),
+                        Width = Application.GetRealWidth(300),
+                        Y = Application.GetRealHeight(45 + 30),
+                        TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                        TextID = MyInternationalizationString.addconditions,
+                        X = Application.GetRealWidth(390),
                     };
+                    addfl.AddChidren(addtextbtn);
+
+                    EventHandler<MouseEventArgs> addconditionsclick = (sender, e) =>
+                    {
+                        if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+                        {
+                            ConditionView(false);
+                        }
+                        else
+                        {
+                            var addLogicPage = new AddLogicPage();
+                            UserView.HomePage.Instance.AddChidren(addLogicPage);
+                            UserView.HomePage.Instance.PageIndex += 1;
+                            addLogicPage.Show();
+                        }
+                    };
+                    addbtn.MouseUpEventHandler += addconditionsclick;
+                    addtextbtn.MouseUpEventHandler += addconditionsclick;
                 }
                 else
                 {
-                    var conditionsowLayout = new RowLayout
+                    var devicesFrameLayout = new FrameLayout
                     {
-                        Height = Application.GetRealHeight(160),
+                        Height = Application.GetRealHeight(130),
+                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                     };
-                    middle.AddChidren(conditionsowLayout);
+                    middle.AddChidren(devicesFrameLayout);
+
+                    ///鏄剧ず鍥炬爣
+                    var conditionIcon = new Button
+                    {
+                        Width = Application.GetRealWidth(81),
+                        Height = Application.GetRealHeight(81),
+                        X = Application.GetRealWidth(104),
+                        Y = Application.GetRealHeight(25),
+                        //UnSelectedImagePath = "ZigeeLogic/time.png",
+
+                    };
+                    devicesFrameLayout.AddChidren(conditionIcon);
+
+
+                    var conditionsRowLayout = new RowLayout
+                    {
+                        Width = Application.GetRealWidth(800),
+                        Height = Application.GetRealHeight(130),
+                        X = Application.GetRealWidth(222),
+                        LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                    };
+                    devicesFrameLayout.AddChidren(conditionsRowLayout);
+
                     var Type = int.Parse(ListConditions[i]["Type"]);
                     var conditions = ListConditions[i];
                     switch (Type)
@@ -302,31 +339,39 @@
                                 ///鏄剧ず鏃堕棿
                                 var timevalue = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(800),
+                                    Width = Application.GetRealWidth(200),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
-                                    //Text = starttime,
-                                    //TextColor = 0xff121212,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
-                                conditionsowLayout.AddChidren(timevalue);
+                                conditionsRowLayout.AddChidren(timevalue);
+
+
+                                var timeTxet = new Button
+                                {
+                                    Width = Application.GetRealWidth(400),
+                                    TextAlignment = TextAlignment.CenterRight,
+                                    Gravity = Gravity.CenterVertical,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                    X = conditionsRowLayout.Width - Application.GetRealWidth(400),
+                                };
+                                conditionsRowLayout.AddChidren(timeTxet);
 
 
                                 var timeedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
-                                conditionsowLayout.AddRightView(timeedit);
+                                conditionsRowLayout.AddRightView(timeedit);
 
                                 timeedit.MouseUpEventHandler += (sender, e) =>
                                 {
                                     var timePoint = new TimePoint();
                                     UserView.HomePage.Instance.AddChidren(timePoint);
                                     UserView.HomePage.Instance.PageIndex += 1;
-                                    timePoint.IsDeviceEditor = true;
+                                    timePoint.IsEditor = true;
                                     timePoint.Show(conditions);
                                 };
 
@@ -337,49 +382,57 @@
                                         {
                                             string s = "";
                                             s = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.time) + conditions["StartHour"] + ":" + s;
+                                            timevalue.Text = conditions["StartHour"] + ":" + s;
+                                            timeTxet.TextID = MyInternationalizationString.immediateexecution;
+                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/timepoint.png";
                                         }
                                         break;
                                     case 1:
+                                        timevalue.TextID = MyInternationalizationString.sunrise;
+                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/sunrise.png";
                                         if (int.Parse(conditions["AdjustTime"]) > 0)
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunriseafter) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
+                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
                                         }
                                         else if (int.Parse(conditions["AdjustTime"]) < 0)
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunrisebefore) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
+                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
                                         }
                                         else
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunrise);
+                                            //timeTxet.Text = Language.StringByID(MyInternationalizationString.sunrise);
                                         }
                                         break;
                                     case 2:
+                                        timevalue.TextID = MyInternationalizationString.sunset;
+                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/sunset.png";
                                         if (int.Parse(conditions["AdjustTime"]) > 0)
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunsetafter) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
+                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
                                         }
                                         else if (int.Parse(conditions["AdjustTime"]) < 0)
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunsetbefore) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
+                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
                                         }
                                         else
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunset);
+                                            // timevalue.Text = Language.StringByID(MyInternationalizationString.sunset);
                                         }
                                         break;
                                     case 3:
+                                        timevalue.TextID = MyInternationalizationString.noon;
+                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/noon.png";
                                         if (int.Parse(conditions["AdjustTime"]) > 0)
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.noonafter) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
+                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
                                         }
                                         else if (int.Parse(conditions["AdjustTime"]) < 0)
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.noonbefore) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
+                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
                                         }
                                         else
                                         {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.noon);
+                                            // timeTxet.Text = Language.StringByID(MyInternationalizationString.noon);
                                         }
                                         break;
                                 }
@@ -388,37 +441,46 @@
                             break;
                         case 5:
                             {
+                                conditionIcon.UnSelectedImagePath = "ZigeeLogic/timeparagraph.png";
                                 string s1 = "", s2 = "";
                                 s1 = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
                                 s2 = conditions["StopMin"].Length < 2 ? "0" + conditions["StopMin"] : conditions["StopMin"];
                                 ///鏄剧ず鏃堕棿
                                 var timevalue = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(500),
+                                    Width = Application.GetRealWidth(400),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
                                     Text = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2,
                                     //TextColor = 0xff121212,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
-                                conditionsowLayout.AddChidren(timevalue);
-
+                                conditionsRowLayout.AddChidren(timevalue);
+                                var timeTxet = new Button
+                                {
+                                    Width = Application.GetRealWidth(400),
+                                    TextAlignment = TextAlignment.CenterRight,
+                                    Gravity = Gravity.CenterVertical,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                    X = conditionsRowLayout.Width - Application.GetRealWidth(400),
+                                    TextID = MyInternationalizationString.timeframe,
+                                };
+                                conditionsRowLayout.AddChidren(timeTxet);
 
                                 var timeedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    //TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
-                                conditionsowLayout.AddRightView(timeedit);
+                                conditionsRowLayout.AddRightView(timeedit);
                                 timeedit.MouseUpEventHandler += (sender, e) =>
                                 {
                                     var timePage = new TimePage();
                                     UserView.HomePage.Instance.AddChidren(timePage);
                                     UserView.HomePage.Instance.PageIndex += 1;
                                     timePage.str1 = conditions["StartHour"] + ":" + conditions["StartMin"] + "-" + conditions["StopHour"] + ":" + conditions["StopMin"];
-                                    timePage.IsDeviceEditor1 = true;
+                                    timePage.IsEditor = true;
                                     timePage.Show();
                                 };
                             }
@@ -433,52 +495,74 @@
                                 ///鏄剧ず璁惧鍚嶇О
                                 var btndevice = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(500),
+                                    Y = Application.GetRealHeight(20),
+                                    Height = Application.GetRealHeight(50),
+                                    Width = Application.GetRealWidth(400),
                                     TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
                                     Text = deviceinof.DeviceEpointName,
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
                                 };
-                                conditionsowLayout.AddChidren(btndevice);
+                                conditionsRowLayout.AddChidren(btndevice);
+
+                                ///鍖哄煙(鎴块棿)鍚嶇ОButton
+                                var btnregionname = new Button
+                                {
+                                    Y = btndevice.Bottom + Application.GetRealHeight(10),
+                                    Width = Application.GetRealWidth(400),
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    Height = Application.GetRealHeight(50),
+                                    Text = "",//Language.StringByID(MyInternationalizationString.customroom),
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                };
+                                conditionsRowLayout.AddChidren(btnregionname);
+                                ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
+                                Send.RoomNmae(btnregionname, deviceinof);
 
 
                                 var deviceedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
-                                conditionsowLayout.AddRightView(deviceedit);
+                                conditionsRowLayout.AddRightView(deviceedit);
                                 deviceedit.MouseUpEventHandler += (sender, e) =>
                                 {
-                                    //var selectedDeviceState = new SelectedDeviceState();
-                                    //UserView.HomePage.Instance.AddChidren(selectedDeviceState);
-                                    //UserView.HomePage.Instance.PageIndex += 1;
-                                    //selectedDeviceState.IsDeviceEditor = true;
-                                    //selectedDeviceState.Show(deviceinof);
-                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                    this.AddChidren(flMain);
-                                    DeviceStateCondition.CurrentDeviceView(flMain, deviceinof, true);
+
+                                    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);
+                                    }
+
                                 };
 
                                 ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
                                 var devicestatus = new Button
                                 {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
+                                    Width = Application.GetRealWidth(400),
+                                    Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
                                     TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 340),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    X = Application.GetRealWidth(400),
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
-                                conditionsowLayout.AddChidren(devicestatus);
+                                conditionsRowLayout.AddChidren(devicestatus);
 
                                 switch (deviceinof.Type)
                                 {
                                     case DeviceType.OnOffOutput:
                                         {
+                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/light.png";
                                             if (conditions["AttriButeId"] == "0")
                                             {
                                                 if (conditions["AttriButeData1"] == "1")
@@ -512,6 +596,7 @@
                                         {
                                             var iASZonedevice = deviceinof as IASZone;
                                             var intvalue = conditions["AttriButeData1"];
+                                            conditionIcon.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
                                             switch (iASZonedevice.IasDeviceType)
                                             {
                                                 case 13:
@@ -522,36 +607,56 @@
                                                         }
                                                         else
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.unmanned;
+                                                            int minute = int.Parse(conditions["IgnoreTime"]) / 60;
+                                                            int second = int.Parse(conditions["IgnoreTime"]) % 60;
+                                                            if (second != 0)
+                                                            {
+                                                                devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                            }
+                                                            else
+                                                            {
+                                                                devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+                                                            }
                                                         }
                                                     }
                                                     break;
                                                 case 21:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.logicopen;
-                                                        }
-                                                        else
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.logicclose;
-                                                        }
-                                                    }
-                                                    break;
                                                 case 22:
                                                     {
+                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/doormagnetism.png";
                                                         if (intvalue == "1")
                                                         {
                                                             devicestatus.TextID = MyInternationalizationString.logicopen;
                                                         }
                                                         else
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.logicclose;
+                                                            if (conditions.ContainsKey("IgnoreTime"))
+                                                            {
+
+                                                                int minute = int.Parse(conditions["IgnoreTime"]) / 60;
+                                                                int second = int.Parse(conditions["IgnoreTime"]) % 60;
+                                                                if (second != 0)
+                                                                {
+                                                                    devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime);
+
+                                                                }
+                                                                else
+                                                                {
+                                                                    devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime);
+                                                                }
+
+                                                            }
+                                                            else
+                                                            {
+                                                                devicestatus.TextID = MyInternationalizationString.logicclose;
+                                                            }
                                                         }
                                                     }
                                                     break;
                                                 case 40:
                                                     {
+                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/smoke.png";
                                                         if (intvalue == "1")
                                                         {
                                                             devicestatus.TextID = MyInternationalizationString.smokescreen;
@@ -561,6 +666,7 @@
                                                     break;
                                                 case 42:
                                                     {
+                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/waterleakage.png";
                                                         if (intvalue == "1")
                                                         {
                                                             devicestatus.TextID = MyInternationalizationString.waterleakage;
@@ -573,6 +679,7 @@
                                                     break;
                                                 case 43:
                                                     {
+                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/gas.png";
                                                         if (intvalue == "1")
                                                         {
                                                             devicestatus.TextID = MyInternationalizationString.gas;
@@ -582,6 +689,7 @@
                                                     break;
                                                 case 277:
                                                     {
+                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/waterleakage.png";
                                                         if (intvalue == "1")
                                                         {
                                                             devicestatus.TextID = MyInternationalizationString.callthepolice;
@@ -591,6 +699,7 @@
                                                     break;
                                                 default:
                                                     {
+                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/infraredsensor.png";
                                                         if (intvalue == "1")
                                                         {
                                                             devicestatus.TextID = MyInternationalizationString.callthepolice;
@@ -603,23 +712,45 @@
                                         break;
                                     case DeviceType.OnOffSwitch:
                                         {
+                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/panel.png";
                                             devicestatus.Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"];
-                                            //if (conditions["Epoint"] == "1")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button1;
-                                            //}
-                                            //else if (conditions["Epoint"] == "2")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button2;
-                                            //}
-                                            //else if (conditions["Epoint"] == "3")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button3;
-                                            //}
-                                            //else if (conditions["Epoint"] == "4")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button4;
-                                            //}
+                                        }
+                                        break;
+                                    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"];
+                                                        break;
+
+                                                    }
+                                                }
+
+                                            }
+                                        }
+                                        break;
+                                    case DeviceType.TemperatureSensor:
+                                       // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
+                                        var dev = deviceinof as TemperatureSensor;
+                                        if (conditions["Cluster_ID"]=="1026") {
+                                            dev.SensorDiv = 1;
+                                        } else {
+                                            dev.SensorDiv = 2;
+                                        }
+                                        if (conditions["Cluster_ID"] == "1026")
+                                        {
+                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
+                                            devicestatus.Text = ">" + conditions["AttriButeData1"] + "鈩�";
+                                        }
+                                        else
+                                        {
+                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/humidity.png";
+                                            devicestatus.Text = "<" + conditions["AttriButeData1"] + "%";
                                         }
                                         break;
 
@@ -637,7 +768,6 @@
                                 ///鏄剧ず閫昏緫鍚嶇О
                                 var btnlogic = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
                                     Width = Application.GetRealWidth(700),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
@@ -645,16 +775,16 @@
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                                     //TextColor = 0xff121212,
                                 };
-                                conditionsowLayout.AddChidren(btnlogic);
+                                conditionsRowLayout.AddChidren(btnlogic);
 
 
                                 var logicedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
-                                conditionsowLayout.AddRightView(logicedit);
+                                conditionsRowLayout.AddRightView(logicedit);
                                 logicedit.MouseUpEventHandler += (sender, e) =>
                                 {
                                     var selectedLogicStatus = new SelectedLogicStatus();
@@ -668,14 +798,13 @@
                                 var logicstatus = new Button
                                 {
                                     Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
+                                    Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
-                                    //TextColor = 0xff121212,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                                     TextAlignment = TextAlignment.CenterRight,
+                                    X = Application.GetRealWidth(500),
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
-                                conditionsowLayout.AddChidren(logicstatus);
+                                conditionsRowLayout.AddChidren(logicstatus);
 
                                 if (conditions["IsValid"] == "1")
                                 {
@@ -691,7 +820,6 @@
                             {
                                 var btnsecurity = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
                                     Width = Application.GetRealWidth(700),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
@@ -700,16 +828,16 @@
                                     //TextColor = 0xff121212,
                                     TextID = MyInternationalizationString.security,
                                 };
-                                conditionsowLayout.AddChidren(btnsecurity);
+                                //conditionsRowLayout.AddChidren(btnsecurity);
 
 
                                 var btnsecurityedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
-                                conditionsowLayout.AddRightView(btnsecurityedit);
+                                conditionsRowLayout.AddRightView(btnsecurityedit);
                                 btnsecurityedit.MouseUpEventHandler += (sender, e) =>
                                 {
                                     //var securityPage = new SecurityPage();
@@ -726,22 +854,33 @@
                                 ///鏄剧ず瀹夐槻鏉′欢鐘舵�佹帶浠�
                                 var securitystatus = new Button
                                 {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
+                                    Width = Application.GetRealWidth(500),
+                                    Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
-                                conditionsowLayout.AddChidren(securitystatus);
+                                conditionsRowLayout.AddChidren(securitystatus);
 
                                 if (conditions["EnOrWithdrawMode"] == "1")
                                 {
+                                    conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
                                     securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal);
                                 }
                                 else
                                 {
-                                    securitystatus.Text = Language.StringByID(MyInternationalizationString.defence);
+                                    if (conditions["ModeId"] == "1")
+                                    {
+                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/athome.png";
+                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison);
+
+                                    }
+                                    else
+                                    {
+                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png";
+                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
+
+                                    }
                                 }
                             }
                             break;
@@ -749,7 +888,6 @@
                             {
                                 var btnlocation = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
                                     Width = Application.GetRealWidth(700),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
@@ -758,16 +896,16 @@
                                     //TextColor = 0xff121212,
                                     TextID = MyInternationalizationString.geographicalposition,
                                 };
-                                conditionsowLayout.AddChidren(btnlocation);
+                                conditionsRowLayout.AddChidren(btnlocation);
 
 
                                 var btnlocationedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
-                                conditionsowLayout.AddRightView(btnlocationedit);
+                                conditionsRowLayout.AddRightView(btnlocationedit);
                                 btnlocationedit.MouseUpEventHandler += (sender, e) =>
                                 {
 
@@ -779,21 +917,26 @@
                                 var locationstatus = new Button
                                 {
                                     Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
+                                    Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
                                     TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    X = Application.GetRealWidth(500),
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
-                                conditionsowLayout.AddChidren(locationstatus);
-
-                                if (conditions["AtHome"] == "1")
+                                conditionsRowLayout.AddChidren(locationstatus);
+                                foreach (var radius in Common.Logic.CurrentLogic.Accounts)
                                 {
-                                    locationstatus.Text = Language.StringByID(MyInternationalizationString.athome);
-                                }
-                                else
-                                {
-                                    locationstatus.Text = Language.StringByID(MyInternationalizationString.leavehome);
+                                    if (radius["Type"] == "7")
+                                    {
+                                        if (conditions["AtHome"] == "1")
+                                        {
+                                            locationstatus.Text = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�";
+                                        }
+                                        else
+                                        {
+                                            locationstatus.Text = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�";
+                                        }
+                                    }
                                 }
                             }
                             break;
@@ -802,10 +945,10 @@
                     ///鍒犻櫎鎺т欢
                     var del = new Button
                     {
-                        BackgroundColor = ZigbeeColor.Current.LogicDelBackgroundColor,
+                        BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1,
                         Text = Language.StringByID(MyInternationalizationString.del),
                     };
-                    conditionsowLayout.AddRightView(del);
+                    conditionsRowLayout.AddRightView(del);
 
                     del.MouseUpEventHandler += (sender, e) =>
                     {
@@ -834,38 +977,59 @@
             #endregion
 
             #region  ----鏄剧ず鎵ц鐩爣----
+
+            var targetFrameLayout = new FrameLayout
+            {
+                Height = Application.GetRealHeight(160),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+            };
+            middle.AddChidren(targetFrameLayout);
+
+
             var targetRowLayout = new RowLayout
             {
-                Height = Application.GetRealHeight(150),
-                // BackgroundColor = 0xff323232,
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(965),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(58),
+                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
             };
-            middle.AddChidren(targetRowLayout);
+            targetFrameLayout.AddChidren(targetRowLayout);
 
 
             var btntargettitle = new Button
             {
-                //Text = "灏辨墽琛�",
+
+                Text = Language.StringByID(MyInternationalizationString.execute),
                 TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                Y = Application.GetRealHeight(90),
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
                 TextSize = 16,
-                TextID = MyInternationalizationString.execute,
+                Gravity = Gravity.CenterVertical,
             };
             targetRowLayout.AddChidren(btntargettitle);
 
+            var btntargetadd1 = new Button
+            {
+
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(57),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(965+58),
+            };
+            targetFrameLayout.AddChidren(btntargetadd1);
+
             var btntargetadd = new Button
             {
-                Width = Application.GetRealWidth(100),
-                Height = Application.GetRealHeight(100),
+                Width = Application.GetRealWidth(58),
+                Height = Application.GetRealHeight(58),
                 UnSelectedImagePath = "ZigeeLogic/add.png",
-                X = Application.GetRealWidth(1080 - 140),
+                X = Application.GetRealWidth(965 - 58),
                 Gravity = Gravity.CenterVertical,
             };
             targetRowLayout.AddChidren(btntargetadd);
-            btntargetadd.MouseUpEventHandler += (sender, e) =>
+            EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) =>
             {
                 Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
                 var deviceTarget = new DeviceTarget();
@@ -873,55 +1037,13 @@
                 UserView.HomePage.Instance.PageIndex += 1;
                 deviceTarget.Show();
             };
-
+            btntargetadd1.MouseUpEventHandler += btntargetaddclick;
+            btntargetadd.MouseUpEventHandler += btntargetaddclick;
 
             List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
             ListActions.Clear();
             ListActions.AddRange(Common.Logic.CurrentLogic.Actions);
-            //ListActions.Add(new Dictionary<string, object>());
-            ListActions.Add(new Dictionary<string, object>() { ["LinkType"] = "11" });
-            bool tag = false;
-            for (int i = 0; i < ListActions.Count; i++)
-            {
-                var linkType = ListActions[i]["LinkType"].ToString();
-                if (linkType == "10")
-                {
-                    if (ListActions[i + 1]["LinkType"].ToString() == "0")
-                    {
-                        var delaytime = ListActions[i]["DelayTime"].ToString();
-                        if (ListActions[i + 1].ContainsKey("Time"))
-                        {
-                            ListActions[i + 1].Remove("Time");
-                        }
-                        ListActions[i + 1].Add("Time", delaytime);
-                    }
-                    tag = true;
-                    //break;
-                }
-
-            }
-
-            if (!tag)
-            {
-                for (int i = 0; i < ListActions.Count; i++)
-                {
-                    var linkType = ListActions[i]["LinkType"].ToString();
-                    if (linkType == "0")
-                    {
-                        var second = ListActions[i]["Time"].ToString();
-                        if (second != "0")
-                        {
-                            Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
-                            actionsInfo.Add("LinkType", 10);
-                            actionsInfo.Add("DelayTime", second);
-                            ListActions.Insert(i, actionsInfo);
-                        }
-
-                    }
-
-                }
-            }
-
+            ListActions.Add(new Dictionary<string, object>());
 
             for (int i = 0; i < ListActions.Count; i++)
             {
@@ -930,23 +1052,32 @@
 
                     var addfl = new FrameLayout
                     {
-                        Height = Application.GetRealHeight(160),
+                        Height = Application.GetRealHeight(160 + 30 + 50),
+                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                     };
                     middle.AddChidren(addfl);
                     var addbtn = new Button
                     {
-                        Height = Application.GetRealHeight(120),
-                        Width = Application.GetRealWidth(1000),
-                        X = Application.GetRealWidth(40),
-                        Y = Application.GetRealHeight(40),
-                        Radius = (uint)Application.GetRealHeight(30),
-                        //Text = "娣诲姞鍔熻兘",
-                        BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                        TextID = MyInternationalizationString.addfunction,
+                        Height = Application.GetRealHeight(130 + 50),
+                        Width = Application.GetRealWidth(908),
+                        Y = Application.GetRealHeight(30),
+                        X = Application.GetRealWidth(86),
+                        UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png",
                     };
                     addfl.AddChidren(addbtn);
-                    addbtn.MouseUpEventHandler += (sender, e) =>
+
+
+                    var addtextbtn = new Button
+                    {
+                        Height = Application.GetRealHeight(58),
+                        Width = Application.GetRealWidth(300),
+                        Y = Application.GetRealHeight(45 + 30),
+                        TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                        TextID = MyInternationalizationString.addfunction,
+                        X = Application.GetRealWidth(390),
+                    };
+                    addfl.AddChidren(addtextbtn);
+                    EventHandler<MouseEventArgs> addfunctionclick = (sender, e) =>
                     {
                         Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
                         var deviceTarget = new DeviceTarget();
@@ -954,67 +1085,49 @@
                         UserView.HomePage.Instance.PageIndex += 1;
                         deviceTarget.Show();
                     };
+                    addbtn.MouseUpEventHandler += addfunctionclick;
+                    addtextbtn.MouseUpEventHandler += addfunctionclick;
                 }
                 else
                 {
+
+                    var devicesFrameLayout = new FrameLayout
+                    {
+                        Height = Application.GetRealHeight(130),
+                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                    };
+                    middle.AddChidren(devicesFrameLayout);
+
+                    ///鏄剧ず鍥炬爣
+                    var actionsIcon = new Button
+                    {
+                        Width = Application.GetRealWidth(81),
+                        Height = Application.GetRealHeight(81),
+                        X = Application.GetRealWidth(104),
+                        Y = Application.GetRealHeight(25),
+                        // UnSelectedImagePath = "ZigeeLogic/time.png",
+
+                    };
+                    devicesFrameLayout.AddChidren(actionsIcon);
+
+
                     var actionsrowLayout = new RowLayout
                     {
-                        Height = Application.GetRealHeight(160),
+                        Width = Application.GetRealWidth(800),
+                        Height = Application.GetRealHeight(130),
+                        X = Application.GetRealWidth(222),
+                        LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                     };
-                    middle.AddChidren(actionsrowLayout);
+                    devicesFrameLayout.AddChidren(actionsrowLayout);
+
 
                     var linkType = int.Parse(ListActions[i]["LinkType"].ToString());
                     var actions = ListActions[i];
 
                     switch (linkType)
                     {
-                        case 10:
-                            {
-                                var delaytime = actions["DelayTime"].ToString();
-
-                                var btnDelayTime = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(382),
-                                    Height = Application.GetRealHeight(80),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Text = delaytime,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                actionsrowLayout.AddChidren(btnDelayTime);
-
-                                ///缂栬緫璁惧鐘舵�丅utton
-                                var timeedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                actionsrowLayout.AddRightView(timeedit);
-                                timeedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    DeviceTarget.DelayTimeView(actions);
-                                };
-
-                                //if (tag)
-                                //{  
-                                //    if (ListActions[i + 1]["LinkType"].ToString() == "0")
-                                //    {
-                                //        if (ListActions[i + 1].ContainsKey("Time"))
-                                //        {
-                                //            ListActions[i + 1].Remove("Time");
-                                //        }
-                                //        ListActions[i + 1].Add("Time", delaytime);
-                                //        ///绉婚櫎鏃ф暟鎹啀娣诲姞鏂版暟鎹�
-                                //        //Common.Logic.CurrentLogic.Actions.RemoveAt(i+1);
-                                //        //Common.Logic.CurrentLogic.Actions.Insert(i + 1, Common.Logic.CurrentLogic.Actions[i + 1]);
-                                //    }
-                                //}
-                            }
-                            break;
                         case 0:
                             {
-
                                 var obj1 = actions["DeviceAddr"].ToString();
                                 var obj2 = actions["Epoint"].ToString();
                                 var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); });
@@ -1023,21 +1136,12 @@
                                     continue;
                                 }
 
-                                if (i != 0 && ListActions[i - 1]["LinkType"].ToString() != "10")
-                                {
-                                    if (ListActions[i].ContainsKey("Time"))
-                                    {
-                                        ListActions[i].Remove("Time");
-                                    }
-                                    ListActions[i].Add("Time", 0);
-                                }
-
                                 ///璁惧鍚嶇ОButton
                                 var btndevicename = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(382),
-                                    Height = Application.GetRealHeight(80),
+                                    Y = Application.GetRealHeight(20),
+                                    Height = Application.GetRealHeight(50),
+                                    Width = Application.GetRealWidth(450),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Text = deviceinof.DeviceEpointName,
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
@@ -1047,13 +1151,12 @@
                                 ///鍖哄煙(鎴块棿)鍚嶇ОButton
                                 var btnregionname = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
-                                    Y = Application.GetRealHeight(80),
-                                    Width = Application.GetRealWidth(382),
+                                    Y = btndevicename.Bottom + Application.GetRealHeight(10),
+                                    Width = Application.GetRealWidth(450),
                                     TextAlignment = TextAlignment.CenterLeft,
-                                    Height = Application.GetRealHeight(80),
+                                    Height = Application.GetRealHeight(50),
                                     Text = "",//Language.StringByID(MyInternationalizationString.customroom),
-                                    TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
                                 actionsrowLayout.AddChidren(btnregionname);
                                 ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
@@ -1061,34 +1164,27 @@
                                 ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
                                 var devicestatus = new Button
                                 {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
+                                    Width = Application.GetRealWidth(350),
+                                    Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
                                     TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 340),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    X = Application.GetRealWidth(450),
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
                                 actionsrowLayout.AddChidren(devicestatus);
 
                                 ///缂栬緫璁惧鐘舵�丅utton
                                 var deviceedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
                                 actionsrowLayout.AddRightView(deviceedit);
 
                                 ///缂栬緫鐐瑰嚮浜嬩欢
                                 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);
@@ -1099,6 +1195,8 @@
                                 {
                                     case DeviceType.OnOffOutput:
                                         {
+                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png";
+
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
                                             {
@@ -1108,13 +1206,20 @@
                                             {
                                                 if (status["TaskType"].ToString() == "1")
                                                 {
-                                                    if (status["Data1"].ToString() == "1")
+                                                    if (status["Data1"].ToString() == "0")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.open);
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+
                                                     }
-                                                    else
+                                                    else if (status["Data1"].ToString() == "1")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.close);
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+
+                                                    }
+                                                    else if (status["Data1"].ToString() == "2")
+                                                    {
+
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
                                                     }
                                                 }
 
@@ -1124,6 +1229,7 @@
                                         break;
                                     case DeviceType.DimmableLight:
                                         {
+                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png";
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
                                             {
@@ -1139,13 +1245,14 @@
                                                 }
                                                 else if (status["TaskType"].ToString() == "1")
                                                 {
-                                                    if (status["Data1"].ToString() == "1")
+
+                                                    if (status["Data1"].ToString() == "0")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.open);
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
                                                     }
-                                                    else
+                                                    else if (status["Data1"].ToString() == "2")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.close);
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
                                                     }
                                                 }
 
@@ -1156,6 +1263,7 @@
                                         break;
                                     case DeviceType.WindowCoveringDevice:
                                         {
+                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png";
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
                                             {
@@ -1167,17 +1275,161 @@
                                                 {
                                                     if (status["Data1"] == "0")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.open);
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
                                                     }
                                                     else if (status["Data1"] == "1")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.close);
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
                                                     }
                                                     else if (status["Data1"] == "5")
                                                     {
-                                                        devicestatus.Text = devicestatus.Text + status["Data2"] + "%";
+                                                        devicestatus.Text = status["Data2"] + "%";
                                                     }
                                                 }
+
+                                            }
+                                        }
+                                        break;
+                                    case DeviceType.AirSwitch:
+                                        {
+                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png";
+
+                                            var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
+                                            if (TaskList == null)
+                                            {
+                                                continue;
+                                            }
+                                            foreach (var status in TaskList)
+                                            {
+                                                if (status["TaskType"].ToString() == "1")
+                                                {
+                                                    if (status["Data1"].ToString() == "0")
+                                                    {
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+
+                                                    }
+                                                    else if (status["Data1"].ToString() == "1")
+                                                    {
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+
+                                                    }
+                                                    else if (status["Data1"].ToString() == "2")
+                                                    {
+
+                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+                                                    }
+                                                }
+
+                                            }
+
+                                        }
+                                        break;
+                                    case DeviceType.Thermostat:
+                                        {
+                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png";
+
+                                            var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
+                                            if (TaskList == null)
+                                            {
+                                                continue;
+                                            }
+                                            string modetext = "", temperaturetext="", speedtext = "";
+                                            bool ifclose = false;
+                                            foreach (var status in TaskList)
+                                            {
+                                                if (status["TaskType"].ToString() == "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;
+                                                    }
+
+                                                }
+                                                else if (status["TaskType"].ToString() == "5")
+                                                {
+                                                    if (status["Data1"] == "3")
+                                                    {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍)
+                                                        switch (status["Data2"])
+                                                        {
+                                                            case "3":
+                                                                {
+                                                                    modetext = Language.StringByID(MyInternationalizationString.logiccool);
+                                                                }
+                                                                break;
+                                                            case "4":
+                                                                {
+                                                                    modetext = Language.StringByID(MyInternationalizationString.logicheat);
+                                                                }
+                                                                break;
+                                                            case "1":
+                                                                {
+                                                                    modetext = Language.StringByID(MyInternationalizationString.logicauto);
+                                                                }
+                                                                break;
+                                                            case "8":
+                                                                {
+                                                                    modetext = Language.StringByID(MyInternationalizationString.logicdry);
+                                                                }
+                                                                break;
+                                                            case "7":
+                                                                {
+                                                                    modetext = Language.StringByID(MyInternationalizationString.logicfanonly);
+                                                                }
+                                                                break;
+                                                        }
+                                                    }
+                                                    else if (status["Data1"] == "6")
+                                                    {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;)
+                                                        switch (status["Data2"])
+                                                        {
+                                                            case "1":
+                                                                {
+                                                                    speedtext = Language.StringByID(MyInternationalizationString.logiclow);
+                                                                }
+                                                                break;
+
+                                                            case "2":
+                                                                {
+                                                                    speedtext = Language.StringByID(MyInternationalizationString.logicmedium);
+                                                                }
+                                                                break;
+                                                            case "3":
+                                                                {
+                                                                    speedtext = Language.StringByID(MyInternationalizationString.logichigh);
+                                                                }
+                                                                break;
+
+                                                        }
+                                                    }
+                                                    //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟
+                                                    else if (status["Data1"] == "4" || status["Data1"] == "5" || status["Data1"] == "7")
+                                                    {
+                                                        var s = int.Parse(status["Data2"]) /100;
+                                                        temperaturetext = s.ToString();
+                                                    }
+                                                    else if (status["Data1"] == "20")
+                                                    {
+                                                        temperaturetext = "鏃�";
+                                                    }
+
+
+                                                }
+
+                                            }
+                                            if (ifclose)
+                                            {
+                                                devicestatus.Text = modetext + ";" + temperaturetext + "鈩�;" + speedtext;
+                                            }
+                                            else
+                                            {
+                                                devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
 
                                             }
                                         }
@@ -1196,18 +1448,37 @@
                                 {
                                     continue;
                                 }
-                                ///鏄剧ず閫昏緫鍚嶇О
-                                var btnlogic = new Button
+
+                                actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png";
+                                ///璁惧鍚嶇ОButton
+                                var btndevicename = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
+                                    Y = Application.GetRealHeight(20),
+                                    Height = Application.GetRealHeight(50),
                                     Width = Application.GetRealWidth(500),
                                     TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
                                     Text = sceneinof.Name,
                                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
                                 };
-                                actionsrowLayout.AddChidren(btnlogic);
+                                actionsrowLayout.AddChidren(btndevicename);
+
+                                ///鍖哄煙(鎴块棿)鍚嶇ОButton
+                                var btnregionname = new Button
+                                {
+                                    Y = btndevicename.Bottom + Application.GetRealHeight(10),
+                                    Width = Application.GetRealWidth(500),
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    Height = Application.GetRealHeight(50),
+                                    Text = "",//Language.StringByID(MyInternationalizationString.customroom),
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                };
+                                actionsrowLayout.AddChidren(btnregionname);
+                                /////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
+                                Common.Room room = new Common.Room();
+                                btnregionname.Text = room.GetRoomNameBySceneId(sceneinof.Id);
+                                //Send.RoomNmae(btnregionname, deviceinof);
+
+
 
                             }
                             break;
@@ -1221,7 +1492,6 @@
                                 ///鏄剧ず閫昏緫鍚嶇О
                                 var btnlogic = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
                                     Width = Application.GetRealWidth(500),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
@@ -1234,9 +1504,9 @@
 
                                 var logicedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
                                 actionsrowLayout.AddRightView(logicedit);
                                 logicedit.MouseUpEventHandler += (sender, e) =>
@@ -1275,7 +1545,6 @@
                             {
                                 var btnsecurity = new Button
                                 {
-                                    X = Application.GetRealWidth(40),
                                     Width = Application.GetRealWidth(700),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
@@ -1283,14 +1552,14 @@
                                     //TextColor = 0xff121212,
                                     TextID = MyInternationalizationString.security,
                                 };
-                                actionsrowLayout.AddChidren(btnsecurity);
+                                //actionsrowLayout.AddChidren(btnsecurity);
 
 
                                 var btnsecurityedit = new Button
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                                 };
                                 actionsrowLayout.AddRightView(btnsecurityedit);
                                 btnsecurityedit.MouseUpEventHandler += (sender, e) =>
@@ -1305,13 +1574,11 @@
                                 ///鏄剧ず瀹夐槻鏉′欢鐘舵�佹帶浠�
                                 var securitystatus = new Button
                                 {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
+                                    Width = Application.GetRealWidth(500),
+                                    Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
-                                    //TextColor = 0xff121212,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextAlignment = TextAlignment.CenterRight,
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                 };
                                 actionsrowLayout.AddChidren(securitystatus);
 
@@ -1320,11 +1587,12 @@
                                 {
                                     if (actions["Password"].ToString() == "888888")
                                     {
-
+                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
                                         securitystatus.Text = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
                                     }
                                     else
                                     {
+                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
                                         securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal);
 
                                     }
@@ -1333,22 +1601,77 @@
                                 {
                                     if (actions["SecurityModeId"].ToString() == "1")
                                     {
-
+                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/athome.png";
                                         securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison);
                                     }
                                     else if (actions["SecurityModeId"].ToString() == "2")
                                     {
+                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png";
                                         securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
                                     }
                                 }
 
                             }
                             break;
+                        case 7:
+                            {
+                                var delaytimevalue = int.Parse(actions["DelayTime"].ToString());
+                                var Minutes = delaytimevalue / 60;
+                                var seconds = delaytimevalue % 60;
+
+                                actionsIcon.UnSelectedImagePath = "ZigeeLogic/delay.png";
+                                ///寤舵椂Button
+                                var delaytimeBtn = new Button
+                                {
+                                    Width = Application.GetRealWidth(500),
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                                };
+                                actionsrowLayout.AddChidren(delaytimeBtn);
+                                if (Minutes != 0)
+                                {
+                                    if (seconds == 0)
+                                    {
+                                        delaytimeBtn.Text = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute);
+                                    }
+                                    else
+                                    {
+                                        delaytimeBtn.Text = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute) + seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
+
+                                    }
+                                }
+                                else
+                                {
+                                    delaytimeBtn.Text = seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
+                                }
+
+
+                                ///寤舵椂缂栬緫Button
+                                var delaytimeedit = new Button
+                                {
+                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
+                                    Text = Language.StringByID(MyInternationalizationString.edit),
+                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
+                                    Tag = i,
+                                };
+                                actionsrowLayout.AddRightView(delaytimeedit);
+
+                                ///缂栬緫鐐瑰嚮浜嬩欢
+                                delaytimeedit.MouseUpEventHandler += (sender, e) =>
+                                {
+                                    var delayTime = new DelayTime();
+                                    UserView.HomePage.Instance.AddChidren(delayTime);
+                                    UserView.HomePage.Instance.PageIndex += 1;
+                                    delayTime.Show(int.Parse(delaytimeedit.Tag.ToString()), true);
+                                };
+
+                            };
+                            break;
                     }
                     ///鍒犻櫎鎺т欢
                     var del = new Button
                     {
-                        BackgroundColor = ZigbeeColor.Current.LogicDelBackgroundColor,
+                        BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1,
                         Text = Language.StringByID(MyInternationalizationString.del),
                     };
                     actionsrowLayout.AddRightView(del);
@@ -1377,98 +1700,173 @@
 
             #endregion
 
-            #region  ----鎺ㄩ�佽缃�----
-            /*
-            var pushRowLayout = new RowLayout
+            #region -----姣忓ぉ 璁剧疆鍛ㄦ湡-----
+
+            var fraline1 = new FrameLayout
             {
-                Height = Application.GetRealHeight(150),
+                Height = Application.GetRealHeight(30),
             };
-            middle.AddChidren(pushRowLayout);
- 
-            var btnpushtitle = new Button
-            {
-                //Text = "鎺ㄩ�佽缃�",
-                //TextSize = 16,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                //Gravity = Gravity.CenterVertical,
-                TextID = MyInternationalizationString.pushset,
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                Y = Application.GetRealHeight(90),
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                TextSize = 16,
-                //TextID = MyInternationalizationString.execute,
-            };
-            pushRowLayout.AddChidren(btnpushtitle);
- 
-            var pushswitchRowlayout = new RowLayout
+            middle.AddChidren(fraline1);
+
+
+            var weekFrameLayout = new FrameLayout
             {
                 Height = Application.GetRealHeight(160),
-                LineColor = ZigbeeColor.Current.LogicLineColor,
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
             };
-            middle.AddChidren(pushswitchRowlayout);
- 
+            middle.AddChidren(weekFrameLayout);
+            var weekRowLayout = new RowLayout
+            {
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(965),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(58),
+                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+            };
+            weekFrameLayout.AddChidren(weekRowLayout);
+
+            var settxet = new Button
+            {
+                Text = Language.StringByID(MyInternationalizationString.setupcycle),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(60),
+                Gravity = Gravity.CenterVertical,
+            };
+            weekRowLayout.AddChidren(settxet);
+            var btnweektext = new Button
+            {
+                Width = Application.GetRealWidth(595),
+                Height = Application.GetRealHeight(60),
+                TextAlignment = TextAlignment.CenterRight,
+                //Text = "姣忓ぉ",
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextID = MyInternationalizationString.everyday,
+                Y = Application.GetRealHeight(35),
+                X = settxet.Right,
+            };
+            weekRowLayout.AddChidren(btnweektext);
+
+            var nextBtn = new Button
+            {
+
+                Width = Application.GetRealWidth(58),
+                Height = Application.GetRealHeight(58),
+                UnSelectedImagePath = "ZigeeLogic/next.png",
+                X = Application.GetRealWidth(965 - 58),
+                Gravity = Gravity.CenterVertical,
+
+            };
+            weekRowLayout.AddChidren(nextBtn);
+
+            UpdateWeek(btnweektext);
+            EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
+            {
+                /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
+                var cycle = new Cycle(() => { UpdateWeek(btnweektext); });
+                UserView.HomePage.Instance.AddChidren(cycle);
+                UserView.HomePage.Instance.PageIndex += 1;
+                cycle.Show();
+
+                //var cyclicCycle = new CyclicCycle(() => { UpdateWeek(btnweektext); });
+                //UserView.HomePage.Instance.AddChidren(cyclicCycle);
+                //UserView.HomePage.Instance.PageIndex += 1;
+                //cyclicCycle.Show();
+            };
+            btnweektext.MouseUpEventHandler += cycleclick;
+            nextBtn.MouseUpEventHandler += cycleclick;
+            #endregion
+
+            #region  ----鎺ㄩ�佽缃�----
+
+            var pushFrameLayout = new FrameLayout
+            {
+                Height = Application.GetRealHeight(160),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+            };
+            middle.AddChidren(pushFrameLayout);
+
+            var pushswitchRowlayout = new RowLayout
+            {
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(965),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(58),
+                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+            };
+            pushFrameLayout.AddChidren(pushswitchRowlayout);
+
             var btnswitchtxet = new Button
             {
-                //Text = "鎺ㄩ�佸紑鍏�",
-                X = Application.GetRealWidth(40),
                 TextAlignment = TextAlignment.CenterLeft,
-                Gravity = Gravity.CenterVertical,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(60),
+                Gravity = Gravity.CenterVertical,
                 TextID = MyInternationalizationString.pushswitch,
             };
             pushswitchRowlayout.AddChidren(btnswitchtxet);
- 
+
             var btnswitch = new Button
             {
-                Width = Application.GetMinRealAverage(183),
-                Height = Application.GetMinRealAverage(123),
-                UnSelectedImagePath = "ZigeeLogic/Switch.png",
-                SelectedImagePath = "ZigeeLogic/SwitchSelected.png",
-                X = Application.GetRealWidth(1080 - 200),
+                Width = Application.GetMinRealAverage(104),
+                Height = Application.GetMinRealAverage(63),
+                UnSelectedImagePath = "ZigeeLogic/logicclose.png",
+                SelectedImagePath = "ZigeeLogic/logicopen.png",
+                X = Application.GetRealWidth(965 - 104),
                 Gravity = Gravity.CenterVertical,
             };
             pushswitchRowlayout.AddChidren(btnswitch);
- 
             btnswitch.MouseUpEventHandler += (sender1, e1) =>
             {
                 btnswitch.IsSelected = !btnswitch.IsSelected;
                 if (btnswitch.IsSelected)
                 {
- 
+
                 }
                 else
                 {
- 
+
                 }
             };
- 
-            var custompushRowLayout = new RowLayout
+
+
+            var custompushFrameLayout = new FrameLayout
             {
                 Height = Application.GetRealHeight(160),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
             };
-            middle.AddChidren(custompushRowLayout);
- 
+            middle.AddChidren(custompushFrameLayout);
+
+            var custompushRowLayout = new RowLayout
+            {
+                Y = Application.GetRealHeight(30),
+                Width = Application.GetRealWidth(965),
+                Height = Application.GetRealHeight(130),
+                X = Application.GetRealWidth(58),
+                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+            };
+            custompushFrameLayout.AddChidren(custompushRowLayout);
+
             var btncustompush = new Button
             {
                 TextID = MyInternationalizationString.custompush,
-                //Text = "鑷畾涔夋帹閫�",
                 TextAlignment = TextAlignment.CenterLeft,
-                Width = Application.GetRealWidth(300),
-                X = Application.GetRealWidth(40),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(60),
+                Gravity = Gravity.CenterVertical,
             };
             custompushRowLayout.AddChidren(btncustompush);
- 
- 
+
+
             var custompushback = new Button
             {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(110),
+                Width = Application.GetRealWidth(58),
+                Height = Application.GetRealHeight(58),
                 UnSelectedImagePath = "ZigeeLogic/next.png",
-                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
-                X = Application.GetRealWidth(1080 - 140),
+                X = Application.GetRealWidth(965 - 58),
                 Gravity = Gravity.CenterVertical,
             };
             custompushRowLayout.AddChidren(custompushback);
@@ -1478,34 +1876,41 @@
                 UserView.HomePage.Instance.AddChidren(CustomText);
                 UserView.HomePage.Instance.PageIndex += 1;
                 CustomText.Show();
- 
+
             };
             btncustompush.MouseUpEventHandler += customclick;
             custompushback.MouseUpEventHandler += customclick;
             custompushRowLayout.MouseUpEventHandler += customclick;
-            */
+
             #endregion
 
 
+            var saveFrameLayout = new FrameLayout
+            {
+                Y = middle.Bottom,
+                Height = Application.GetRealHeight(180),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
+            this.AddChidren(saveFrameLayout);
+
             var btnsave = new Button
             {
-                Height = Application.GetRealHeight(150),//194
-                Y = middle.Bottom + Application.GetRealHeight(15),
-                //Text = "淇濆瓨",
-                Width = Application.GetRealWidth(500),
-                Radius = (uint)Application.GetRealHeight(50),
-                BackgroundColor = ZigbeeColor.Current.LogicButtonBlueColor,
-                X = Application.GetRealWidth(290),
+                X = Application.GetRealWidth(85),
+                Height = Application.GetRealHeight(130),//194
+                Width = Application.GetRealWidth(910),
+                Radius = (uint)Application.GetRealHeight(60),
+                BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
                 TextID = MyInternationalizationString.Save,
+                TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
             };
-            if (Common.Logic.CurrentLogic.Conditions.Count != 0 && Common.Logic.CurrentLogic.Actions.Count != 0)
-            {
-                AddChidren(btnsave);
-            }
+            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();
@@ -1572,41 +1977,23 @@
                 case 3:
                     {
 
-                        string len = "";
-                        int maxvalue = 0, minvalue = 0;
+                        string len = "", value = "";
                         var stringvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2);
                         var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length));
                         for (int j = 31; j >= 0; j--)
                         {
                             len += str.Substring(j, 1);
                         }
-                        //鎵惧嚭鏈�灏忓��
                         for (int j = 0; j < len.Length; j++)
                         {
                             var strvalue = len.Substring(j, 1);
                             if (strvalue == "1")
                             {
-                                minvalue = j + 1;
-                                break;
+                                value += (j + 1).ToString() + ",";
                             }
                         }
-                        //鎵惧嚭鏈�澶у��
-                        for (int j = 0; j < len.Length; j++)
-                        {
-                            var strvalue = len.Substring(j, 1);
-                            if (strvalue == "1")
-                            {
-                                maxvalue = j + 1;
-                            }
-                        }
-                        if (minvalue == maxvalue)
-                        {
-                            btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day);
-                        }
-                        else
-                        {
-                            btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day) + "-" + Language.StringByID(MyInternationalizationString.monthly) + maxvalue.ToString() + Language.StringByID(MyInternationalizationString.day);
-                        }
+                        btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day);
+
                     }; break;
                 case 4:
                     {
@@ -1827,129 +2214,240 @@
 
         }
 
-        void ConditionView()
+        void ConditionView(bool edit)
         {
             Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-            if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+
+            #region 缁勫悎鏉′欢View
+            FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 };
+            this.AddChidren(flMain);
+            flMain.MouseUpEventHandler += (sender2, e2) =>
             {
-                #region 缁勫悎鏉′欢View
-                FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
-                this.AddChidren(flMain);
-                flMain.MouseUpEventHandler += (sender2, e2) =>
-                {
-                    flMain.RemoveFromParent();
-                };
+                flMain.RemoveFromParent();
+            };
 
-                var frameLayout = new FrameLayout
-                {
-                    Y = Application.GetRealHeight(1920 - 680 - 50),
-                    Height = Application.GetRealHeight(680),
-                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                    Width = Application.GetRealWidth(1000),
-                    X = Application.GetRealWidth(40),
-                    Radius = (uint)Application.GetRealHeight(40),
-                };
-                flMain.AddChidren(frameLayout);
+            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);
 
-                var titlerow = new FrameLayout
-                {
-                    Height = Application.GetRealHeight(150),
-                };
-                frameLayout.AddChidren(titlerow);
+            #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 titlebtn = new Button
-                {
-                    //Text = "璇烽�夋嫨澶氭潯浠剁粍鍚�",
-                    TextID = MyInternationalizationString.multicondition,
-                    TextSize = 16,
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                };
-                titlerow.AddChidren(titlebtn);
+            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),
 
-                var androw = new RowLayout
-                {
-                    Height = Application.GetRealHeight(160),
-                    Y = titlerow.Bottom,
-                };
-                frameLayout.AddChidren(androw);
-                var andbtn = new Button
-                {
-                    Width = Application.GetRealWidth(600),
-                    TextID = MyInternationalizationString.Allconditions,
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    //Text = "婊¤冻鍏ㄩ儴鏉′欢鏃�",
-                    TextAlignment = TextAlignment.CenterLeft,
-                    X = Application.GetRealHeight(50),
-                };
-                androw.AddChidren(andbtn);
+            };
+            timetype.AddChidren(Btncomplete);
+            #endregion
 
-                var orrow = new RowLayout
-                {
-                    Height = Application.GetRealHeight(160),
-                    Y = androw.Bottom,
-                };
-                frameLayout.AddChidren(orrow);
-                var orbtn = new Button
-                {
-                    Width = Application.GetRealWidth(600),
-                    TextID = MyInternationalizationString.anycondition,
-                    //Text = "婊¤冻浠讳竴鏉′欢鏃�",
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    TextAlignment = TextAlignment.CenterLeft,
-                    X = Application.GetRealHeight(50)
-                };
-                orrow.AddChidren(orbtn);
+            #region  -------婊¤冻鎵�鏈夋潯浠�   婊¤冻鍏朵腑涓�涓潯浠�
 
-                var cancelbtn = new Button
-                {
-                    TextID = MyInternationalizationString.cancel,
-                    TextSize = 16,
-                    Y = orrow.Bottom + Application.GetRealHeight(30),
-                    Height = Application.GetRealHeight(160),
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
-                };
-                frameLayout.AddChidren(cancelbtn);
-                cancelbtn.MouseUpEventHandler += (sender4, e4) =>
-                {
-                    flMain.RemoveFromParent();
-                };
-                #endregion
 
-                //婊¤冻鍏ㄩ儴鏉′欢鏃剁偣鍑讳簨浠� simulation;
-                EventHandler<MouseEventArgs> andclick = (sender6, e6) =>
+            #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 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 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)
                 {
-                    flMain.RemoveFromParent();
+                    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;
-                    var addLogicPage = new AddLogicPage();
-                    UserView.HomePage.Instance.AddChidren(addLogicPage);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    addLogicPage.Show();
-                };
-                androw.MouseUpEventHandler += andclick;
-                andbtn.MouseUpEventHandler += andclick;
 
-                //婊¤冻浠讳竴鏉′欢鏃剁偣鍑讳簨浠�
-                EventHandler<MouseEventArgs> orclick = (sender6, e6) =>
+                }
+                if (orSelected.Visible)
                 {
-                    flMain.RemoveFromParent();
                     Common.Logic.CurrentLogic.Relationship = 1;
+
+                }
+                if (edit)
+                {
+                    if (Common.Logic.CurrentLogic.LogicId != 0)
+                    {
+                        Send.LogicControlSwitch(Common.Logic.CurrentLogic);
+                    }
+                    var logicCommunalPage = new LogicCommunalPage();
+                    UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    logicCommunalPage.Show(() => { });
+                }
+                else
+                {
                     var addLogicPage = new AddLogicPage();
                     UserView.HomePage.Instance.AddChidren(addLogicPage);
                     UserView.HomePage.Instance.PageIndex += 1;
                     addLogicPage.Show();
-                };
-                orrow.MouseUpEventHandler += orclick;
-                orbtn.MouseUpEventHandler += orclick;
-            }
-            else
-            {
-                var addLogicPage = new AddLogicPage();
-                UserView.HomePage.Instance.AddChidren(addLogicPage);
-                UserView.HomePage.Instance.PageIndex += 1;
-                addLogicPage.Show();
-            }
-        }
+                }
+            };
 
+        }
     }
 }

--
Gitblit v1.8.0