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

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 1909 +++-------------------------------------------------------
 1 files changed, 120 insertions(+), 1,789 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index f10c004..94c88ef 100644
--- 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;
 
@@ -17,233 +18,125 @@
             UserView.HomePage.Instance.RemoveViewByTag("Logic");
             Tag = "Logic";
         }
-        EditText logicTextBox;
-        public void Show(Action action)
+
+        public async void Show(Action action)
         {
 
-            this.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
-
-            var topFrameLayout1 = new FrameLayout
+            #region  View甯冨眬浠g爜
+            UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            if (Common.Logic.CurrentLogic.LogicId != 0)
             {
-                Height = Application.GetRealHeight(80),
-                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
-            };
-            AddChidren(topFrameLayout1);
-
-            var topFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(140),
-                Y = Application.GetRealHeight(80),
-                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
-            };
-            AddChidren(topFrameLayout);
-
-            var titleName = new Button
-            {
-               
-                TextSize = 17,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(150),
-            };
-            topFrameLayout.AddChidren(titleName);
-            if (Common.Logic.CurrentLogic.LogicId == 1)
-            {
-                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 back = new Button
+            view.clickBtn.MouseDownEventHandler += (sender, e) =>
             {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(110),
-                X = Application.GetRealWidth(20),
-                Gravity = Gravity.CenterVertical,
-                UnSelectedImagePath = "ZigeeLogic/Back.png",
-            };
-            topFrameLayout.AddChidren(back);
-            back.MouseDownEventHandler += (sender, e) =>
-            {
-                //if (Common.Logic.CurrentLogic.LogicId != 0)
-                //{
-                //    Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-                //    action();
-                //    Send.AddModifyLogic(Common.Logic.CurrentLogic);
-                //}
+                // UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
                 action();
                 RemoveFromParent();
             };
-
-
-            var middle = new VerticalScrolViewLayout();
-            middle.Y = topFrameLayout.Bottom;
-            middle.Height = Application.GetRealHeight(1920 - 220 - 194);
-            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+            var middle = new VerticalScrolViewLayout
+            {
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184 - 180),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
             this.AddChidren(middle);
-
-            var fl = new FrameLayout
-            {
-                Height = Application.GetRealHeight(280),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            middle.AddChidren(fl);
-
-            #region -----姣忓ぉ 璁剧疆鍛ㄦ湡-----
-            var weekfl = new FrameLayout
-            {
-                Height = Application.GetRealHeight(140),
-                Y = Application.GetRealHeight(20),
-            };
-            fl.AddChidren(weekfl);
-
-            var btnweektext = new Button
-            {
-                Width = Application.GetRealWidth(900 - 300),
-                Height = Application.GetRealHeight(70),
-                X = Application.GetRealWidth(140 + 300),
-                TextAlignment = TextAlignment.CenterRight,
-                //Text = "姣忓ぉ",
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextID = MyInternationalizationString.everyday,
-            };
-            weekfl.AddChidren(btnweektext);
-            var settxet = new Button
-            {
-                Width = Application.GetRealWidth(900 - 500),
-                Height = Application.GetRealHeight(70),
-                X = Application.GetRealWidth(140 + 500),
-                TextAlignment = TextAlignment.CenterRight,
-                Y = btnweektext.Bottom,
-                //Text = "璁剧疆鍛ㄦ湡",
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextID = MyInternationalizationString.setupcycle,
-            };
-            weekfl.AddChidren(settxet);
-
-            UpdateWeek(btnweektext);
-
-            EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
-            {
-                /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
-                //var cycle = new Cycle(() => { UpdateWeek(btnweektext); });
-                //UserView.HomePage.Instance.AddChidren(cycle);
-                //UserView.HomePage.Instance.PageIndex += 1;
-                //cycle.Show();
-
-                var cyclicCycle = new CyclicCycle(() => { UpdateWeek(btnweektext); });
-                UserView.HomePage.Instance.AddChidren(cyclicCycle);
-                UserView.HomePage.Instance.PageIndex += 1;
-                cyclicCycle.Show();
-            };
-            btnweektext.MouseUpEventHandler += cycleclick;
-            settxet.MouseUpEventHandler += cycleclick;
+            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
             {
-                Height = Application.GetRealHeight(140),
-                Y = weekfl.Bottom,
-                //BackgroundColor=0xff453736,
+                Height = Application.GetRealHeight(130),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
             };
-            fl.AddChidren(logicnamefl);
+            middle.AddChidren(logicnamefl);
 
             var text = new Button
             {
-                Width = Application.GetRealWidth(600),
+                Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(60),
-                X = Application.GetRealWidth(50),
+                X = Application.GetRealWidth(58),
                 TextAlignment = TextAlignment.CenterLeft,
                 //Text = "鑷姩鍖栧悕绉�",
                 TextID = MyInternationalizationString.automationname,
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Y = Application.GetRealHeight(35),
+                TextSize = 15,
             };
             logicnamefl.AddChidren(text);
 
-             logicTextBox = new EditText
+            EditText logicTextBox = new EditText
             {
-                Width = Application.GetRealWidth(900),
+                Y = Application.GetRealHeight(35),
+                Width = Application.GetRealWidth(1080 - 58 - 300),
                 Height = Application.GetRealHeight(60),
-                X = Application.GetRealWidth(40 + 20),
-                Y = text.Bottom + Application.GetRealHeight(10),
+                X = text.Right,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextSize=13,
-                Text =Common.Logic.CurrentLogic.LogicName,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+                Text = Common.Logic.CurrentLogic.LogicName,
                 //TextID=MyInternationalizationString.automation1,
             };
             logicnamefl.AddChidren(logicTextBox);
-          
-            var btnline = new Button
+
+            var fraline = new FrameLayout
             {
-                Height = Application.GetRealHeight(4),
-                Y = Application.GetRealHeight(140 - 4),
-                BackgroundColor = ZigbeeColor.Current.LogicLineColor,
+                Height = Application.GetRealHeight(30),
             };
-            logicnamefl.AddChidren(btnline);
+            middle.AddChidren(fraline);
             #endregion
 
             #region -----鏄剧ず閫昏緫鏉′欢-----
-            var conditionRowLayout = new RowLayout
-            {
-                Height = Application.GetRealHeight(150),
-                //BackgroundColor = 0xff323232,
-            };
-            middle.AddChidren(conditionRowLayout);
-           
-            conditionRowLayout.AddChidren(new Button
-            {
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                //Text = "濡傛灉",
-                TextID = MyInternationalizationString.ifcondition,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                // Gravity = Gravity.CenterVertical,
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                Y = Application.GetRealHeight(90),
-                TextSize = 16,
-            });
+            Addview addconditionview = new Addview();
+            addconditionview.iconBtn.Visible = true;
+            addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition;
+            middle.AddChidren(addconditionview.AddDeviceView());
 
-            var conditionadd = new Button
-            {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(100),
-                UnSelectedImagePath = "ZigeeLogic/add.png",
-                X = Application.GetRealWidth(1080 - 140),
-                Gravity = Gravity.CenterVertical,
-            };
-            conditionRowLayout.AddChidren(conditionadd);
             ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
-            conditionadd.MouseUpEventHandler += (sender, e) =>
-            {
-                ConditionView();
-            };
-
-
+            addconditionview.clickBtn.MouseUpEventHandler += (sender, e) =>
+             {
+                 Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+                 if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+                 {
+                     new LogicDveiceStatus { }.ConditionView(false, this,null);
+                 }
+                 else
+                 {
+                     var addLogicPage = new AddLogicPage();
+                     UserView.HomePage.Instance.AddChidren(addLogicPage);
+                     UserView.HomePage.Instance.PageIndex += 1;
+                     addLogicPage.Show();
+                 }
+             };
             List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>();
             ListConditions.Clear();
             ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions);
             ListConditions.Add(new Dictionary<string, string>());
             if (Common.Logic.CurrentLogic.Conditions.Count > 1)
             {
-                //inputVerticalScrolViewLayout.Height = Application.GetRealHeight(160 * ListConditions.Count) + Application.GetRealHeight(60);
                 var row = new FrameLayout
                 {
                     Height = Application.GetRealHeight(60),
+                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                 };
-                //inputVerticalScrolViewLayout.AddChidren(row);
                 middle.AddChidren(row);
                 var relationship = new Button
                 {
                     Width = Application.GetRealWidth(600),
                     Height = Application.GetRealHeight(60),
                     TextAlignment = TextAlignment.CenterLeft,
-                    X = Application.GetRealWidth(40),
-                    TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
+                    X = Application.GetRealWidth(58),
+                    TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
                 };
                 row.AddChidren(relationship);
                 if (Common.Logic.CurrentLogic.Relationship == 0)
@@ -254,1651 +147,89 @@
                 {
                     relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.anycondition);
                 }
-            }
-            for (int i = 0; i < ListConditions.Count; i++)
-            {
-                if (i == (ListConditions.Count - 1))
+                EventHandler<MouseEventArgs> editclick = (sender, e) =>
                 {
+                    Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+                    new LogicDveiceStatus { }.ConditionView(true, this, relationship);
+                };
+                row.MouseUpEventHandler += editclick;
+                relationship.MouseUpEventHandler += editclick;
 
-                    var addfl = new FrameLayout
-                    {
-                        Height = Application.GetRealHeight(160),
-                    };
-                    middle.AddChidren(addfl);
-                    var addbtn = new Button
-                    {
-                        Height = Application.GetRealHeight(120),
-                        Width = Application.GetRealWidth(1000),
-                        X = Application.GetRealWidth(40),
-                        Y = Application.GetRealHeight(40),
-                        Radius = (uint)Application.GetRealHeight(30),
-                        //Text = "娣诲姞鏉′欢",
-                        BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                        TextID = MyInternationalizationString.addconditions,
-                    };
-                    addfl.AddChidren(addbtn);
-                    addbtn.MouseUpEventHandler += (sender, e) =>
-                      {
-                          ConditionView();
-                      };
-                }
-                else
-                {
-                    var conditionsowLayout = new RowLayout
-                    {
-                        Height = Application.GetRealHeight(160),
-                    };
-                    middle.AddChidren(conditionsowLayout);
-                    var Type = int.Parse(ListConditions[i]["Type"]);
-                    var conditions = ListConditions[i];
-                    switch (Type)
-                    {
-
-                        /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆)
-                        case 0:
-                            {
-                                ///鏄剧ず鏃堕棿
-                                var timevalue = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(800),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    //Text = starttime,
-                                    //TextColor = 0xff121212,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddChidren(timevalue);
-
-
-                                var timeedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddRightView(timeedit);
-
-                                timeedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var timePoint = new TimePoint();
-                                    UserView.HomePage.Instance.AddChidren(timePoint);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    timePoint.IsDeviceEditor = true;
-                                    timePoint.Show(conditions);
-                                };
-
-                                //"0姝e父鏃堕棿鐐�","1鏃ュ嚭鏃堕棿","2鏃ヨ惤鏃堕棿","3姝e崍鏃堕棿"
-                                switch (int.Parse(conditions["DateType"]))
-                                {
-                                    case 0:
-                                        {
-                                            string s = "";
-                                           s = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.time) + conditions["StartHour"] + ":" + s;
-                                        }
-                                        break;
-                                    case 1:
-                                        if (int.Parse(conditions["AdjustTime"]) > 0)
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunriseafter) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else if (int.Parse(conditions["AdjustTime"]) < 0)
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunrisebefore) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunrise);
-                                        }
-                                        break;
-                                    case 2:
-                                        if (int.Parse(conditions["AdjustTime"]) > 0)
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunsetafter) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else if (int.Parse(conditions["AdjustTime"]) < 0)
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.sunsetbefore) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else
-                                        {
-                                            timevalue.Text =Language.StringByID(MyInternationalizationString.sunset);
-                                        }
-                                        break;
-                                    case 3:
-                                        if (int.Parse(conditions["AdjustTime"]) > 0)
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.noonafter) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else if (int.Parse(conditions["AdjustTime"]) < 0)
-                                        {
-                                            timevalue.Text = Language.StringByID(MyInternationalizationString.noonbefore) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
-                                        }
-                                        else
-                                        {
-                                            timevalue.Text =Language.StringByID(MyInternationalizationString.noon);
-                                        }
-                                        break;
-                                }
-
-                            }
-                            break;
-                        case 5:
-                            {
-                                 string s1="", s2="";
-                                 s1 = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
-                                 s2 = conditions["StopMin"].Length <2 ? "0" + conditions["StopMin"] : conditions["StopMin"];
-                                ///鏄剧ず鏃堕棿
-                                var timevalue = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(500),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2,
-                                    //TextColor = 0xff121212,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddChidren(timevalue);
-
-
-                                var timeedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    //TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddRightView(timeedit);
-                                timeedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    var timePage = new TimePage();
-                                    UserView.HomePage.Instance.AddChidren(timePage);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    timePage.str1 = conditions["StartHour"] + ":" + conditions["StartMin"] + "-" + conditions["StopHour"] + ":" + conditions["StopMin"];
-                                    timePage.IsDeviceEditor1 = true;
-                                    timePage.Show();
-                                };
-                            }
-                            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
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(500),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = deviceinof.DeviceEpointName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                };
-                                conditionsowLayout.AddChidren(btndevice);
-
-
-                                var deviceedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddRightView(deviceedit);
-                                deviceedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    //var selectedDeviceState = new SelectedDeviceState();
-                                    //UserView.HomePage.Instance.AddChidren(selectedDeviceState);
-                                    //UserView.HomePage.Instance.PageIndex += 1;
-                                    //selectedDeviceState.IsDeviceEditor = true;
-                                    //selectedDeviceState.Show(deviceinof);
-                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                    this.AddChidren(flMain);
-                                    DeviceStateCondition.CurrentDeviceView(flMain, deviceinof, true);
-                                };
-
-                                ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
-                                var devicestatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddChidren(devicestatus);
-
-                                switch (deviceinof.Type)
-                                {
-                                    case DeviceType.OnOffOutput:
-                                        {
-                                            if (conditions["AttriButeId"] == "0")
-                                            {
-                                                if (conditions["AttriButeData1"] == "1")
-                                                {
-                                                    devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
-                                                }
-                                                else
-                                                {
-                                                    devicestatus.Text = 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;
-                                    case DeviceType.IASZone:
-                                        {
-                                            var iASZonedevice = deviceinof as IASZone;
-                                            var intvalue = conditions["AttriButeData1"];
-                                            switch (iASZonedevice.IasDeviceType)
-                                            {
-                                                case 13:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.someone;
-                                                        }
-                                                        else
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.unmanned;
-                                                        }
-                                                    }
-                                                    break;
-                                                case 21:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.logicopen;
-                                                        }
-                                                        else
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.logicclose;
-                                                        }
-                                                    }
-                                                    break;
-                                                case 22:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.logicopen;
-                                                        }
-                                                        else
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.logicclose;
-                                                        }
-                                                    }
-                                                    break;
-                                                case 40:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.smokescreen;
-                                                        }
-
-                                                    }
-                                                    break;
-                                                case 42:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.waterleakage;
-                                                        }
-                                                        else
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.noleakage;
-                                                        }
-                                                    }
-                                                    break;
-                                                case 43:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.gas;
-                                                        }
-
-                                                    }
-                                                    break;
-                                                case 277:
-                                                    {
-                                                        if (intvalue == "1")
-                                                        {
-                                                            devicestatus.TextID = MyInternationalizationString.callthepolice;
-                                                        }
-
-                                                    }
-                                                    break;
-                                             }
-                                        }
-                                        break;
-                                    case DeviceType.OnOffSwitch:
-                                        {
-                                            devicestatus.Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"];
-                                            //if (conditions["Epoint"] == "1")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button1;
-                                            //}
-                                            //else if (conditions["Epoint"] == "2")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button2;
-                                            //}
-                                            //else if (conditions["Epoint"] == "3")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button3;
-                                            //}
-                                            //else if (conditions["Epoint"] == "4")
-                                            //{
-                                            //    devicestatus.TextID = MyInternationalizationString.button4;
-                                            //}
-                                        }
-                                        break;
-
-                                }
-
-                            }
-                            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
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = logicinof.LogicName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                };
-                                conditionsowLayout.AddChidren(btnlogic);
-
-
-                                var logicedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.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(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    //TextColor = 0xff121212,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                };
-                                conditionsowLayout.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
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    //Text = "瀹夐槻",
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                    TextID = MyInternationalizationString.security,
-                                };
-                                conditionsowLayout.AddChidren(btnsecurity);
-
-
-                                var btnsecurityedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.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(300),
-                                    Height = Application.GetRealHeight(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddChidren(securitystatus);
-
-                                if (conditions["EnOrWithdrawMode"] == "1")
-                                {
-                                    securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal);
-                                }
-                                else
-                                {
-                                    securitystatus.Text = Language.StringByID(MyInternationalizationString.defence);
-                                }
-                            }
-                            break;
-                        case 7:
-                            {
-                                var btnlocation= new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    //Text = "鍦扮悊浣嶇疆",
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                    TextID = MyInternationalizationString.geographicalposition,
-                                };
-                                conditionsowLayout.AddChidren(btnlocation);
-
-
-                                var btnlocationedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.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(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                conditionsowLayout.AddChidren(locationstatus);
-
-                                if (conditions["AtHome"] == "1")
-                                {
-                                    locationstatus.Text =Language.StringByID(MyInternationalizationString.athome);
-                                }
-                                else
-                                {
-                                    locationstatus.Text =Language.StringByID(MyInternationalizationString.leavehome);
-                                }
-                            }
-                            break;
-
-                    }
-                    ///鍒犻櫎鎺т欢
-                    var del = new Button
-                    {
-                        BackgroundColor = ZigbeeColor.Current.LogicDelBackgroundColor,
-                        Text = Language.StringByID(MyInternationalizationString.del),
-                    };
-                    conditionsowLayout.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.Conditions.Remove(conditions);
-                                var logicCommunalPage = new LogicCommunalPage();
-                                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-                                UserView.HomePage.Instance.PageIndex += 1;
-                                logicCommunalPage.Show(() => { });
-                            }
-                        };
-                        alert.Show();
-                      
-                    };
-
-                }
             }
