From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 2221 ++++++++++++++--------------------------------------------
 1 files changed, 538 insertions(+), 1,683 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index eb85316..837877f 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -4,6 +4,7 @@
 using Shared;
 using Shared.Common;
 using Shared.Phone;
+using Shared.Phone.Device.Logic.LogicView;
 using Shared.R;
 using ZigBee.Device;
 
@@ -18,81 +19,39 @@
             Tag = "Logic";
         }
         EditText logicTextBox;
-        public void Show(Action action)
+        public async void Show(Action action)
         {
-            
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
-            {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
-            };
-            this.AddChidren(topRowLayout);
 
-            var titleName = new Button
-            {
-                TextSize = 17,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(600),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                TextID = MyInternationalizationString.selection,
-            };
-            topRowLayout.AddChidren(titleName);
+            #region  View甯冨眬浠g爜
+            UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
             if (Common.Logic.CurrentLogic.LogicId != 0)
             {
-                titleName.Text = Language.StringByID(MyInternationalizationString.editautomation);
+                view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editautomation);
             }
             else
             {
-                titleName.Text = Language.StringByID(MyInternationalizationString.newautomation);
+                view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.newautomation);
             }
-
-            var clickBtn = new Button
+            view.clickBtn.MouseDownEventHandler += (sender, e) =>
             {
-                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(30),
-                Height = Application.GetRealHeight(51),
-                X = Application.GetRealWidth(81),
-                Y = Application.GetRealHeight(98),
-                //Gravity = Gravity.CenterVertical;
-                UnSelectedImagePath = "ZigeeLogic/back.png",
-            };
-            topRowLayout.AddChidren(back);
-            back.MouseDownEventHandler += (sender, e) =>
-            {
+               // UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
                 action();
                 RemoveFromParent();
             };
-
-
-
-            #endregion
-
-
-
             var middle = new VerticalScrolViewLayout
             {
-                Y = topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184-180),
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184-180),
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
-
+            var saveBtn = new SaveView();
+            saveBtn.frameLayout.Y = middle.Bottom;
+            saveBtn.frameLayout.Height = Application.GetRealHeight(180);
+            this.AddChidren(saveBtn.Show());
+            #endregion
 
             #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О-----
             var logicnamefl = new FrameLayout
@@ -138,63 +97,13 @@
             #endregion
 
             #region -----鏄剧ず閫昏緫鏉′欢-----
+            Addview addconditionview = new Addview();
+            addconditionview.iconBtn.Visible = true;
+            addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition;
+            middle.AddChidren(addconditionview.AddDeviceView());
 
-
-            var conditionFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            middle.AddChidren(conditionFrameLayout);
-
-
-            var conditionRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(965),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(58),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            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),
-                TextSize = 15,
-                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(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/add.png",
-                X = Application.GetRealWidth(965 - 58),
-                Gravity = Gravity.CenterVertical,
-
-            };
-            conditionRowLayout.AddChidren(conditionadd);
             ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
-            EventHandler<MouseEventArgs> conditionaddclick = (sender, e) =>
+            addconditionview.clickBtn.MouseUpEventHandler+= (sender, e) =>
             {
                 if (Common.Logic.CurrentLogic.Conditions.Count == 1)
                 {
@@ -208,8 +117,6 @@
                     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);
@@ -252,37 +159,10 @@
             {
                 if (i == (ListConditions.Count - 1))
                 {
-
-                    var addfl = new FrameLayout
-                    {
-                        Height = Application.GetRealHeight(160 + 30 + 50),
-                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                    };
-                    middle.AddChidren(addfl);
-                    var addbtn = new Button
-                    {
-                        Height = Application.GetRealHeight(130 + 50),
-                        Width = Application.GetRealWidth(908),
-                        Y = Application.GetRealHeight(30),
-                        X = Application.GetRealWidth(86),
-                        UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png",
-                    };
-                    addfl.AddChidren(addbtn);
-
-
-                    var addtextbtn = new Button
-                    {
-                        Height = Application.GetRealHeight(58),
-                        Width = Application.GetRealWidth(300),
-                        Y = Application.GetRealHeight(45 + 30),
-                        TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                        TextID = MyInternationalizationString.addconditions,
-                        X = Application.GetRealWidth(390),
-                        TextSize = 14,
-                    };
-                    addfl.AddChidren(addtextbtn);
-
-                    EventHandler<MouseEventArgs> addconditionsclick = (sender, e) =>
+                    LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
+                    addflview.titleBtn.TextID = MyInternationalizationString.addconditions;
+                    middle.AddChidren(addflview.AddFl());
+                    addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
                     {
                         if (Common.Logic.CurrentLogic.Conditions.Count == 1)
                         {
@@ -296,307 +176,130 @@
                             addLogicPage.Show();
                         }
                     };
-                    addbtn.MouseUpEventHandler += addconditionsclick;
-                    addtextbtn.MouseUpEventHandler += addconditionsclick;
                 }
                 else
                 {
-                    var devicesFrameLayout = new FrameLayout
-                    {
-                        Height = Application.GetRealHeight(130),
-                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                    };
-                    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);
+                    SelectedDeviceView selecteddevice = new SelectedDeviceView();
+                    selecteddevice.Show(middle);
+                    selecteddevice.stateRow.AddRightView(selecteddevice.edit);
+                    selecteddevice.stateRow.AddRightView(selecteddevice.del);
 
                     var Type = int.Parse(ListConditions[i]["Type"]);
                     var conditions = ListConditions[i];
+                    string name = "";
+                    string icon = "";
+                    string state = "";
                     switch (Type)
                     {
-
                         /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆)
                         case 0:
                             {
-                                ///鏄剧ず鏃堕棿
-                                var timevalue = new Button
-                                {
-                                    Width = Application.GetRealWidth(200),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                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),
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(timeTxet);
-
-
-                                var timeedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                conditionsRowLayout.AddRightView(timeedit);
-
-                                timeedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var timePoint = new TimePoint();
-                                    UserView.HomePage.Instance.AddChidren(timePoint);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    timePoint.IsEditor = true;
-                                    timePoint.Show(conditions);
-                                };
 
                                 //"0姝e父鏃堕棿鐐�","1鏃ュ嚭鏃堕棿","2鏃ヨ惤鏃堕棿","3姝e崍鏃堕棿"
                                 switch (int.Parse(conditions["DateType"]))
                                 {
                                     case 0:
                                         {
+                                            name = Language.StringByID(MyInternationalizationString.immediateexecution);
+                                            icon = "ZigeeLogic/timepoint.png";
                                             string s = "";
                                             s = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
-                                            timevalue.Text = conditions["StartHour"] + ":" + s;
-                                            timeTxet.TextID = MyInternationalizationString.immediateexecution;
-                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/timepoint.png";
+                                            state = conditions["StartHour"] + ":" + s;
+                                            
                                         }
                                         break;
                                     case 1:
-                                        timevalue.TextID = MyInternationalizationString.sunrise;
-                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/sunrise.png";
-                                        if (int.Parse(conditions["AdjustTime"]) > 0)
                                         {
-                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else if (int.Parse(conditions["AdjustTime"]) < 0)
-                                        {
-                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else
-                                        {
-                                            //timeTxet.Text = Language.StringByID(MyInternationalizationString.sunrise);
+                                            name = Language.StringByID(MyInternationalizationString.sunrise);
+                                            icon = "ZigeeLogic/sunrise.png";
+                                            if (int.Parse(conditions["AdjustTime"]) > 0)
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
+                                            }
+                                            else if (int.Parse(conditions["AdjustTime"]) < 0)
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
+                                            }
+                                            else
+                                            {
+                                                //timeTxet.Text = Language.StringByID(MyInternationalizationString.sunrise);
+                                            }
                                         }
                                         break;
                                     case 2:
-                                        timevalue.TextID = MyInternationalizationString.sunset;
-                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/sunset.png";
-                                        if (int.Parse(conditions["AdjustTime"]) > 0)
                                         {
-                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else if (int.Parse(conditions["AdjustTime"]) < 0)
-                                        {
-                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else
-                                        {
-                                            // timevalue.Text = Language.StringByID(MyInternationalizationString.sunset);
+                                            name = Language.StringByID(MyInternationalizationString.sunset);
+                                            icon = "ZigeeLogic/sunset.png";
+                                            if (int.Parse(conditions["AdjustTime"]) > 0)
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
+                                            }
+                                            else if (int.Parse(conditions["AdjustTime"]) < 0)
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
+                                            }
+                                            else
+                                            {
+                                                // timevalue.Text = Language.StringByID(MyInternationalizationString.sunset);
+                                            }
                                         }
                                         break;
                                     case 3:
-                                        timevalue.TextID = MyInternationalizationString.noon;
-                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/noon.png";
-                                        if (int.Parse(conditions["AdjustTime"]) > 0)
                                         {
-                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else if (int.Parse(conditions["AdjustTime"]) < 0)
-                                        {
-                                            timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else
-                                        {
-                                            // timeTxet.Text = Language.StringByID(MyInternationalizationString.noon);
+                                            name = Language.StringByID(MyInternationalizationString.noon);
+                                            icon = "ZigeeLogic/noon.png";
+                                            if (int.Parse(conditions["AdjustTime"]) > 0)
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
+                                            }
+                                            else if (int.Parse(conditions["AdjustTime"]) < 0)
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
+                                            }
+                                            else
+                                            {
+                                                // timeTxet.Text = Language.StringByID(MyInternationalizationString.noon);
+                                            }
                                         }
                                         break;
                                 }
-
+                          
                             }
                             break;
                         case 5:
                             {
-                                conditionIcon.UnSelectedImagePath = "ZigeeLogic/timeparagraph.png";
+                                icon = "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
-                                {
-                                    Width = Application.GetRealWidth(400),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2,
-                                    //TextColor = 0xff121212,
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                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,
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(timeTxet);
-
-                                var timeedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                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.IsEditor = true;
-                                    timePage.Show();
-                                };
+                                name = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2;
+                                state =Language.StringByID(MyInternationalizationString.timeframe);
                             }
                             break;
                         case 1:
                             {
-                                var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; });
-                                if (deviceinof == null)
-                                {
-                                    continue;
-                                }
-                                ///鏄剧ず璁惧鍚嶇О
-                                var btndevice = new Button
-                                {
-                                    Y = Application.GetRealHeight(20),
-                                    Height = Application.GetRealHeight(50),
-                                    Width = Application.GetRealWidth(400),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Text = deviceinof.DeviceEpointName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextSize = 14,
-                                };
-                                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.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                conditionsRowLayout.AddRightView(deviceedit);
-                                deviceedit.MouseUpEventHandler += (sender, e) =>
-                                {
-
-                                    if (deviceinof.Type != DeviceType.DoorLock)
-                                    {
-                                        var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                        this.AddChidren(flMain);
-                                        DeviceStateCondition.CurrentDeviceView(flMain, deviceinof, true);
-                                    }
-                                    else
-                                    {
-                                        var memberList = new MemberList();
-                                        UserView.HomePage.Instance.AddChidren(memberList);
-                                        UserView.HomePage.Instance.PageIndex += 1;
-                                        MemberList.edit = true;
-                                        memberList.Show(deviceinof, conditions);
-                                    }
-
-                                };
-
-                                ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
-                                var devicestatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(400),
-                                    Height = Application.GetRealHeight(130),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(400),
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(devicestatus);
+                                var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
+                                name = LocalDevice.Current.GetDeviceEpointName(deviceinof);
+                                selecteddevice.regionNameBtn.Visible = true;
+                                Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof);
 
                                 switch (deviceinof.Type)
                                 {
                                     case DeviceType.OnOffOutput:
                                         {
-                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/light.png";
+                                            icon = "ZigeeLogic/light.png";
                                             if (conditions["AttriButeId"] == "0")
                                             {
                                                 if (conditions["AttriButeData1"] == "1")
                                                 {
-                                                    devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+                                                    state = Language.StringByID(MyInternationalizationString.open);
                                                 }
                                                 else
                                                 {
-                                                    devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+                                                    state = Language.StringByID(MyInternationalizationString.close);
                                                 }
 
-                                            }
-                                        }
-                                        break;
-                                    case DeviceType.WindowCoveringDevice:
-                                        {
-                                            if (conditions["AttriButeId"] == "8")//鏈夋涔夛紝娌℃湁寮�鍏冲睘鎬d锛�
-                                            {
-                                                if (int.Parse(conditions["AttriButeData1"]) > 5)
-                                                {
-                                                    devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
-                                                }
-                                                else
-                                                {
-                                                    devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
-                                                }
                                             }
                                         }
                                         break;
@@ -604,27 +307,37 @@
                                         {
                                             var iASZonedevice = deviceinof as IASZone;
                                             var intvalue = conditions["AttriButeData1"];
-                                            conditionIcon.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
+                                            icon = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
                                             switch (iASZonedevice.IasDeviceType)
                                             {
                                                 case 13:
                                                     {
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.someone;
+                                                            state=Language.StringByID( MyInternationalizationString.someone);
                                                         }
                                                         else
                                                         {
                                                             int minute = int.Parse(conditions["IgnoreTime"]) / 60;
                                                             int second = int.Parse(conditions["IgnoreTime"]) % 60;
-                                                            if (second != 0)
+                                                            if (minute != 0 && second != 0)
                                                             {
-                                                                devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+                                                                state = 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);
+                                                                if (minute == 0 && second != 0)
+                                                                {
+                                                                    state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                }
+                                                                if (minute != 0 && second == 0)
+                                                                {
+                                                                    state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                }
+
                                                             }
                                                         }
                                                     }
@@ -632,10 +345,9 @@
                                                 case 21:
                                                 case 22:
                                                     {
-                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/doormagnetism.png";
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.logicopen;
+                                                            state =Language.StringByID( MyInternationalizationString.logicopen);
                                                         }
                                                         else
                                                         {
@@ -644,73 +356,78 @@
 
                                                                 int minute = int.Parse(conditions["IgnoreTime"]) / 60;
                                                                 int second = int.Parse(conditions["IgnoreTime"]) % 60;
-                                                                if (second != 0)
+                                                                if (minute != 0 && second != 0)
                                                                 {
-                                                                    devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime);
+                                                                    state = 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);
+                                                                    if (minute == 0 && second != 0)
+                                                                    {
+                                                                        state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime);
+
+                                                                    }
+                                                                    if (minute != 0 && second == 0)
+                                                                    {
+                                                                        state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime);
+
+                                                                    }
+
                                                                 }
 
                                                             }
                                                             else
                                                             {
-                                                                devicestatus.TextID = MyInternationalizationString.logicclose;
+                                                                state =Language.StringByID(MyInternationalizationString.logicclose);
                                                             }
                                                         }
                                                     }
                                                     break;
                                                 case 40:
                                                     {
-                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/smoke.png";
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.smokescreen;
+                                                            state =Language.StringByID(MyInternationalizationString.smokescreen);
                                                         }
 
                                                     }
                                                     break;
                                                 case 42:
                                                     {
-                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/waterleakage.png";
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.waterleakage;
+                                                            state =Language.StringByID( MyInternationalizationString.waterleakage);
                                                         }
                                                         else
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.noleakage;
+                                                            state =Language.StringByID( MyInternationalizationString.noleakage);
                                                         }
                                                     }
                                                     break;
                                                 case 43:
                                                     {
-                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/gas.png";
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.gas;
+                                                            state =Language.StringByID( MyInternationalizationString.gas);
                                                         }
 
                                                     }
                                                     break;
                                                 case 277:
                                                     {
-                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/waterleakage.png";
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.callthepolice;
+                                                            state =Language.StringByID( MyInternationalizationString.callthepolice);
                                                         }
 
                                                     }
                                                     break;
                                                 default:
                                                     {
-                                                        conditionIcon.UnSelectedImagePath = "ZigeeLogic/infraredsensor.png";
                                                         if (intvalue == "1")
                                                         {
-                                                            devicestatus.TextID = MyInternationalizationString.callthepolice;
+                                                            state =Language.StringByID(MyInternationalizationString.callthepolice);
                                                         }
                                                     }
                                                     break;