-
+            new LogicDveiceStatus { }.Conditions(this, middle, ListConditions, logicTextBox.Text.Trim());
 
             #endregion
 
             #region  ----鏄剧ず鎵ц鐩爣----
-            var targetRowLayout = new RowLayout
-            {
-                Height = Application.GetRealHeight(150),
-                // BackgroundColor = 0xff323232,
-            };
-            middle.AddChidren(targetRowLayout);
-           
 
-            var btntargettitle = new Button
-            {
-                //Text = "灏辨墽琛�",
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                Y = Application.GetRealHeight(90),
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                TextSize = 16,
-                TextID = MyInternationalizationString.execute,
-            };
-            targetRowLayout.AddChidren(btntargettitle);
-
-            var btntargetadd = new Button
-            {
-                Width = Application.GetRealWidth(100),
-                Height = Application.GetRealHeight(100),
-                UnSelectedImagePath = "ZigeeLogic/add.png",
-                X = Application.GetRealWidth(1080 - 140),
-                Gravity = Gravity.CenterVertical,
-            };
-            targetRowLayout.AddChidren(btntargetadd);
-            btntargetadd.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();
-            };
-
+            Addview addactionview = new Addview();
+            addactionview.iconBtn.Visible = true;
+            addactionview.titleBtn.TextID = MyInternationalizationString.execute;
+            middle.AddChidren(addactionview.AddDeviceView());
+            addactionview.clickBtn.MouseUpEventHandler += (sender, e) =>
+             {
+                 Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+                 Method.View(IfString.Action_Logic, IfString.Action_LogicScene);
+             };
 
             List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
             ListActions.Clear();
             ListActions.AddRange(Common.Logic.CurrentLogic.Actions);
-            //ListActions.Add(new Dictionary<string, object>());
-            ListActions.Add(new Dictionary<string, object>() { ["LinkType"] = "11" });
-            bool tag = false;
-            for (int i = 0; i < ListActions.Count; i++)
+            ListActions.Add(new Dictionary<string, object>());
+            new LogicDveiceStatus { }.Actions(this, middle, ListActions, logicTextBox.Text.Trim());
+
+            #endregion
+
+            #region -----姣忓ぉ 璁剧疆鍛ㄦ湡-----
+
+            var fraline1 = new FrameLayout
             {
-                var linkType = ListActions[i]["LinkType"].ToString();
-                if (linkType == "10")
-                {
-                    if (ListActions[i + 1]["LinkType"].ToString() == "0")
-                    {
-                        var delaytime = ListActions[i]["DelayTime"].ToString();
-                        if (ListActions[i + 1].ContainsKey("Time"))
-                        {
-                            ListActions[i + 1].Remove("Time");
-                        }
-                        ListActions[i + 1].Add("Time", delaytime);
-                    }
-                    tag = true;
-                    //break;
-                }
+                Height = Application.GetRealHeight(30),
+            };
+            middle.AddChidren(fraline1);
 
-            }
-
-            if (!tag)
+            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
             {
-                for (int i = 0; i < ListActions.Count; i++)
-                {
-                    var linkType = ListActions[i]["LinkType"].ToString();
-                    if (linkType == "0")
-                    {
-                        var second = ListActions[i]["Time"].ToString();
-                        if (second != "0")
-                        {
-                            Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
-                            actionsInfo.Add("LinkType", 10);
-                            actionsInfo.Add("DelayTime", second);
-                            ListActions.Insert(i, actionsInfo);
-                        }
-
-                    }
-
-                }
-            }
-
-
-            for (int i = 0; i < ListActions.Count; i++)
+                Width = Application.GetRealWidth(595),
+                Height = Application.GetRealHeight(60),
+                TextAlignment = TextAlignment.CenterRight,
+                //Text = "姣忓ぉ",
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextID = MyInternationalizationString.everyday,
+                Y = Application.GetRealHeight(35 + 30),
+                X = weekview.titleBtn.Right,
+                TextSize = 14,
+            };
+            weekview.frameLayout.AddChidren(weekBtn);
+            Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic);
+            EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
             {
-                if (i == (ListActions.Count - 1))
-                {
+                /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
+                var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); });
+                UserView.HomePage.Instance.AddChidren(cycle);
+                UserView.HomePage.Instance.PageIndex += 1;
+                cycle.Show(LogicView.IfString._Logic,false);
 