@@ -720,20 +437,20 @@
                                         break;
                                     case DeviceType.OnOffSwitch:
                                         {
-                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/panel.png";
-                                            devicestatus.Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"];
+                                            icon = "ZigeeLogic/panel.png";
+                                            state = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"];
                                         }
                                         break;
                                     case DeviceType.DoorLock:
                                         {
-                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/doorlock.png";
+                                            icon = "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 = Common.Logic.CurrentLogic.Accounts[a]["Account"];
+                                                        state = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
                                                         break;
 
                                                     }
@@ -743,244 +460,212 @@
                                         }
                                         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"] + "鈩�";
+                                            // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
+                                            var dev = deviceinof as TemperatureSensor;
+                                            if (conditions["Cluster_ID"] == "1026")
+                                            {
+                                                dev.SensorDiv = 1;
+                                            }
+                                            else
+                                            {
+                                                dev.SensorDiv = 2;
+                                            }
+                                            string s = "";
+                                            switch (conditions["Range"])
+                                            {
+                                                case "0":
+                                                    {
+                                                        s = ">";
+                                                    }
+                                                    break;
+                                                case "1":
+                                                    {
+                                                        s = "=";
+                                                    }
+                                                    break;
+                                                case "2":
+                                                    {
+                                                        s = "<";
+                                                    }
+                                                    break;
+                                                case "6":
+                                                    {
+                                                        s = "鈮�";
+                                                    }
+                                                    break;
+                                                case "7":
+                                                    {
+                                                        s = "鈮�";
+                                                    }
+                                                    break;
+                                            }
+                                            if (conditions["Cluster_ID"] == "1026")
+                                            {
+                                                icon = "ZigeeLogic/temperature.png";
+                                                state = s + conditions["AttriButeData1"] + "鈩�";
+                                            }
+                                            else
+                                            {
+                                                icon = "ZigeeLogic/humidity.png";
+                                                state = s + conditions["AttriButeData1"] + "%";
+                                            }
+                                            break;
+
                                         }
-                                        else
-                                        {
-                                            conditionIcon.UnSelectedImagePath = "ZigeeLogic/humidity.png";
-                                            devicestatus.Text = "<" + conditions["AttriButeData1"] + "%";
-                                        }
-                                        break;
 
-                                }
-
-                            }
-                            break;
-                        case 2:
-                            {
-                                var logicinof = Common.Logic.LogicList.Find((obj) => { return obj.LogicId.ToString() == conditions["Condition_LogicId"]; });
-                                if (logicinof == null)
-                                {
-                                    continue;
-                                }
-                                ///鏄剧ず閫昏緫鍚嶇О
-                                var btnlogic = new Button
-                                {
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = logicinof.LogicName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextSize = 14,
-                                    //TextColor = 0xff121212,
-                                };
-                                conditionsRowLayout.AddChidren(btnlogic);
-
-
-                                var logicedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                conditionsRowLayout.AddRightView(logicedit);
-                                logicedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var selectedLogicStatus = new SelectedLogicStatus();
-                                    UserView.HomePage.Instance.AddChidren(selectedLogicStatus);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    selectedLogicStatus.IsDeviceEditor = true;
-                                    selectedLogicStatus.Show(logicinof);
-                                };
-
-                                ///鏄剧ずLogic鏉′欢鐘舵�佹帶浠�
-                                var logicstatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(130),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(500),
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(logicstatus);
-
-                                if (conditions["IsValid"] == "1")
-                                {
-                                    logicstatus.Text = Language.StringByID(MyInternationalizationString.open1);
-                                }
-                                else
-                                {
-                                    logicstatus.Text = Language.StringByID(MyInternationalizationString.disable);
                                 }
                             }
                             break;
                         case 6:
                             {
-                                var btnsecurity = new Button
+                                switch (conditions["EnOrWithdrawMode"])
                                 {
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    //Text = "瀹夐槻",
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                    TextID = MyInternationalizationString.security,
-                                    TextSize = 14,
-                                };
-                                //conditionsRowLayout.AddChidren(btnsecurity);
+                                    case "0":
+                                        {
+                                            if (conditions["ModeId"] == "1")
+                                            {
+                                                icon = "ZigeeLogic/athome.png";
+                                                name = Language.StringByID(MyInternationalizationString.logicathomegarrison);
 
-
-                                var btnsecurityedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                conditionsRowLayout.AddRightView(btnsecurityedit);
-                                btnsecurityedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    //var securityPage = new SecurityPage();
-                                    //UserView.HomePage.Instance.AddChidren(securityPage);
-                                    //UserView.HomePage.Instance.PageIndex += 1;
-                                    //securityPage.IsDeviceEditor = true;
-                                    //securityPage.Show();
-
-                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                    this.AddChidren(flMain);
-                                    AddLogicPage.SecurityView(flMain, true);
-                                };
-
-                                ///鏄剧ず瀹夐槻鏉′欢鐘舵�佹帶浠�
-                                var securitystatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(500),
-                                    Height = Application.GetRealHeight(130),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(securitystatus);
-
-                                if (conditions["EnOrWithdrawMode"] == "1")
-                                {
-                                    conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
-                                    securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal);
-                                }
-                                else
-                                {
-                                    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);
-
-                                    }
+                                            }
+                                            else
+                                            {
+                                                icon = "ZigeeLogic/leavehome.png";
+                                                name = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
+                                            }
+                                        }
+                                        break;
+                                    case "1":
+                                        {
+                                            icon = "ZigeeLogic/withdrawal.png";
+                                            name = Language.StringByID(MyInternationalizationString.withdrawal);
+                                        }
+                                        break;
+                                    case "2":
+                                        {
+                                            icon = "ZigeeLogic/withdrawal.png";
+                                            name = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
+                                        }
+                                        break;
                                 }
                             }
                             break;
                         case 7:
                             {
-                                
-                                conditionIcon.UnSelectedImagePath = "ZigeeLogic/position.png";
-                                var btnlocation = new Button
-                                {
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextID = MyInternationalizationString.geographicalposition,
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(btnlocation);
-
-
-                                var btnlocationedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                conditionsRowLayout.AddRightView(btnlocationedit);
-                                btnlocationedit.MouseUpEventHandler += (sender, e) =>
-                                {
-
-                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                    this.AddChidren(flMain);
-                                    AddLogicPage.LocationView(flMain, true);
-                                };
-
-                                var locationstatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(130),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(500),
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                conditionsRowLayout.AddChidren(locationstatus);
+                                icon = "ZigeeLogic/position.png";
+                                name = Language.StringByID(MyInternationalizationString.geographicalposition);
                                 foreach (var radius in Common.Logic.CurrentLogic.Accounts)
                                 {
                                     if (radius["Type"] == "7")
                                     {
                                         if (conditions["AtHome"] == "1")
                                         {
-                                            locationstatus.Text = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�";
+                                            state = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�";
                                         }
                                         else
                                         {
-                                            locationstatus.Text = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�";
+                                            state = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�";
                                         }
                                     }
                                 }
                             }
                             break;
-
                     }
-                    ///鍒犻櫎鎺т欢
-                    var del = new Button
+                    if (Type != 1)
                     {
-                        BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1,
-                        Text = Language.StringByID(MyInternationalizationString.del),
-                    };
-                    conditionsRowLayout.AddRightView(del);
-
-                    del.MouseUpEventHandler += (sender, e) =>
+                        selecteddevice.ordinaryBtn.Visible = true;
+                        selecteddevice.iconBtn.UnSelectedImagePath = icon;
+                        selecteddevice.ordinaryBtn.Text = name;
+                        selecteddevice.selecetddevicestateBtn.Text = state;
+                    }
+                    else
                     {
-
-                        var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                                              Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
-                        alert.ResultEventHandler += (sender1, e1) =>
+                        //璁惧鐘舵��
+                        selecteddevice.deviceNameBtn.Visible = true;
+                        selecteddevice.iconBtn.UnSelectedImagePath = icon;
+                        selecteddevice.deviceNameBtn.Text = name;
+                        selecteddevice.selecetddevicestateBtn.Text = state;
+                    }
+                    ///缂栬緫
+                    selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
+                    {
+                        switch (Type)
                         {
-                            if (e1)
-                            {
-                                Common.Logic.CurrentLogic.Conditions.Remove(conditions);
-                                var logicCommunalPage = new LogicCommunalPage();
-                                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-                                UserView.HomePage.Instance.PageIndex += 1;
-                                logicCommunalPage.Show(() => { });
-                            }
-                        };
+
+                            /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆)
+                            case 0:
+                                {
+                                    var timePoint = new TimePoint();
+                                    UserView.HomePage.Instance.AddChidren(timePoint);
+                                    UserView.HomePage.Instance.PageIndex += 1;
+                                    timePoint.IsEditor = true;
+                                    timePoint.Show(conditions);
+                                }
+                                break;
+                            case 5:
+                                {
+                                    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.IsEditor = true;
+                                    timePage.Show();
+                                }
+                                break;
+                            case 1:
+                                {
+                                    var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
+                                    if (deviceinof.Type != DeviceType.DoorLock)
+                                    {
+                                        var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                                        this.AddChidren(flMain);
+                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic");
+                                    }
+                                    else
+                                    {
+                                        var memberList = new MemberList();
+                                        UserView.HomePage.Instance.AddChidren(memberList);
+                                        UserView.HomePage.Instance.PageIndex += 1;
+                                        MemberList.edit = true;
+                                        memberList.Show(deviceinof, conditions);
+                                    }
+                                }
+                                break;
+                            case 6:
+                                {
+                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                                    this.AddChidren(flMain);
+                                    AddLogicPage.SecurityView(flMain, true);
+                                }
+                                break;
+                            case 7:
+                                {
+                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                                    this.AddChidren(flMain);
+                                    AddLogicPage.LocationView(flMain, true);
+                                }
+                                break;
+                        }
+                    };
+                    ///鍒犻櫎鎺т欢
+                    selecteddevice.del.MouseUpEventHandler += (sender, e) =>
+                    {
+
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                        Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                        Language.StringByID(MyInternationalizationString.confrim));
                         alert.Show();
+
+                        alert.ConfirmClickEvent += () =>
+                        {
+                            Common.Logic.CurrentLogic.Conditions.Remove(conditions);
+                            selecteddevice.selecetdFrameLayout.RemoveFromParent();
+                            //var logicCommunalPage = new LogicCommunalPage();
+                            //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                            //UserView.HomePage.Instance.PageIndex += 1;
+                            //logicCommunalPage.Show(() => { });
+                        };
 
                     };
 
@@ -992,67 +677,16 @@
 
             #region  ----鏄剧ず鎵ц鐩爣----
 
-            var targetFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            middle.AddChidren(targetFrameLayout);
+            Addview addactionview = new Addview();
+            addactionview.iconBtn.Visible = true;
+            addactionview.titleBtn.TextID = MyInternationalizationString.execute;
+            middle.AddChidren(addactionview.AddDeviceView());
 
-
-            var targetRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(965),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(58),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            targetFrameLayout.AddChidren(targetRowLayout);
-
-
-            var btntargettitle = new Button
-            {
-
-                Text = Language.StringByID(MyInternationalizationString.execute),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                TextSize = 15,
-                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(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/add.png",
-                X = Application.GetRealWidth(965 - 58),
-                Gravity = Gravity.CenterVertical,
-            };
-            targetRowLayout.AddChidren(btntargetadd);
-            EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) =>
+            addactionview.clickBtn.MouseUpEventHandler+= (sender, e) =>
             {
                 Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-                var deviceTarget = new DeviceTarget();
-                UserView.HomePage.Instance.AddChidren(deviceTarget);
-                UserView.HomePage.Instance.PageIndex += 1;
-                deviceTarget.Show();
+                Method.View(IfString.Action_Logic,IfString.Action_LogicScene);
             };
-            btntargetadd1.MouseUpEventHandler += btntargetaddclick;
-            btntargetadd.MouseUpEventHandler += btntargetaddclick;
 
             List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
             ListActions.Clear();
@@ -1064,155 +698,41 @@
                 if (i == (ListActions.Count - 1))
                 {
 
-                    var addfl = new FrameLayout
-                    {
-                        Height = Application.GetRealHeight(160 + 30 + 50),
-                        BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                    };
-                    middle.AddChidren(addfl);
-                    var addbtn = new Button
-                    {
-                        Height = Application.GetRealHeight(130 + 50),
-                        Width = Application.GetRealWidth(908),
-                        Y = Application.GetRealHeight(30),
-                        X = Application.GetRealWidth(86),
-                        UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png",
-                    };
-                    addfl.AddChidren(addbtn);
-
-
-                    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),
-                        TextSize = 14,
-                    };
-                    addfl.AddChidren(addtextbtn);
-                    EventHandler<MouseEventArgs> addfunctionclick = (sender, e) =>
+                    LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
+                    addflview.titleBtn.TextID = MyInternationalizationString.addfunction;
+                    middle.AddChidren(addflview.AddFl());
+                    addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
                     {
                         Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-                        var deviceTarget = new DeviceTarget();
-                        UserView.HomePage.Instance.AddChidren(deviceTarget);
-                        UserView.HomePage.Instance.PageIndex += 1;
-                        deviceTarget.Show();
+                        Method.View(IfString.Action_Logic, IfString.Action_LogicScene);
                     };
-                    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
-                    {
-                        Width = Application.GetRealWidth(800),
-                        Height = Application.GetRealHeight(130),
-                        X = Application.GetRealWidth(222),
-                        LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-                    };
-                    devicesFrameLayout.AddChidren(actionsrowLayout);
-
-
+                    SelectedDeviceView actiondevice = new SelectedDeviceView();
+                    actiondevice.Show(middle);
                     var linkType = int.Parse(ListActions[i]["LinkType"].ToString());
                     var actions = ListActions[i];
+                    string name = "";
+                    string icon = "";
+                    string state = "";
 
                     switch (linkType)
                     {
                         case 0:
+                        case 8:
                             {
-                                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)); });
-                                if (deviceinof == null)
-                                {
-                                    continue;
-                                }
 
-                                ///璁惧鍚嶇ОButton
-                                var btndevicename = new Button
-                                {
-                                    Y = Application.GetRealHeight(20),
-                                    Height = Application.GetRealHeight(50),
-                                    Width = Application.GetRealWidth(450),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Text = deviceinof.DeviceEpointName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextSize = 14,
-                                };
-                                actionsrowLayout.AddChidren(btndevicename);
-
-                                ///鍖哄煙(鎴块棿)鍚嶇ОButton
-                                var btnregionname = new Button
-                                {
-                                    Y = btndevicename.Bottom + Application.GetRealHeight(10),
-                                    Width = Application.GetRealWidth(450),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Height = Application.GetRealHeight(50),
-                                    Text = "",//Language.StringByID(MyInternationalizationString.customroom),
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                };
-                                actionsrowLayout.AddChidren(btnregionname);
-                                ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
-                                Send.RoomNmae(btnregionname, deviceinof);
-                                ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
-                                var devicestatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(350),
-                                    Height = Application.GetRealHeight(130),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(450),
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                actionsrowLayout.AddChidren(devicestatus);
-
-                                ///缂栬緫璁惧鐘舵�丅utton
-                                var deviceedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                actionsrowLayout.AddRightView(deviceedit);
-
-                                ///缂栬緫鐐瑰嚮浜嬩欢
-                                deviceedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                    this.AddChidren(flMain);
-                                    LogicDevicePage.CurrentDeviceStateView(flMain, deviceinof, true);
-                                };
-
-
+                                var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
+                                name = LocalDevice.Current.GetDeviceEpointName(deviceinof);
+                                actiondevice.regionNameBtn.Visible = true;
+                                Method.RoomNmae(actiondevice.regionNameBtn, deviceinof);
                                 switch (deviceinof.Type)
                                 {
                                     case DeviceType.OnOffOutput:
                                         {
-                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png";
+                                            icon = "ZigeeLogic/light.png";
 
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
@@ -1225,18 +745,18 @@
                                                 {
                                                     if (status["Data1"].ToString() == "0")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+                                                        state = Language.StringByID(MyInternationalizationString.close);
 
                                                     }
                                                     else if (status["Data1"].ToString() == "1")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+                                                        state = Language.StringByID(MyInternationalizationString.open);
 
                                                     }
                                                     else if (status["Data1"].ToString() == "2")
                                                     {
 
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+                                                        state = Language.StringByID(MyInternationalizationString.onoff);
                                                     }
                                                 }
 