-                    var addfl = new FrameLayout
-                    {
-                        Height = Application.GetRealHeight(160),
-                    };
-                    middle.AddChidren(addfl);
-                    var addbtn = new Button
-                    {
-                        Height = Application.GetRealHeight(120),
-                        Width = Application.GetRealWidth(1000),
-                        X = Application.GetRealWidth(40),
-                        Y = Application.GetRealHeight(40),
-                        Radius = (uint)Application.GetRealHeight(30),
-                        //Text = "娣诲姞鍔熻兘",
-                        BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                        TextID = MyInternationalizationString.addfunction,
-                    };
-                    addfl.AddChidren(addbtn);
-                    addbtn.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();
-                    };
-                }
-                else
-                {
-                   var actionsrowLayout = new RowLayout
-                    {
-                        Height = Application.GetRealHeight(160),
-                    };
-                    middle.AddChidren(actionsrowLayout);
-
-                    var linkType = int.Parse(ListActions[i]["LinkType"].ToString());
-                    var actions = ListActions[i];
-
-                    switch (linkType)
-                    {
-                        case 10:
-                            {
-                                var delaytime =actions["DelayTime"].ToString();
-                             
-                                var btnDelayTime = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(382),
-                                    Height = Application.GetRealHeight(80),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Text = delaytime,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                actionsrowLayout.AddChidren(btnDelayTime);
-
-                                ///缂栬緫璁惧鐘舵�丅utton
-                                var timeedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                actionsrowLayout.AddRightView(timeedit);
-                                timeedit.MouseUpEventHandler += (sender, e) =>
-                                {
-                                    DeviceTarget.DelayTimeView(actions);
-                                };
-
-                                //if (tag)
-                                //{  
-                                //    if (ListActions[i + 1]["LinkType"].ToString() == "0")
-                                //    {
-                                //        if (ListActions[i + 1].ContainsKey("Time"))
-                                //        {
-                                //            ListActions[i + 1].Remove("Time");
-                                //        }
-                                //        ListActions[i + 1].Add("Time", delaytime);
-                                //        ///绉婚櫎鏃ф暟鎹啀娣诲姞鏂版暟鎹�
-                                //        //Common.Logic.CurrentLogic.Actions.RemoveAt(i+1);
-                                //        //Common.Logic.CurrentLogic.Actions.Insert(i + 1, Common.Logic.CurrentLogic.Actions[i + 1]);
-                                //    }
-                                //}
-                            }
-                            break;
-                        case 0:
-                            {
-
-                                var obj1 = actions["DeviceAddr"].ToString();
-                                var obj2 = actions["Epoint"].ToString();
-                                var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); });
-                                if (deviceinof == null)
-                                {
-                                    continue;
-                                }
-
-                                if (i != 0 && ListActions[i - 1]["LinkType"].ToString() != "10")
-                                {
-                                    if (ListActions[i].ContainsKey("Time"))
-                                    {
-                                        ListActions[i].Remove("Time");
-                                    }
-                                    ListActions[i].Add("Time", 0);
-                                }
-                                                          
-                                ///璁惧鍚嶇ОButton
-                                var btndevicename = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(382),
-                                    Height = Application.GetRealHeight(80),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Text = deviceinof.DeviceEpointName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                actionsrowLayout.AddChidren(btndevicename);
-
-                                ///鍖哄煙(鎴块棿)鍚嶇ОButton
-                                var btnregionname = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Y = Application.GetRealHeight(80),
-                                    Width = Application.GetRealWidth(382),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Height = Application.GetRealHeight(80),
-                                    Text = "",//Language.StringByID(MyInternationalizationString.customroom),
-                                    TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                                };
-                                actionsrowLayout.AddChidren(btnregionname);
-                                ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
-                                Send.RoomNmae(btnregionname, deviceinof);
-                                ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
-                                var devicestatus = new Button
-                                {
-                                    Width = Application.GetRealWidth(300),
-                                    Height = Application.GetRealHeight(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(1080 - 330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    };
-                                actionsrowLayout.AddChidren(devicestatus);
-
-                                ///缂栬緫璁惧鐘舵�丅utton
-                                var deviceedit = new Button
-                                {
-                                    BackgroundColor =ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                actionsrowLayout.AddRightView(deviceedit);
-
-                                ///缂栬緫鐐瑰嚮浜嬩欢
-                                deviceedit.MouseUpEventHandler += (sender, e) =>
-                                 {
-                                     //var deviceStatePage = new DeviceStatePage();
-                                     //UserView.HomePage.Instance.AddChidren(deviceStatePage);
-                                     //UserView.HomePage.Instance.PageIndex += 1;
-                                     //deviceStatePage.IsDeviceEditor = true;
-                                     //deviceStatePage.Show(deviceinof);
-
-                                     //ActionModifyDeviceStateView(deviceinof);
-                                     var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                     this.AddChidren(flMain);
-                                     LogicDevicePage.CurrentDeviceStateView(flMain, deviceinof, true);
-                                 };
-
-
-                                switch (deviceinof.Type)
-                                {
-
-                                    case DeviceType.OnOffOutput:
-                                        {
-                                            var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
-                                            if (TaskList == null)
-                                            {
-                                                continue;
-                                            }
-                                            foreach (var status in TaskList)
-                                            {
-                                                if (status["TaskType"].ToString() == "1")
-                                                {
-                                                    if (status["Data1"].ToString() == "1")
-                                                    {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.open);
-                                                    }
-                                                    else
-                                                    {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.close);
-                                                    }
-                                                }
-
-                                            }
-
-                                        }
-                                        break;
-                                    case DeviceType.WindowCoveringDevice:
-                                        {
-                                            var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
-                                            if (TaskList == null)
-                                            {
-                                                continue;
-                                            }
-                                            foreach (var status in TaskList)
-                                            {
-                                                if (status["TaskType"] == "6")
-                                                {
-                                                    if (status["Data1"] == "0")
-                                                    {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.open);
-                                                    }
-                                                    else if (status["Data1"] == "1")
-                                                    {
-                                                        devicestatus.Text = devicestatus.Text + Language.StringByID(MyInternationalizationString.close);
-                                                    }
-                                                    else if (status["Data1"] == "5")
-                                                    {
-                                                        devicestatus.Text = devicestatus.Text + status["Data2"] + "%";
-                                                    }
-                                                }
-
-                                            }
-                                        }
-                                        break;
-
-                                }
-
-
-                            }
-                            break;
-                        case 2:
-                            {
-
-                                var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); });
-                                if (sceneinof == null)
-                                {
-                                    continue;
-                                }
-                                ///鏄剧ず閫昏緫鍚嶇О
-                                var btnlogic = new Button
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(500),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = sceneinof.Name,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                };
-                                actionsrowLayout.AddChidren(btnlogic);
-
-                            }
-                            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
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(500),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    Text = logicinof.LogicName,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                };
-                                actionsrowLayout.AddChidren(btnlogic);
-
-
-                                var logicedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                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,
-                                };
-                                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
-                                {
-                                    X = Application.GetRealWidth(40),
-                                    Width = Application.GetRealWidth(700),
-                                    TextAlignment = TextAlignment.CenterLeft,
-                                    Gravity = Gravity.CenterVertical,
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    //TextColor = 0xff121212,
-                                    TextID = MyInternationalizationString.securitymode,
-                                };
-                                actionsrowLayout.AddChidren(btnsecurity);
-
-
-                                var btnsecurityedit = new Button
-                                {
-                                    BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor,
-                                    Text = Language.StringByID(MyInternationalizationString.edit),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                };
-                                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(300),
-                                    Height = Application.GetRealHeight(160),
-                                    Gravity = Gravity.CenterVertical,
-                                    //TextColor = 0xff121212,
-                                    X = Application.GetRealWidth(1080 -330),
-                                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                                    TextAlignment=TextAlignment.CenterRight,
-                                };
-                                actionsrowLayout.AddChidren(securitystatus);
-
-
-                                if (actions["SecuritySetting"].ToString() == "0")
-                                {
-                                    if (actions["Password"].ToString() == "888888")
-                                    {
-
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
-                                    }
-                                    else
-                                    {
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal);
-
-                                    }
-                                }
-                                else if (actions["SecuritySetting"].ToString() == "1")
-                                {
-                                    if (actions["SecurityModeId"].ToString() == "1")
-                                    {
-
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison);
-                                    }
-                                    else if (actions["SecurityModeId"].ToString() == "2")
-                                    {
-                                        securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
-                                    }
-                                }
-
-                            }
-                            break;
-                    }
-                    ///鍒犻櫎鎺т欢
-                    var del = new Button
-                    {
-                        BackgroundColor = ZigbeeColor.Current.LogicDelBackgroundColor,
-                        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(() => { });
-                            }
-                        };
-                        alert.Show();
-
-                    };
-
-                }
-            }
-
+            };
+            weekBtn.MouseUpEventHandler += cycleclick;
+            weekview.clickBtn.MouseUpEventHandler += cycleclick;
             #endregion
 
             #region  ----鎺ㄩ�佽缃�----