@@ -1246,7 +766,7 @@
                                         break;
                                     case DeviceType.DimmableLight:
                                         {
-                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png";
+                                            icon = "ZigeeLogic/dimmableLight.png";
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
                                             {
@@ -1258,18 +778,18 @@
                                                 {
                                                     var intvalue = int.Parse(status["Data1"]);
                                                     var lightbrightnessvalue = (intvalue * 100) / 254;
-                                                    devicestatus.Text = lightbrightnessvalue.ToString() + "%";
+                                                    state = lightbrightnessvalue.ToString() + "%";
                                                 }
                                                 else if (status["TaskType"].ToString() == "1")
                                                 {
 
                                                     if (status["Data1"].ToString() == "0")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+                                                        state = Language.StringByID(MyInternationalizationString.close);
                                                     }
                                                     else if (status["Data1"].ToString() == "2")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+                                                        state = Language.StringByID(MyInternationalizationString.onoff);
                                                     }
                                                 }
 
@@ -1280,7 +800,7 @@
                                         break;
                                     case DeviceType.WindowCoveringDevice:
                                         {
-                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png";
+                                            icon = "ZigeeLogic/curtain.png";
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
                                             {
@@ -1292,15 +812,15 @@
                                                 {
                                                     if (status["Data1"] == "0")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+                                                        state = Language.StringByID(MyInternationalizationString.open);
                                                     }
                                                     else if (status["Data1"] == "1")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+                                                        state = Language.StringByID(MyInternationalizationString.close);
                                                     }
                                                     else if (status["Data1"] == "5")
                                                     {
-                                                        devicestatus.Text = status["Data2"] + "%";
+                                                        state = status["Data2"] + "%";
                                                     }
                                                 }
 
@@ -1309,7 +829,7 @@
                                         break;
                                     case DeviceType.AirSwitch:
                                         {
-                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png";
+                                            icon = "ZigeeLogic/airswitch.png";
 
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
@@ -1322,18 +842,18 @@
                                                 {
                                                     if (status["Data1"].ToString() == "0")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+                                                        state = Language.StringByID(MyInternationalizationString.close);
 
                                                     }
                                                     else if (status["Data1"].ToString() == "1")
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+                                                        state = Language.StringByID(MyInternationalizationString.open);
 
                                                     }
                                                     else if (status["Data1"].ToString() == "2")
                                                     {
 
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+                                                        state = Language.StringByID(MyInternationalizationString.onoff);
                                                     }
                                                 }
 
@@ -1343,33 +863,30 @@
                                         break;
                                     case DeviceType.Thermostat:
                                         {
-                                            actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png";
+                                            icon = "ZigeeLogic/ac.png";
 
                                             var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
                                             if (TaskList == null)
                                             {
                                                 continue;
                                             }
-                                            string modetext = "", temperaturetext="", speedtext = "";
+                                            string modetext = "", temperaturetext = "", speedtext = "";
                                             bool ifclose = false;
                                             foreach (var status in TaskList)
                                             {
-                                                if (status["TaskType"].ToString() == "1")
+
+                                                if (TaskList.Count == 1)
                                                 {
-                                                    if (status["Data1"].ToString() == "0")
-                                                    {
-                                                       // devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
-
-                                                        ifclose = false;
-                                                    }
-                                                    else if (status["Data1"].ToString() == "1")
-                                                    {
-                                                        //devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
-                                                        ifclose = true;
-                                                    }
-
+                                                    //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱
+                                                    ifclose = false;
+                                                    //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛�
+                                                    break;
                                                 }
-                                                else if (status["TaskType"].ToString() == "5")
+                                                else
+                                                {
+                                                    ifclose = true;
+                                                }
+                                                if (status["TaskType"].ToString() == "5")
                                                 {
                                                     if (status["Data1"] == "3")
                                                     {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍)
@@ -1428,7 +945,7 @@
                                                     //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟
                                                     else if (status["Data1"] == "4" || status["Data1"] == "5" || status["Data1"] == "7")
                                                     {
-                                                        var s = int.Parse(status["Data2"]) /100;
+                                                        var s = int.Parse(status["Data2"]) / 100;
                                                         temperaturetext = s.ToString();
                                                     }
                                                     else if (status["Data1"] == "20")
@@ -1442,180 +959,85 @@
                                             }
                                             if (ifclose)
                                             {
-                                                devicestatus.Text = modetext + ";" + temperaturetext + "鈩�;" + speedtext;
+                                                state = modetext + ";" + temperaturetext + "鈩�;" + speedtext;
                                             }
                                             else
                                             {
-                                                devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+                                                state = Language.StringByID(MyInternationalizationString.close);
 
                                             }
                                         }
                                         break;
-
+                                    case DeviceType.DoorLock:
+                                        {
+                                            //闂ㄩ攣鐗规畩
+                                            icon = "ZigeeLogic/doorlock.png";
+                                            if (actions["PassData"].ToString() == "055704010112")
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.logicopen);
+                                            }
+                                            else
+                                            {
+                                                state = Language.StringByID(MyInternationalizationString.logicclose);
+                                            }
+                                        }
+                                        break;
                                 }
-
 
                             }
                             break;
                         case 2:
                             {
-
-                                var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); });
+                               //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙;
+                               var sceneinof = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString()));
+                                //鏈湴娌℃湁瀛樺湪;
                                 if (sceneinof == null)
                                 {
-                                    continue;
+                                    //瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄�
+                                    sceneinof = new SceneUI();
+                                    #region --------
+                                    ////鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙;
+                                    ////鏍囪闂:缃戠粶璇锋眰锛屽瓨鍦ㄨ鍥惧姞杞藉揩鎱㈢殑闂锛�
+                                    //sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString()));
+                                    ////缃戝叧娌℃湁瀛樺湪;
+                                    //if (sceneinof == null)
+                                    //{
+                                    //    //娉ㄨВ:鏈湴鍜岀綉鍏抽兘涓嶅瓨鍦ㄨ鍦烘櫙,鐣岄潰灏嗕笉浼氭樉绀鸿鍦烘櫙;
+                                    //    //sceneinof = new SceneUI();
+                                    //    //绉婚櫎璇ュ満鏅暟鎹�;
+                                    //    Common.Logic.CurrentLogic.Actions.Remove(actions);
+                                    //    //绉婚櫎璇ュ満鏅鍥�;
+                                    //    devicesFrameLayout.RemoveFromParent();
+                                    //    continue;
+                                    //}
+                                    #endregion
                                 }
 
-                                actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png";
-                                ///璁惧鍚嶇ОButton
-                                var btndevicename = new Button
-                                {
-                                    Y = Application.GetRealHeight(20),
-                                    Height = Application.GetRealHeight(50),
-                                    Width = Application.GetRealWidth(500),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Text = sceneinof.Name,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextSize = 14,
-                                };
-                                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);
+                                icon = "ZigeeLogic/scene.png";
+                                name = sceneinof.Name;
+                                actiondevice.regionNameBtn.Visible = true;
                                 /////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
                                 Common.Room room = new Common.Room();
-                                btnregionname.Text = room.GetRoomNameBySceneId(sceneinof.Id);
-                                //Send.RoomNmae(btnregionname, deviceinof);
+                                actiondevice.regionNameBtn.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id);
 
-
-
-                            }
-                            break;
-                        case 4:
-                            {
-                                var logicinof = Common.Logic.LogicList.Find((obj) => { return obj.LogicId.ToString() == actions["DeviceAddr"].ToString(); });
-                                if (logicinof == null)
-                                {
-                                    continue;
-                                }
-                                ///鏄剧ず閫昏緫鍚嶇О
-                                var btnlogic = new Button
-                                {
-                                    Width = Application.GetRealWidth(500),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = logicinof.LogicName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextSize = 14,
-                                    //TextColor = 0xff121212,
-                                };
-                                actionsrowLayout.AddChidren(btnlogic);
-
-
-                                var logicedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                actionsrowLayout.AddRightView(logicedit);
-                                logicedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var selectedLogicState = new SelectedLogicState();
-                                    UserView.HomePage.Instance.AddChidren(selectedLogicState);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    selectedLogicState.IsDeviceEditor = true;
-                                    selectedLogicState.Show(logicinof);
-                                };
-
-                                ///鏄剧ずLogic鏉′欢鐘舵�佹帶浠�
-                                var logicstatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    //TextColor = 0xff121212,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    TextSize = 14,
-                                };
-                                actionsrowLayout.AddChidren(logicstatus);
-
-                                if (actions["EnableLogic"].ToString() == "1")
-                                {
-                                    logicstatus.Text = Language.StringByID(MyInternationalizationString.open1);
-                                }
-                                else
-                                {
-                                    logicstatus.Text = Language.StringByID(MyInternationalizationString.disable);
-                                }
                             }
                             break;
                         case 6:
                             {
-                                var btnsecurity = new Button
-                                {
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                    TextID = MyInternationalizationString.security,
-                                    TextSize = 14,
-                                };
-                                //actionsrowLayout.AddChidren(btnsecurity);
 
-
-                                var btnsecurityedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                };
-                                actionsrowLayout.AddRightView(btnsecurityedit);
-                                btnsecurityedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var securityMode = new SecurityMode();
-                                    UserView.HomePage.Instance.AddChidren(securityMode);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    securityMode.IsDeviceEditor = true;
-                                    securityMode.Show();
-                                };
-
-                                ///鏄剧ず瀹夐槻鏉′欢鐘舵�佹帶浠�
-                                var securitystatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(500),
-                                    Height = Application.GetRealHeight(130),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                                    TextSize = 14,
-                                };
-                                actionsrowLayout.AddChidren(securitystatus);
 
 
                                 if (actions["SecuritySetting"].ToString() == "0")
                                 {
                                     if (actions["Password"].ToString() == "888888")
                                     {
-                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
+                                        icon = "ZigeeLogic/withdrawal.png";
+                                        state = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
                                     }
                                     else
                                     {
-                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal);
+                                        icon = "ZigeeLogic/withdrawal.png";
+                                        state = Language.StringByID(MyInternationalizationString.withdrawal);
 
                                     }
                                 }
@@ -1623,13 +1045,13 @@
                                 {
                                     if (actions["SecurityModeId"].ToString() == "1")
                                     {
-                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/athome.png";
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison);
+                                        icon = "ZigeeLogic/athome.png";
+                                        state = Language.StringByID(MyInternationalizationString.logicathomegarrison);
                                     }
                                     else if (actions["SecurityModeId"].ToString() == "2")
                                     {
-                                        actionsIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png";
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
+                                        icon = "ZigeeLogic/leavehome.png";
+                                        state = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
                                     }
                                 }
 
@@ -1641,83 +1063,104 @@
                                 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,
-                                    TextSize = 14,
-                                };
-                                actionsrowLayout.AddChidren(delaytimeBtn);
+                                icon = "ZigeeLogic/delay.png";
+
                                 if (Minutes != 0)
                                 {
                                     if (seconds == 0)
                                     {
-                                        delaytimeBtn.Text = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute);
+                                        state = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute);
                                     }
                                     else
                                     {
-                                        delaytimeBtn.Text = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute) + seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
-
+                                        state = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute) + seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
                                     }
                                 }
                                 else
                                 {
-                                    delaytimeBtn.Text = seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
+                                    state = seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
                                 }
+                                //璁板綍寤舵椂锛�
+                                actiondevice.edit.Tag = i;
+                            };
+                            break;
+                    }
 
+                    if (linkType != 2)
+                    {
+                        actiondevice.stateRow.AddRightView(actiondevice.edit);
+                    }
+                    actiondevice.stateRow.AddRightView(actiondevice.del);
 
-                                ///寤舵椂缂栬緫Button
-                                var delaytimeedit = new Button
+                    if (linkType == 6 || linkType == 7)
+                    {
+                        actiondevice.ordinaryBtn.Visible = true;
+                        actiondevice.iconBtn.UnSelectedImagePath = icon;
+                        actiondevice.ordinaryBtn.Text = name;
+                        actiondevice.selecetddevicestateBtn.Text = state;
+                    }
+                    else
+                    {
+                        //璁惧鐘舵��
+                        actiondevice.deviceNameBtn.Visible = true;
+                        actiondevice.iconBtn.UnSelectedImagePath = icon;
+                        actiondevice.deviceNameBtn.Text = name;
+                        actiondevice.selecetddevicestateBtn.Text = state;
+                    }
+                    ///缂栬緫
+                    actiondevice.edit.MouseUpEventHandler += (sender, e) =>
+                    {
+                        switch (linkType)
+                        {
+                            case 8:
+                            case 0:
                                 {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                    Tag = i,
-                                };
-                                actionsrowLayout.AddRightView(delaytimeedit);
-
-                                ///缂栬緫鐐瑰嚮浜嬩欢
-                                delaytimeedit.MouseUpEventHandler += (sender, e) =>
+                                    var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
+                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                                    this.AddChidren(flMain);
+                                    CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic");
+                                }
+                                break;
+                            case 6:
+                                {
+                                    var securityMode = new SecurityMode();
+                                    UserView.HomePage.Instance.AddChidren(securityMode);
+                                    UserView.HomePage.Instance.PageIndex += 1;
+                                    securityMode.IsDeviceEditor = true;
+                                    securityMode.Show();
+                                }
+                                break;
+                            case 7:
                                 {
                                     var delayTime = new DelayTime();
                                     UserView.HomePage.Instance.AddChidren(delayTime);
                                     UserView.HomePage.Instance.PageIndex += 1;
-                                    delayTime.Show(int.Parse(delaytimeedit.Tag.ToString()), true);
-                                };
-
-                            };
-                            break;
-                    }
+                                    delayTime.Show(int.Parse(actiondevice.edit.Tag.ToString()), true);
+                                }
+                                break;
+                               
+                        }
+                    };
                     ///鍒犻櫎鎺т欢
-                    var del = new Button
+                    actiondevice.del.MouseUpEventHandler += (sender, e) =>
                     {
-                        BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1,
-                        Text = Language.StringByID(MyInternationalizationString.del),
-                    };
-                    actionsrowLayout.AddRightView(del);
 
-                    del.MouseUpEventHandler += (sender, e) =>
-                    {
-                        var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                                               Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
-                        alert.ResultEventHandler += (sender1, e1) =>
-                        {
-                            if (e1)
-                            {
-                                Common.Logic.CurrentLogic.Actions.Remove(actions);
-                                var logicCommunalPage = new LogicCommunalPage();
-                                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-                                UserView.HomePage.Instance.PageIndex += 1;
-                                logicCommunalPage.Show(() => { });
-                            }
-                        };
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                        Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                        Language.StringByID(MyInternationalizationString.confrim));
                         alert.Show();
+                        alert.ConfirmClickEvent += () =>
+                        {
+                            Common.Logic.CurrentLogic.Actions.Remove(actions);
+                            actiondevice.selecetdFrameLayout.RemoveFromParent();
+                            // devicesFrameLayout.RemoveFromParent();
+                            //var logicCommunalPage = new LogicCommunalPage();
+                            //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                            //UserView.HomePage.Instance.PageIndex += 1;
+                            //logicCommunalPage.Show(() => { });
+                        };
 
                     };
-
                 }
             }
 
@@ -1731,35 +1174,12 @@
             };
             middle.AddChidren(fraline1);
 