+            Method.Push(middle);
 
-            var pushRowLayout = new RowLayout
-            {
-                Height = Application.GetRealHeight(150),
-            };
-            middle.AddChidren(pushRowLayout);
-
-            var btnpushtitle = new Button
-            {
-                //Text = "鎺ㄩ�佽缃�",
-                //TextSize = 16,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                //Gravity = Gravity.CenterVertical,
-                TextID = MyInternationalizationString.pushset,
-                TextColor = ZigbeeColor.Current.LogicViewBackgroundColor,
-                Y = Application.GetRealHeight(90),
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(60),
-                TextSize = 16,
-                //TextID = MyInternationalizationString.execute,
-            };
-            pushRowLayout.AddChidren(btnpushtitle);
-
-            var pushswitchRowlayout = new RowLayout
-            {
-                Height = Application.GetRealHeight(160),
-                LineColor = ZigbeeColor.Current.LogicLineColor,
-            };
-            middle.AddChidren(pushswitchRowlayout);
-
-            var btnswitchtxet = new Button
-            {
-                //Text = "鎺ㄩ�佸紑鍏�",
-                X = Application.GetRealWidth(40),
-                TextAlignment = TextAlignment.CenterLeft,
-                Gravity = Gravity.CenterVertical,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextID = MyInternationalizationString.pushswitch,
-            };
-            pushswitchRowlayout.AddChidren(btnswitchtxet);
-
-            var btnswitch = new Button
-            {
-                Width = Application.GetMinRealAverage(183),
-                Height = Application.GetMinRealAverage(123),
-                UnSelectedImagePath = "ZigeeLogic/Switch.png",
-                SelectedImagePath = "ZigeeLogic/SwitchSelected.png",
-                X = Application.GetRealWidth(1080 - 200),
-                Gravity = Gravity.CenterVertical,
-            };
-            pushswitchRowlayout.AddChidren(btnswitch);
-
-            btnswitch.MouseUpEventHandler += (sender1, e1) =>
-            {
-                btnswitch.IsSelected = !btnswitch.IsSelected;
-                if (btnswitch.IsSelected)
-                {
-
-                }
-                else
-                {
-
-                }
-            };
-
-            var custompushRowLayout = new RowLayout
-            {
-                Height = Application.GetRealHeight(160),
-            };
-            middle.AddChidren(custompushRowLayout);
-
-            var btncustompush = new Button
-            {
-                TextID = MyInternationalizationString.custompush,
-                //Text = "鑷畾涔夋帹閫�",
-                TextAlignment = TextAlignment.CenterLeft,
-                Width = Application.GetRealWidth(300),
-                X = Application.GetRealWidth(40),
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-            };
-            custompushRowLayout.AddChidren(btncustompush);
-
-
-            var custompushback = new Button
-            {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(110),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
-                X = Application.GetRealWidth(1080 - 140),
-                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;
             #endregion
 
-         
-            var btnsave = new Button
-            {
-                Height = Application.GetRealHeight(150),//194
-                Y = middle.Bottom + Application.GetRealHeight(15),
-                //Text = "淇濆瓨",
-                Width = Application.GetRealWidth(500),
-                Radius = (uint)Application.GetRealHeight(50),
-                BackgroundColor = ZigbeeColor.Current.LogicButtonBlueColor,
-                X = Application.GetRealWidth(290),
-                TextID = MyInternationalizationString.Save,
-            };
-            if (Common.Logic.CurrentLogic.Conditions.Count != 0 && Common.Logic.CurrentLogic.Actions.Count != 0)
-            {
-                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();
-                 //UserView.HomePage.Instance.RemoveAt("Logic1");
-                 //Category.Category category = new Category.Category();
-                 //UserView.HomePage.Instance.AddChidren(category);
-                 //UserView.HomePage.Instance.PageIndex += 1;
-                 //category.Show(2);
+                 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 = "";
-                        int maxvalue = 0, minvalue = 0;
-                        var stringvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2);
-                        var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length));
-                        for (int j = 31; j >= 0; j--)
-                        {
-                            len += str.Substring(j, 1);
-                        }
-                        //鎵惧嚭鏈�灏忓��
-                        for (int j = 0; j < len.Length; j++)
-                        {
-                            var strvalue = len.Substring(j, 1);
-                            if (strvalue == "1")
-                            {
-                                minvalue = j + 1;
-                                break;
-                            }
-                        }
-                        //鎵惧嚭鏈�澶у��
-                        for (int j = 0; j < len.Length; j++)
-                        {
-                            var strvalue = len.Substring(j, 1);
-                            if (strvalue == "1")
-                            {
-                                maxvalue = j + 1;
-                            }
-                        }
-                        if (minvalue == maxvalue)
-                        {
-                            btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day);
-                        }
-                        else
-                        {
-                            btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day) + "-" + Language.StringByID(MyInternationalizationString.monthly) + maxvalue.ToString() + Language.StringByID(MyInternationalizationString.day);
-                        }
-                    }; 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()
-        {
-            Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
-            if (Common.Logic.CurrentLogic.Conditions.Count == 1)
-            {
-                #region 缁勫悎鏉′欢View
-                FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
-                this.AddChidren(flMain);
-                flMain.MouseUpEventHandler += (sender2, e2) =>
-                {
-                    flMain.RemoveFromParent();
-                };
-
-                var frameLayout = new FrameLayout
-                {
-                    Y = Application.GetRealHeight(1920 - 720),
-                    Height = Application.GetRealHeight(720),
-                    BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
-                };
-                flMain.AddChidren(frameLayout);
-
-                var titlerow = new RowLayout
-                {
-                    Height = Application.GetRealHeight(180),
-                };
-                frameLayout.AddChidren(titlerow);
-                var titlebtn = new Button
-                {
-                    //Text = "璇烽�夋嫨澶氭潯浠剁粍鍚�",
-                    TextID = MyInternationalizationString.Multicondition,
-                    TextSize = 16,
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                };
-                titlerow.AddChidren(titlebtn);
-
-                var androw = new RowLayout
-                {
-                    Height = Application.GetRealHeight(180),
-                    Y = titlerow.Bottom,
-                };
-                frameLayout.AddChidren(androw);
-                var andbtn = new Button
-                {
-                    Width = Application.GetRealWidth(600),
-                    TextID = MyInternationalizationString.Allconditions,
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    //Text = "婊¤冻鍏ㄩ儴鏉′欢鏃�", 
-                };
-                androw.AddChidren(andbtn);
-
-                var orrow = new RowLayout
-                {
-                    Height = Application.GetRealHeight(180),
-                    Y = androw.Bottom,
-                };
-                frameLayout.AddChidren(orrow);
-                var orbtn = new Button
-                {
-                    Width = Application.GetRealWidth(600),
-                    TextID = MyInternationalizationString.anycondition,
-                    //Text = "婊¤冻浠讳竴鏉′欢鏃�",
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                };
-                orrow.AddChidren(orbtn);
-
-                var cancelbtn = new Button
-                {
-                    TextID = MyInternationalizationString.cancel,
-                    TextSize = 16,
-                    Y = orrow.Bottom,
-                    Height = Application.GetRealHeight(180),
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                };
-                frameLayout.AddChidren(cancelbtn);
-                cancelbtn.MouseUpEventHandler += (sender4, e4) =>
-                {
-                    flMain.RemoveFromParent();
-                };
-                #endregion
-
-                //婊¤冻鍏ㄩ儴鏉′欢鏃剁偣鍑讳簨浠� simulation;
-                EventHandler<MouseEventArgs> andclick = (sender6, e6) =>
-                {
-                    flMain.RemoveFromParent();
-                    Common.Logic.CurrentLogic.Relationship = 0;
-                    var addLogicPage = new AddLogicPage();
-                    UserView.HomePage.Instance.AddChidren(addLogicPage);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    addLogicPage.Show();
-                };
-                androw.MouseUpEventHandler += andclick;
-                andbtn.MouseUpEventHandler += andclick;
-
-                //婊¤冻浠讳竴鏉′欢鏃剁偣鍑讳簨浠�
-                EventHandler<MouseEventArgs> orclick = (sender6, e6) =>
-                {
-                    flMain.RemoveFromParent();
-                    Common.Logic.CurrentLogic.Relationship = 1;
-                    var addLogicPage = new AddLogicPage();
-                    UserView.HomePage.Instance.AddChidren(addLogicPage);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    addLogicPage.Show();
-                };
-                orrow.MouseUpEventHandler += orclick;
-                orbtn.MouseUpEventHandler += orclick;
-            }
-            else
-            {
-                var addLogicPage = new AddLogicPage();
-                UserView.HomePage.Instance.AddChidren(addLogicPage);
-                UserView.HomePage.Instance.PageIndex += 1;
-                addLogicPage.Show();
-            }
-        }
-              
     }
 }

--
Gitblit v1.8.0