-
-            var weekFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            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,
-                TextSize = 14,
-            };
-            weekRowLayout.AddChidren(settxet);
-            var btnweektext = new Button
+            Addview weekview = new Addview();
+            weekview.iconBtn.Visible = true;
+            weekview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png";
+            weekview.titleBtn.TextID = MyInternationalizationString.setupcycle;
+            middle.AddChidren(weekview.AddDeviceView());
+            var weekBtn = new Button
             {
                 Width = Application.GetRealWidth(595),
                 Height = Application.GetRealHeight(60),
@@ -1767,29 +1187,16 @@
                 //Text = "姣忓ぉ",
                 TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                 TextID = MyInternationalizationString.everyday,
-                Y = Application.GetRealHeight(35),
-                X = settxet.Right,
+                Y = Application.GetRealHeight(35+30),
+                X = weekview.titleBtn.Right,
                 TextSize = 14,
             };
-            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);
+            weekview.frameLayout.AddChidren(weekBtn);
+            Method.UpdateWeek(weekBtn,Common.Logic.CurrentLogic);
             EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
             {
                 /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
-                var cycle = new Cycle(() => { UpdateWeek(btnweektext); });
+                var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic);});
                 UserView.HomePage.Instance.AddChidren(cycle);
                 UserView.HomePage.Instance.PageIndex += 1;
                 cycle.Show();
@@ -1799,658 +1206,104 @@
                 //UserView.HomePage.Instance.PageIndex += 1;
                 //cyclicCycle.Show();
             };
-            btnweektext.MouseUpEventHandler += cycleclick;
-            nextBtn.MouseUpEventHandler += cycleclick;
+            weekBtn.MouseUpEventHandler += cycleclick;
+            weekview.clickBtn.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
-            {
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                Gravity = Gravity.CenterVertical,
-                TextID = MyInternationalizationString.pushswitch,
-                TextSize = 14,
-            };
-            pushswitchRowlayout.AddChidren(btnswitchtxet);
-
-            var btnswitch = new Button
-            {
-                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 custompushFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            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,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                Gravity = Gravity.CenterVertical,
-                TextSize = 14,
-            };
-            custompushRowLayout.AddChidren(btncustompush);
-
-
-            var custompushback = new Button
-            {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = Application.GetRealWidth(965 - 58),
-                Gravity = Gravity.CenterVertical,
-            };
-            custompushRowLayout.AddChidren(custompushback);
-            EventHandler<MouseEventArgs> customclick = (sender, e) =>
-            {
-                var CustomText = new CustomText();
-                UserView.HomePage.Instance.AddChidren(CustomText);
-                UserView.HomePage.Instance.PageIndex += 1;
-                CustomText.Show();
-
-            };
-            btncustompush.MouseUpEventHandler += customclick;
-            custompushback.MouseUpEventHandler += customclick;
-            custompushRowLayout.MouseUpEventHandler += customclick;
-
+            Method.Push(middle);
+        
             #endregion
 
-
-            var saveFrameLayout = new FrameLayout
-            {
-                Y = middle.Bottom,
-                Height = Application.GetRealHeight(180),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
-            };
-            this.AddChidren(saveFrameLayout);
-
-            var btnsave = new Button
-            {
-                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,
-                TextSize=16,
-            };
-            saveFrameLayout.AddChidren(btnsave);
-            btnsave.MouseUpEventHandler += async (sender, e) =>
+            saveBtn.clickviewBtn.MouseUpEventHandler +=(sender, e) =>
             {
                 var name = logicTextBox.Text.Trim();
-                if (string.IsNullOrEmpty(logicTextBox.Text.Trim()))
-                {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show();
-                    return;
-                }
-                var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
-                if (logicname != null)
-                {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
-                    return;
-                }
-
-                Common.Logic.CurrentLogic.LogicName = name;
-
-                //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫
-                CommonPage.Loading.Start();
-                if (Common.Logic.CurrentLogic.LogicId == 0)
-                {
-                    //鍙戦�佹坊鍔犻�昏緫鍛戒护
-                    var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic);
-                    if (logicifon != null && logicifon.LogicId != 0)
-                    {
-                        Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
-                        Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
-                    }
-                }
-                else
-                {
-                    //鍙戦�佷慨鏀归�昏緫鍛戒护
-                    Send.AddModifyLogic(Common.Logic.CurrentLogic);
-                }
-
-                CommonPage.Loading.Hide();
-                UserView.HomePage.Instance.RemoveViewByTag("Logic");
-                Category.Category.instance?.RefreshBodyView();
-           
+                Method.SaveLogic(IfString._Logic,name, IfString.Tag, Common.Logic.CurrentLogic);
             };
-
-
-        }
-        /// <summary>
-        /// 鏇存柊鎵ц鍛ㄦ湡鐨勬柟娉�
-        /// </summary>
-        /// <param name="btndisplaycycle">Btndisplaycycle.</param>
-        void UpdateWeek(Button btndisplaycycle)
-        {
-
-            switch (Common.Logic.CurrentLogic.TimeAttribute.Repeat)
-            {
-                ///0:鍙墽琛屼竴娆★紝鎵ц鍚嶪sEnable鍊肩疆;1,浠婂勾鍐呮墽琛�;2锛氭瘡澶╂墽琛�;3锛氭瘡鏈堟墽琛�;4锛氭瘡骞存墽琛�;5锛氬懆閲嶅銆�
-                case 0:
-                    {
-                        btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.executeonce);
-                    }; break;
-                case 1: { }; break;
-                case 2:
-                    {
-                        btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday);
-                    }; break;
-                case 3:
-                    {
-
-                        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")
-                            {
-                                value += (j + 1).ToString() + ",";
-                            }
-                        }
-                        btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day);
-
-                    }; break;
-                case 4:
-                    {
-
-                        Dictionary<int, int> dictionary = new Dictionary<int, int>();
-                        ///鎵惧嚭鎵ц鐨勬湀浠藉拰澶╂暟
-                        if (Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count != 0)
-                        {
-                            for (int i = 0; i < Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count; i++)
-                            {
-                                var dayvalue = Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate[i];
-                                if (dayvalue != 0)
-                                {
-                                    dictionary.Add(i + 1, dayvalue);
-                                }
-                            }
-                        }
-                        if (dictionary.Count != 0 && dictionary.Count == 1)
-                        {
-                            string len = "", leng = "";
-                            int minvalue = 0, Maximum = 0;
-                            foreach (var value in dictionary)
-                            {
-                                ///鍙栧嚭鏈堜唤
-                                var month = value.Key;
-                                ///鍙栧嚭鏃ユ暟
-                                var day = value.Value;
-                                var maxvalue = Convert.ToString(day, 2);
-                                var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.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;
-                                    }
-                                }
-                                for (int j = 0; j < len.Length; j++)
-                                {
-                                    var strvalue = len.Substring(j, 1);
-                                    if (strvalue == "1")
-                                    {
-                                        Maximum = j + 1;
-                                    }
-                                }
-
-                                if (month.ToString().Length < 2)
-                                {
-                                    leng = "0" + month.ToString();
-                                }
-                                else
-                                {
-                                    leng = month.ToString();
-                                }
-                                if (minvalue == Maximum)
-                                {
-                                    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString());
-                                }
-                                else
-                                {
-                                    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString());
-                                }
-                            }
-
-                        }
-                        else
-                        {
-                            int b = 0;
-                            string stringtext = "";
-                            foreach (var value in dictionary)
-                            {
-                                string len = "", leng = "";
-                                int minvalue = 0, Maximum = 0;
-                                ///鍙栧嚭鏈堜唤
-                                var month = value.Key;
-                                ///鍙栧嚭鏃ユ暟
-                                var day = value.Value;
-                                var maxvalue = Convert.ToString(day, 2);
-                                var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length));
-                                for (int j = 31; j >= 0; j--)
-                                {
-                                    len += str.Substring(j, 1);
-                                }
-
-
-                                if (month.ToString().Length < 2)
-                                {
-                                    leng = "0" + month.ToString();
-                                }
-                                else
-                                {
-                                    leng = month.ToString();
-                                }
-
-
-
-                                if (b == 0)
-                                {
-                                    for (int j = 0; j < len.Length; j++)
-                                    {
-                                        var strvalue = len.Substring(j, 1);
-                                        if (strvalue == "1")
-                                        {
-                                            minvalue = j + 1;
-                                            break;
-                                        }
-                                    }
-                                    stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-";
-
-                                }
-
-                                if (b == dictionary.Count - 1)
-                                {
-                                    for (int j = 0; j < len.Length; j++)
-                                    {
-                                        var strvalue = len.Substring(j, 1);
-                                        if (strvalue == "1")
-                                        {
-                                            Maximum = j + 1;
-                                        }
-                                    }
-                                    stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString());
-
-                                }
-                                b++;
-                            }
-                            btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext;
-                        }
-
-                    }; break;
-                case 5:
-                    {
-                        string len = "", text = "";
-                        List<int> listvalueInt = new List<int>();
-                        listvalueInt.Clear();
-                        var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.WeekDay, 2);
-                        var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length));
-                        for (int j = 7; 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")
-                            {
-                                listvalueInt.Add(j + 1);
-
-
-                                if ((j + 1) == 1)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.mon) + ",";
-                                }
-                                else if ((j + 1) == 2)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.tue) + ",";
-                                }
-                                else if ((j + 1) == 3)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.wed) + ",";
-                                }
-                                else if ((j + 1) == 4)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.thu) + ",";
-                                }
-                                else if ((j + 1) == 5)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.frl) + ",";
-                                }
-                                else if ((j + 1) == 6)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.sat) + ",";
-                                }
-                                else if ((j + 1) == 7)
-                                {
-                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ",";
-                                    //text += Language.StringByID(MyInternationalizationString.sun) + ",";
-                                }
-
-
-                            }
-                        }
-                        //鏆傛椂闅愯棌鎺夛紝闇�瑕佹樉绀哄懆鏈拰宸ヤ綔鏃ュ啀鏀惧紑锛�
-                        //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7))
-                        //{
-                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday);
-                        //}
-                        //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7))
-                        //{
-                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend);
-                        //}
-                        //else if (listvalueInt.Count == 7)
-                        //{
-                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday);
-                        //}
-                        //else
-                        //{
-                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(',');
-                        //}
-                        btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(',');
-                        //btndisplaycycle.Text = text.TrimEnd(',');
-                    }; break;
-            }
-
-
         }
 
         void ConditionView(bool edit)
         {
             Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-
-            #region 缁勫悎鏉′欢View
-            FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 };
+            #region  ------缁勫悎鏉′欢鐣岄潰甯冨眬閮ㄥ垎   
+            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
             this.AddChidren(flMain);
-            flMain.MouseUpEventHandler += (sender2, e2) =>
+            CompleteView completeView = new CompleteView();
+            flMain.AddChidren(completeView.Show(2));
+            completeView.Btntitle.TextID = MyInternationalizationString.condition;
+            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
             {
-                flMain.RemoveFromParent();
-            };
-
-            var timetypeframelayout1 = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(100),
-                Y = Application.GetRealHeight(1920 - 100),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            flMain.AddChidren(timetypeframelayout1);
-            var framelayout = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(530),
-                Y = Application.GetRealHeight(1920 - 530),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                Radius = (uint)Application.GetRealHeight(60),
-            };
-            flMain.AddChidren(framelayout);
-
-            #region  -------鍙栨秷   瀹屾垚
-            var timetype = new RowLayout
-            {
-                Height = Application.GetRealHeight(140),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            framelayout.AddChidren(timetype);
-            var Btncancel = new Button
-            {
-                TextID = MyInternationalizationString.cancel,
-                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                X = Application.GetRealWidth(80),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextSize = 14,
-            };
-            timetype.AddChidren(Btncancel);
-            Btncancel.MouseUpEventHandler += (sender16, e16) =>
-            {
-                flMain.RemoveFromParent();
                 UserView.HomePage.Instance.ScrollEnabled = true;
+                flMain.RemoveFromParent();
             };
+            flMain.MouseUpEventHandler += clickcancel;
+            completeView.Btncancel.MouseUpEventHandler += clickcancel;
 
-            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),
-                TextSize = 14,
-
-            };
-            timetype.AddChidren(Btncomplete);
+            //婊¤冻鎵�鏈夋潯浠�
+            mFunView allFunView = new mFunView();
+            allFunView.frameLayout.Y = Application.GetRealHeight(140 + 20);
+            completeView.Show(2).AddChidren(allFunView.Show());
+            allFunView.titleBtn.TextID = MyInternationalizationString.Allconditions;
+            //婊¤冻鍏朵腑涓�涓潯浠�
+            mFunView ormFunview = new mFunView();
+            ormFunview.frameLayout.Y = allFunView.frameLayout.Bottom;
+            completeView.Show(2).AddChidren(ormFunview.Show());
+            ormFunview.titleBtn.TextID = MyInternationalizationString.anycondition;
+            ormFunview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
             #endregion
 
-            #region  -------婊¤冻鎵�鏈夋潯浠�   婊¤冻鍏朵腑涓�涓潯浠�
-
-
-            #region  -------婊¤冻鎵�鏈夋潯浠�
-
-
-            var andFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = timetype.Bottom + Application.GetRealHeight(20),
-            };
-            framelayout.AddChidren(andFrameLayout);
-
-
-            var androw = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            andFrameLayout.AddChidren(androw);
-            var andbtn = new Button
-            {
-
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.Allconditions,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                TextSize = 14,
-
-            };
-            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,
-                TextSize = 14,
-            };
-            orrow.AddChidren(orbtn);
-
-            var orSelected = new SelectedButton();
-            orrow.AddChidren(orSelected);
-            #endregion
             ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠�
-            EventHandler<MouseEventArgs> andclick = (sedner14, e14) =>
+            allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) =>
             {
-                andSelected.Visible = true;
-                orSelected.Visible = false;
-                andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                allFunView.selectedIconBtn.Visible = true;
+                ormFunview.selectedIconBtn.Visible = false;
+                allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
             };
-            androw.MouseUpEventHandler += andclick;
-            andbtn.MouseUpEventHandler += andclick;
-            andSelected.MouseUpEventHandler += andclick;
-            andFrameLayout.MouseUpEventHandler += andclick;
-
-
             ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠�
-            EventHandler<MouseEventArgs> orclick = (sedner15, e15) =>
+            ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) =>
             {
-                andSelected.Visible = false;
-                orSelected.Visible = true;
-                andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                allFunView.selectedIconBtn.Visible = false;
+                ormFunview.selectedIconBtn.Visible = true;
+                allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
             };
-            orrow.MouseUpEventHandler += orclick;
-            orbtn.MouseUpEventHandler += orclick;
-            orSelected.MouseUpEventHandler += orclick;
-            orFrameLayout.MouseUpEventHandler += orclick;
-
-            #endregion
-            #endregion
 
             if (edit)
             {
                 if (Common.Logic.CurrentLogic.Relationship == 0)
                 {
-                    andSelected.Visible = true;
-                    orSelected.Visible = false;
-                    andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                    orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                    allFunView.selectedIconBtn.Visible = true;
+                    ormFunview.selectedIconBtn.Visible = false;
+                    allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                    ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                 }
                 else
                 {
-                    andSelected.Visible = false;
-                    orSelected.Visible = true;
-                    andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                    orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                    allFunView.selectedIconBtn.Visible = false;
+                    ormFunview.selectedIconBtn.Visible = true;
+                    allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                    ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                 }
             }
-            Btncomplete.MouseUpEventHandler += (sender, e) =>
+            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
             {
-                if (!andSelected.Visible && !orSelected.Visible)
+                if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible)
                 {
                     ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
                     return;
                 }
                 flMain.RemoveFromParent();
 
-                if (andSelected.Visible)
+                if (allFunView.selectedIconBtn.Visible)
                 {
                     Common.Logic.CurrentLogic.Relationship = 0;
-
+                   
                 }
-                if (orSelected.Visible)
+                if (ormFunview.selectedIconBtn.Visible)
                 {
                     Common.Logic.CurrentLogic.Relationship = 1;
-
+                   
                 }
                 if (edit)
                 {
@@ -2473,5 +1326,7 @@
             };
 
         }
+    
+
     }
 }

--
Gitblit v1.8.0