From 1c4904d77f484c075080942d87785481b52b6fb2 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 28 十月 2019 14:58:46 +0800
Subject: [PATCH] Revert "Merge branch 'dev-tzy' into DEV_GXC"

---
 ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs |  966 +++++++++++++++++++++++---------------------------------
 1 files changed, 400 insertions(+), 566 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs
index dc7cbca..ce9932e 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs
@@ -13,7 +13,7 @@
         {
             Tag = "Logic";
         }
-       
+        public bool IsDeviceEditor;
         Dictionary<string, string> timeifon=new Dictionary<string, string>();
         Button beforeClickButton = new Button();
         TimeView timeview = new TimeView
@@ -22,25 +22,9 @@
             BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
             Width = Application.GetRealWidth(1080),
         };
-        /// <summary>
-        /// 鏍囪(鏂板姞/杩涙潵缂栬緫)
-        /// </summary>
-        public bool IsEditor;
-        /// <summary>
-        /// 璁板綍杩涙潵涔嬪墠鐨勫垎閽�
-        /// </summary>
         public string StartMin;
-        /// <summary>
-        /// 璁板綍杩涙潵涔嬪墠鐨勫皬鏃�
-        /// </summary>
         public string StartHour;
-        /// <summary>
-        /// 璁板綍杩涙潵涔嬪墠鐨勬椂闂�(寤舵椂/鎻愬墠)
-        /// </summary>
         public string AdjustTime;
-        /// <summary>
-        /// 璁板綍鏃跺埢鐨勭被鍨�(鏃ュ嚭/鏃ヨ惤/姝e父)
-        /// </summary>
         public string DateType;
         public void Show(Dictionary<string, string> dictionary)
         {
@@ -66,65 +50,51 @@
                 timeifon.Add("AdjustTime", dictionary["AdjustTime"]);
                 AdjustTime = dictionary["AdjustTime"];
 
-            }
-
-
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
+            }  
+                   
+                      
+            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
+            this.AddChidren(new Button
             {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
+                Height = Application.GetRealHeight(80),
+            });
+
+            var topFrameLayout = new FrameLayout
+            {
+                Height = Application.GetRealHeight(140),
+                Y = Application.GetRealHeight(80),
             };
-            this.AddChidren(topRowLayout);
+            AddChidren(topFrameLayout);
 
             var titleName = new Button
             {
-                TextSize = 16,
+                Text = Language.StringByID(MyInternationalizationString.addtime),
+                TextSize = 17,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(400),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                TextID = MyInternationalizationString.addtime,
+                X = Application.GetRealWidth(150),
             };
-            topRowLayout.AddChidren(titleName);
-
-            var clickBtn = new Button
-            {
-                Width = Application.GetRealWidth(81 + 51),
-                Height = Application.GetRealHeight(58 + 40),
-                Y = Application.GetRealHeight(98 - 40),
-            };
-            topRowLayout.AddChidren(clickBtn);
-            clickBtn.MouseDownEventHandler += (sender, e) =>
-            {
-                RemoveFromParent();
-            };
+            topFrameLayout.AddChidren(titleName);
 
             var back = new Button
             {
-                Width = Application.GetRealWidth(30),
-                Height = Application.GetRealHeight(51),
-                X = Application.GetRealWidth(81),
-                Y = Application.GetRealHeight(98),
-                //Gravity = Gravity.CenterVertical;
-                UnSelectedImagePath = "ZigeeLogic/back.png",
+                Width = Application.GetRealWidth(110),
+                Height = Application.GetRealHeight(110),
+                X = Application.GetRealWidth(20),
+                Gravity = Gravity.CenterVertical,
+                UnSelectedImagePath = "ZigeeLogic/Back.png",
             };
-            topRowLayout.AddChidren(back);
-            back.MouseDownEventHandler += (sender, e) => {
-                RemoveFromParent();
-            };
-            #endregion
-
-
-            var middle = new FrameLayout
+            topFrameLayout.AddChidren(back);
+            back.MouseDownEventHandler += (sender, e) =>
             {
-                Y = topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184-260),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                RemoveFromParent();
+                IsDeviceEditor = false;
             };
+
+            var middle = new VerticalScrolViewLayout();
+            middle.Y = topFrameLayout.Bottom;
+            middle.Height = Application.GetRealHeight(1920 - 220 - 200);
+            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
             this.AddChidren(middle);
 
             SelectedTimeTypeView(middle,TypeValue);
@@ -136,122 +106,96 @@
         /// </summary>
         /// <param name="middle">Middle.</param>
         /// <param name="TypeValue">Type value.</param>
-        void SelectedTimeTypeView(FrameLayout middle, int TypeValue)
+        void SelectedTimeTypeView(VerticalScrolViewLayout middle, int TypeValue)
         {
             middle.RemoveAll();
             #region   -----绔嬪嵆鎵ц
-            
-
-            var typeFramelayout = new FrameLayout
+            var row = new RowLayout
             {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Height = Application.GetRealHeight(250),
             };
-            middle.AddChidren(typeFramelayout);
+            middle.AddChidren(row);
 
-
-            var typeRowlayout = new RowLayout
+            var btnTextTitle = new Button
             {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(965),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(58),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                Height = Application.GetRealHeight(50),
+                Width = Application.GetRealWidth(800),
+                Y = Application.GetRealHeight(20),
+                X = Application.GetRealWidth(40),
+                //Text = "璇烽�夋嫨鏃堕棿绫诲瀷",
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextID=MyInternationalizationString.Selectedtimetype,
             };
-            typeFramelayout.AddChidren(typeRowlayout);
+            row.AddChidren(btnTextTitle);
 
             var btnTypeTextTitle = new Button
             {
-                Text = Language.StringByID(MyInternationalizationString.type),
+                Y = Application.GetRealHeight(20 + 50),
+                //Text = "绫诲瀷",
+                TextID = MyInternationalizationString.type,
+                X = Application.GetRealWidth(40),
                 TextAlignment = TextAlignment.CenterLeft,
+                Height = Application.GetRealHeight(180),
+                Width = Application.GetRealWidth(400),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                Width = Application.GetRealWidth(265)
             };
-            typeRowlayout.AddChidren(btnTypeTextTitle);
+            row.AddChidren(btnTypeTextTitle);
 
-
-            ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠�
-            var btnimmediateexecution = new Button
+            var btnTypeText = new Button
             {
-                X = btnTypeTextTitle.Right,
-                Gravity = Gravity.CenterVertical,
-                Width = Application.GetRealWidth(630),
+                Y = Application.GetRealHeight(20 + 50),
+                X = Application.GetRealWidth(1080 - 500 - 40),
+                //Text = "绔嬪嵆鎵ц",
+                TextID = MyInternationalizationString.immediateexecution,
                 TextAlignment = TextAlignment.CenterRight,
+                Height = Application.GetRealHeight(180),
+                Width = Application.GetRealWidth(500),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextID=MyInternationalizationString.immediateexecution,
             };
-            typeRowlayout.AddChidren(btnimmediateexecution);
-
-
-            var btnimmediateexecutionBack = new Button
-            {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = btnimmediateexecution.Right + Application.GetRealWidth(12),
-                Gravity = Gravity.CenterVertical,
-            };
-            typeRowlayout.AddChidren(btnimmediateexecutionBack);
-                                  
+            row.AddChidren(btnTypeText);
             #endregion
 
             #region   -----鏃跺埢
-            
-
-            var timetypeFramelayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                Y= typeFramelayout.Bottom,
-            };
-            middle.AddChidren(timetypeFramelayout);
-                       
-
             var rowSelectedTimeType = new RowLayout
             {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(965),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(58),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-
+                Height = Application.GetRealHeight(180),
             };
-            timetypeFramelayout.AddChidren(rowSelectedTimeType);
+            middle.AddChidren(rowSelectedTimeType);
 
             var btnTimeText = new Button
             {
-                Text = Language.StringByID(MyInternationalizationString.moment),
+                //Text = "鏃跺埢",
+                TextID = MyInternationalizationString.moment,
                 TextAlignment = TextAlignment.CenterLeft,
+                Width = Application.GetRealWidth(150),
+                X = Application.GetRealWidth(40),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                Width=Application.GetRealWidth(265)
             };
             rowSelectedTimeType.AddChidren(btnTimeText);
-            
+
 
             ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠�
             var btnTimeTpye = new Button
             {
-                X = btnTimeText.Right,
+                X = Application.GetRealWidth(300),
                 Gravity = Gravity.CenterVertical,
-                Width = Application.GetRealWidth(630),
+                Width = Application.GetRealWidth(600),
                 TextAlignment = TextAlignment.CenterRight,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
             };
             rowSelectedTimeType.AddChidren(btnTimeTpye);
 
-
             var btnTimeTpyeBack = new Button
             {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(110),
+                Height = Application.GetRealHeight(110),
                 UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = btnTimeTpye.Right+ Application.GetRealWidth(12),
+                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
+                X = Application.GetRealWidth(1080 - 140),
                 Gravity = Gravity.CenterVertical,
             };
             rowSelectedTimeType.AddChidren(btnTimeTpyeBack);
-                      
-                       
-
             EventHandler<MouseEventArgs> timetpyeclick = (sedner, e) =>
             {
                 TimeTypeView(middle, TypeValue);
@@ -260,7 +204,6 @@
             btnTimeText.MouseUpEventHandler += timetpyeclick;
             btnTimeTpye.MouseUpEventHandler += timetpyeclick;
             btnTimeTpyeBack.MouseUpEventHandler += timetpyeclick;
-            timetypeFramelayout.MouseUpEventHandler += timetpyeclick;
 
             #endregion
 
@@ -330,20 +273,8 @@
             {
 
                 #region   -----鑷畾涔夋椂闂�
-                rowSelectedTimeType.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
-                btnTimeTpyeBack.UnSelectedImagePath = "ZigeeLogic/dropdown.png";
-                var linebtn = new Button
-                {
-                    Y = timetypeFramelayout.Bottom,
-                    Height = Application.GetRealHeight(5),
-                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-                    X=Application.GetRealWidth(58),
-                    Width = Application.GetRealWidth(965),
-                };
-                middle.AddChidren(linebtn);
                 var rowTimeView = new RowLayout
                 {
-                    Y = linebtn.Bottom,
                     Height = Application.GetRealHeight(600),
                 };
                 middle.AddChidren(rowTimeView);
@@ -355,143 +286,49 @@
             {
 
                 #region   -----鎻愬墠/寤舵椂
-                                
-                var delayFramelayout = new FrameLayout
-                {
-                    Height = Application.GetRealHeight(160),
-                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                    Y = timetypeFramelayout.Bottom,
-                };
-                middle.AddChidren(delayFramelayout);
-
-
                 var rowDelayType = new RowLayout
                 {
-                    Y = Application.GetRealHeight(30),
-                    Width = Application.GetRealWidth(965),
-                    Height = Application.GetRealHeight(130),
-                    X = Application.GetRealWidth(58),
-                    LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                    Height = Application.GetRealHeight(180),
                 };
-                delayFramelayout.AddChidren(rowDelayType);
+                middle.AddChidren(rowDelayType);
 
                 var btnDelayTimeText = new Button
                 {
-                    Text = Language.StringByID(MyInternationalizationString.Advancedelay),
+                    //Text = "鎻愬墠/寤舵椂",
+                    TextID = MyInternationalizationString.Advancedelay,
                     TextAlignment = TextAlignment.CenterLeft,
+                    Width = Application.GetRealWidth(250),
+                    X = Application.GetRealWidth(40),
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    Width = Application.GetRealWidth(265)
                 };
                 rowDelayType.AddChidren(btnDelayTimeText);
-
-
                 ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠�
                 var btnDelayTime = new Button
                 {
-                    X = btnTimeText.Right,
+                    X = Application.GetRealWidth(300),
                     Gravity = Gravity.CenterVertical,
-                    Width = Application.GetRealWidth(630),
+                    Width = Application.GetRealWidth(600),
                     TextAlignment = TextAlignment.CenterRight,
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                     Text = textvalue,
                 };
                 rowDelayType.AddChidren(btnDelayTime);
 
-
                 var btnDelayTimeBack = new Button
                 {
-                    Width = Application.GetRealWidth(58),
-                    Height = Application.GetRealHeight(58),
+                    Width = Application.GetRealWidth(110),
+                    Height = Application.GetRealHeight(110),
                     UnSelectedImagePath = "ZigeeLogic/next.png",
-                    X = btnTimeTpye.Right + Application.GetRealWidth(12),
+                    SelectedImagePath = "ZigeeLogic/NextSelecte.png",
+                    X = Application.GetRealWidth(1080 - 140),
                     Gravity = Gravity.CenterVertical,
                 };
                 rowDelayType.AddChidren(btnDelayTimeBack);
 
-
-
                 EventHandler<MouseEventArgs> timeclick = (sedner, e) =>
                 {
-
-                    var mList = new List<string>();
-                    mList.Add(Language.StringByID(MyInternationalizationString.advance));
-                    mList.Add(Language.StringByID(MyInternationalizationString.nothing));
-                    mList.Add(Language.StringByID(MyInternationalizationString.delayed));
-                    var listValues = new List<string>();
-                    for (int i = 1; i < 61; i++)
-                    {
-                        if (i < 10)
-                        {
-                            var a = "0" + i.ToString();
-                            listValues.Add(a + " " + Language.StringByID(MyInternationalizationString.minute));
-                        }
-                        else
-                        {
-                            listValues.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute));
-                        }
-
-                    }
-                    var mList2 = new List<List<string>>();
-                    mList2.Add(listValues);
-                    mList2.Add(new List<string> { "0" });
-                    mList2.Add(listValues);
-                    int timevalue = 0;
-                    int selectIndex = 1;
-                    if (int.Parse(timeifon["AdjustTime"]) > 0)
-                    {
-                        selectIndex = 2;
-                        timevalue = Math.Abs(int.Parse(timeifon["AdjustTime"]));
-                    }
-                    else if (int.Parse(timeifon["AdjustTime"]) < 0)
-                    {
-                        selectIndex = 0;
-                        timevalue = Math.Abs(int.Parse(timeifon["AdjustTime"]));
-                    }
-                    else
-                    {
-                        selectIndex = 1;
-                        timevalue = 1;
-                    }
-                    PickerView.ShowSecondary(mList, mList2, (selectIndex1, selectIndex2) =>
-                    {
-
-                        switch (selectIndex1)
-                        {
-                            case 0:
-                            case 2:
-                                {
-                                    timevalue = int.Parse(listValues[selectIndex2].Split(' ')[0]);
-                                    if (selectIndex1 == 0)
-                                    {
-                                        timevalue = timevalue * -1;
-                                    }
-                                }
-                                break;
-                            case 1:
-                                timevalue = 0;
-                                break;
-
-                        }
-
-                        if (timeifon.ContainsKey("StartHour"))
-                        {
-                            timeifon.Remove("StartHour");
-                        }
-                        if (timeifon.ContainsKey("StartMin"))
-                        {
-                            timeifon.Remove("StartMin");
-                        }
-                        if (timeifon.ContainsKey("AdjustTime"))
-                        {
-                            timeifon.Remove("AdjustTime");
-                        }
-                        timeifon.Add("AdjustTime", timevalue.ToString());
-                        UserView.HomePage.Instance.ScrollEnabled = false;
-                        SelectedTimeTypeView(middle, TypeValue);
-                    }, selectIndex, timevalue - 1, Language.StringByID(MyInternationalizationString.Advancedelay));
-
+                    DelayView(middle, textvalue, TypeValue);
                 };
-                delayFramelayout.MouseUpEventHandler += timeclick;
                 rowDelayType.MouseUpEventHandler += timeclick;
                 btnDelayTimeText.MouseUpEventHandler += timeclick;
                 btnDelayTime.MouseUpEventHandler += timeclick;
@@ -504,19 +341,18 @@
             var fra = new FrameLayout
             {
                 Y = middle.Bottom,
-                Height = Application.GetRealHeight(260),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                Height = Application.GetRealHeight(200),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
             };
-           this.AddChidren(fra);
+            this.AddChidren(fra);
             var btnsave = new Button
             {
-                X = Application.GetRealWidth(85),
-                Height = Application.GetRealHeight(130),//194
-                Width = Application.GetRealWidth(910),
-                Radius = (uint)Application.GetRealHeight(60),
-                BackgroundColor =ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
+                X = Application.GetRealWidth(290),
+                Height = Application.GetRealHeight(150),//194
+                Width = Application.GetRealWidth(500),
+                Radius = (uint)Application.GetRealHeight(50),
+                BackgroundColor = ZigbeeColor.Current.LogicButtonBlueColor,
                 TextID = MyInternationalizationString.Save,
-                TextColor= ZigbeeColor.Current.LogicBtnSaveTextColor,
             };
             fra.AddChidren(btnsave);
             btnsave.MouseUpEventHandler += (sender, e) =>
@@ -539,7 +375,7 @@
                     timeifon.Add("StartMin", timeview.Minute.ToString());
                 }
 
-                if (IsEditor)
+                if (IsDeviceEditor)
                 {
                     for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
                     {
@@ -564,7 +400,7 @@
                             }
                         }
                     }
-                    IsEditor = false;
+                    IsDeviceEditor = false;
                 }
                 else
                 {
@@ -582,10 +418,10 @@
         /// 澶勭悊閫変腑鏃堕棿绫诲瀷鐨勬柟娉�
         /// </summary>
         /// <param name="middle">Middle.</param>
-        void TimeTypeView(FrameLayout middle, int TypeValue)
+        void TimeTypeView(VerticalScrolViewLayout middle,int TypeValue)
         {
             UserView.HomePage.Instance.ScrollEnabled = false;
-            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
+            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
             this.AddChidren(flMain);
             flMain.MouseUpEventHandler += (sender12, e12) =>
             {
@@ -593,324 +429,322 @@
                 flMain.RemoveFromParent();
             };
 
-            var fraview1 = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(100),
-                Y = Application.GetRealHeight(1920 - 100),
+            var fraview = new FrameLayout {
+                Width = Application.GetRealWidth(1080 - 80),
+                Height = Application.GetRealHeight(160*6),
+                Y = Application.GetRealHeight(1920 - 50 - 960),
+                X = Application.GetRealWidth(40),
                 BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            flMain.AddChidren(fraview1);
-
-            var fraview = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(850),
-                Y = Application.GetRealHeight(1920 - 850),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                Radius = (uint)Application.GetRealHeight(60),
+                Radius = (uint)Application.GetRealHeight(40),
             };
             flMain.AddChidren(fraview);
 
-            #region  -------鍙栨秷   瀹屾垚
-            var timetype = new RowLayout
-            {
-                Height = Application.GetRealHeight(140),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+            var textBtn = new Button {
+                Width = Application.GetRealWidth(1080 - 80),
+                Height = Application.GetRealHeight(120),
+                TextAlignment=TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextID=MyInternationalizationString.selectcommontimetype,
             };
-            fraview.AddChidren(timetype);
-            var Btncancel = new Button
-            {
-                TextID = MyInternationalizationString.cancel,
-                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                X = Application.GetRealWidth(80),
-                TextAlignment = TextAlignment.CenterLeft,
-            };
-            timetype.AddChidren(Btncancel);
-            Btncancel.MouseUpEventHandler += (sender16, e16) =>
-            {
-                flMain.RemoveFromParent();
-                UserView.HomePage.Instance.ScrollEnabled = true;
-            };
+            fraview.AddChidren(textBtn);
 
-            var Btntitle = new Button
+            var timetypeframelayout = new VerticalScrolViewLayout
             {
-                TextID = MyInternationalizationString.type,
-                TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(320),
+                Width = Application.GetRealWidth(1080 - 80),
+                Height = Application.GetRealHeight(160*4),
+                Y = textBtn.Bottom,
+            };
+            fraview.AddChidren(timetypeframelayout);
+
+
+            var cancelBtn = new Button
+            {
+                Width = Application.GetRealWidth(1080 - 80),
+                Height = Application.GetRealHeight(160),
                 TextAlignment = TextAlignment.Center,
-                X = Btncancel.Right + Application.GetRealWidth(100),
-                TextSize = 16,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextID = MyInternationalizationString.cancel,
+                Y = timetypeframelayout.Bottom+Application.GetRealHeight(40),
+                BackgroundColor= ZigbeeColor.Current.LogicTopViewBackgroundColor,
             };
-            timetype.AddChidren(Btntitle);
-            var Btncomplete = new Button
-            {
-                TextID = MyInternationalizationString.complete,
-                TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                TextAlignment = TextAlignment.CenterRight,
-                X = Btntitle.Right + Application.GetRealWidth(100),
-
-            };
-            timetype.AddChidren(Btncomplete);
-            #endregion
-            #region  -------鏃ュ嚭锛屾棩钀斤紝姝e崍锛岃嚜瀹氫箟
-            #region 鏃ュ嚭
-
-
-            var sunriseFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = timetype.Bottom + Application.GetRealHeight(50),
-            };
-            fraview.AddChidren(sunriseFrameLayout);
-
-            var sunriseRow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            sunriseFrameLayout.AddChidren(sunriseRow);
-
-            var btnsunrisetext = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.sunrise,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-            };
-            sunriseRow.AddChidren(btnsunrisetext);
-
-            var sunriseSelected = new SelectedButton();
-            sunriseRow.AddChidren(sunriseSelected);
-            #endregion
-            #region 鏃ヨ惤
-
-
-
-            var sunsetFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = sunriseFrameLayout.Bottom,
-            };
-            fraview.AddChidren(sunsetFrameLayout);
-
-            var sunsetRow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            sunsetFrameLayout.AddChidren(sunsetRow);
-
-            var btnsunsettext = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.sunset,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-            };
-            sunsetRow.AddChidren(btnsunsettext);
-
-            var sunsetSelected = new SelectedButton();
-            sunsetRow.AddChidren(sunsetSelected);
-            #endregion
-
-            #region 姝e崍
-            //姝e崍
-
-
-
-            var noonFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = sunsetFrameLayout.Bottom,
-            };
-            fraview.AddChidren(noonFrameLayout);
-
-            var noonRow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            noonFrameLayout.AddChidren(noonRow);
-
-            var btnnoontext = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.noon,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-            };
-            noonRow.AddChidren(btnnoontext);
-
-            var noonSelected = new SelectedButton();
-            noonRow.AddChidren(noonSelected);
-
-            #endregion
-            #region 鑷畾涔�
-
-            var logiccustomFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = noonFrameLayout.Bottom,
-            };
-            fraview.AddChidren(logiccustomFrameLayout);
-
-            var logiccustomRow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            logiccustomFrameLayout.AddChidren(logiccustomRow);
-
-            var btnlogiccustomtext = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.logiccustom,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-            };
-            logiccustomRow.AddChidren(btnlogiccustomtext);
-
-            var logiccustomSelected = new SelectedButton();
-            logiccustomRow.AddChidren(logiccustomSelected);
-            #endregion
-            int value = -1;
-            EventHandler<MouseEventArgs> sunriseclick = (sender,e) => {
-                btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                sunriseSelected.Visible = true;
-                sunsetSelected.Visible = false;
-                noonSelected.Visible = false;
-                logiccustomSelected.Visible = false;
-                value = 1;
-            };
-            sunriseFrameLayout.MouseUpEventHandler += sunriseclick;
-            sunriseRow.MouseUpEventHandler += sunriseclick;
-            btnsunrisetext.MouseUpEventHandler += sunriseclick;
-            sunriseSelected.MouseUpEventHandler += sunriseclick;
-
-            EventHandler<MouseEventArgs> sunsetclick = (sender, e) => {
-                btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                sunriseSelected.Visible = false;
-                sunsetSelected.Visible = true;
-                noonSelected.Visible = false;
-                logiccustomSelected.Visible = false;
-                value = 2;
-            };
-            sunsetFrameLayout.MouseUpEventHandler += sunsetclick;
-            sunsetRow.MouseUpEventHandler += sunsetclick;
-            btnsunsettext.MouseUpEventHandler += sunsetclick;
-            sunsetSelected.MouseUpEventHandler += sunsetclick;
-
-            EventHandler<MouseEventArgs> noonclick = (sender, e) =>
-            {
-                btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                sunriseSelected.Visible = false;
-                sunsetSelected.Visible = false;
-                noonSelected.Visible = true;
-                logiccustomSelected.Visible = false;
-                value = 3;
-            };
-            noonFrameLayout.MouseUpEventHandler += sunsetclick;
-            noonRow.MouseUpEventHandler += noonclick;
-            btnnoontext.MouseUpEventHandler += noonclick;
-            noonSelected.MouseUpEventHandler += noonclick;
-
-            EventHandler<MouseEventArgs> ogiccustomclick = (sender, e) =>
-            {
-                btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                sunriseSelected.Visible = false;
-                sunsetSelected.Visible = false;
-                noonSelected.Visible = false;
-                logiccustomSelected.Visible = true;
+            fraview.AddChidren(cancelBtn);
+            cancelBtn.MouseUpEventHandler += (sender,e) => {
                 UserView.HomePage.Instance.ScrollEnabled = true;
                 flMain.RemoveFromParent();
-
-                if (timeifon.ContainsKey("StartHour"))
-                {
-                    timeifon.Remove("StartHour");
-                }
-                if (timeifon.ContainsKey("StartMin"))
-                {
-                    timeifon.Remove("StartMin");
-                }
-                if (timeifon.ContainsKey("AdjustTime"))
-                {
-                    timeifon.Remove("AdjustTime");
-                }
-                if (timeifon.ContainsKey("DateType"))
-                {
-                    timeifon.Remove("DateType");
-                }
-                timeifon.Add("DateType", "0");
-                timeifon.Add("StartHour", "12");
-                timeifon.Add("StartMin", "0");
-                SelectedTimeTypeView(middle, 0);
             };
-            logiccustomFrameLayout.MouseUpEventHandler += ogiccustomclick;
-            logiccustomRow.MouseUpEventHandler += ogiccustomclick;
-            btnlogiccustomtext.MouseUpEventHandler += ogiccustomclick;
-            logiccustomSelected.MouseUpEventHandler += ogiccustomclick;
 
-            #endregion
-            Btncomplete.MouseUpEventHandler += (sender, e) =>
+            List<string> timetypelist = new List<string> {
+                Language.StringByID(MyInternationalizationString.sunrise),
+                Language.StringByID(MyInternationalizationString.sunset),
+                Language.StringByID(MyInternationalizationString.noon),
+                Language.StringByID(MyInternationalizationString.logiccustom),
+               };
+
+            foreach (var typename in timetypelist)
             {
-                if (value == -1)
-                {
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                flMain.RemoveFromParent();
-                if (timeifon.ContainsKey("StartHour"))
-                {
-                    timeifon.Remove("StartHour");
-                }
-                if (timeifon.ContainsKey("StartMin"))
-                {
-                    timeifon.Remove("StartMin");
-                }
-                if (timeifon.ContainsKey("AdjustTime"))
-                {
-                    timeifon.Remove("AdjustTime");
-                }
-                if (timeifon.ContainsKey("DateType"))
-                {
-                    timeifon.Remove("DateType");
-                }
-                timeifon.Add("DateType", value.ToString());
-                timeifon.Add("AdjustTime", "0");
-                SelectedTimeTypeView(middle, value);
-            };
 
+                var timerowlayout = new RowLayout
+                {
+                    Height = Application.GetRealHeight(160),
+                };
+                timetypeframelayout.AddChidren(timerowlayout);
+
+                var btntimetext = new Button
+                {
+                    Text = typename,
+                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                    TextAlignment=TextAlignment.CenterLeft,
+                    X=Application.GetRealWidth(40),
+                };
+                timerowlayout.AddChidren(btntimetext);
+
+
+                EventHandler<MouseEventArgs> timesclick = (sender, e) =>
+                {
+                    UserView.HomePage.Instance.ScrollEnabled = true;
+                    flMain.RemoveFromParent();
+                    int a = 0;
+                    if(btntimetext.Text==Language.StringByID(MyInternationalizationString.logiccustom)){
+                        a = 0;
+                    }
+                    else if(btntimetext.Text == Language.StringByID(MyInternationalizationString.sunrise)){
+                        a = 1;
+                    }
+                    else if (btntimetext.Text == Language.StringByID(MyInternationalizationString.sunset)) {
+                        a = 2;
+                    }
+                    else if (btntimetext.Text == Language.StringByID(MyInternationalizationString.noon)) { 
+                        a = 3;
+                        
+                    }
+                    if (a == TypeValue)
+                    {
+                        UserView.HomePage.Instance.ScrollEnabled = true;
+                        flMain.RemoveFromParent();
+                        return;
+                    }
+
+                   if (timeifon.ContainsKey("StartHour"))
+                    {
+                        timeifon.Remove("StartHour");
+                    }
+                    if (timeifon.ContainsKey("StartMin"))
+                    {
+                        timeifon.Remove("StartMin");
+                    }
+                    if (timeifon.ContainsKey("AdjustTime"))
+                    {
+                        timeifon.Remove("AdjustTime");
+                    }
+                    if (timeifon.ContainsKey("DateType"))
+                    {
+                        timeifon.Remove("DateType");
+                    }
+                    timeifon.Add("DateType", a.ToString());
+                    if (a == 0)
+                    {
+                        timeifon.Add("StartHour", "12");
+                        timeifon.Add("StartMin", "0");
+                    }
+                    else
+                    {
+                        timeifon.Add("AdjustTime", "0");
+                    }
+
+                    SelectedTimeTypeView(middle, a);
+
+                };
+                timerowlayout.MouseUpEventHandler += timesclick;
+                btntimetext.MouseUpEventHandler += timesclick;
+
+            }
         }
-       
+        /// <summary>
+        /// 閫変腑寤舵椂鏃堕棿鐨勫鐞嗘柟娉�
+        /// </summary>
+        /// <param name="middle">Middle.</param>
+        void DelayView(VerticalScrolViewLayout middle,string timename,int TypeValue)
+        {
+           UserView.HomePage.Instance.ScrollEnabled = false;
+            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+            this.AddChidren(flMain);
+            flMain.MouseUpEventHandler += (sender12, e12) =>
+            {
+                UserView.HomePage.Instance.ScrollEnabled = true;
+                flMain.RemoveFromParent();
+            };
+
+            var fraDelay = new FrameLayout
+            {
+                Width = Application.GetRealWidth(1080 - 80),
+                X = Application.GetRealWidth(40),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(50),
+                Height=Application.GetRealHeight(1260-250),
+                Y=Application.GetRealHeight(1920-1260+250),
+            };
+            flMain.AddChidren(fraDelay);
+
+            var titleTextfra = new FrameLayout
+            {
+                Height = Application.GetRealHeight(180),
+            };
+            fraDelay.AddChidren(titleTextfra);
+
+
+            var btnTxet = new Button
+            {
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Height = Application.GetRealHeight(180),
+                Width = Application.GetRealWidth(400),
+                //Text = "璇烽�夋嫨鏃堕棿",
+                TextID=MyInternationalizationString.selectedtime,
+                X = Application.GetRealWidth(300),
+            };
+            titleTextfra.AddChidren(btnTxet);
+                   
+
+            var btnSave = new Button
+            {
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetRealHeight(180),
+                Text = Language.StringByID(MyInternationalizationString.complete),
+                TextColor = ZigbeeColor.Current.LogicTextBlueColor,
+                X = Application.GetRealWidth(1000 - 200),
+            };
+            titleTextfra.AddChidren(btnSave);
+
+
+            var timetypeframelayout = new VerticalScrolViewLayout
+            {
+                Width = Application.GetRealWidth(1080 - 80),
+                Height = Application.GetRealHeight(900-250+20),
+                Y =titleTextfra.Bottom,
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+            };
+            fraDelay.AddChidren(timetypeframelayout);
+
+            var cancel = new Button
+            {
+                Height = Application.GetRealHeight(160),
+                TextID = MyInternationalizationString.cancel,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextSize = 16,
+                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
+                Y =fraDelay.Height- Application.GetRealHeight(160),
+
+            };
+            fraDelay.AddChidren(cancel);
+            cancel.MouseUpEventHandler += (sender, e) =>
+            {
+                flMain.RemoveFromParent();
+                UserView.HomePage.Instance.ScrollEnabled = true;
+            };
+
+            List<string> timevaluelist = new List<string> {
+                Language.StringByID(MyInternationalizationString.advance)+"10"+ Language.StringByID(MyInternationalizationString.logicminute),
+                Language.StringByID(MyInternationalizationString.advance)+"5"+ Language.StringByID(MyInternationalizationString.logicminute),
+                Language.StringByID(MyInternationalizationString.advance)+"1"+ Language.StringByID(MyInternationalizationString.logicminute),
+                Language.StringByID(MyInternationalizationString.nothing),
+                Language.StringByID(MyInternationalizationString.delayed)+"1"+ Language.StringByID(MyInternationalizationString.logicminute),
+                Language.StringByID(MyInternationalizationString.delayed)+"5"+ Language.StringByID(MyInternationalizationString.logicminute),
+                Language.StringByID(MyInternationalizationString.delayed)+"10"+ Language.StringByID(MyInternationalizationString.logicminute),
+               };
+            string strvalue = "";
+            foreach (var typename in timevaluelist)
+            {
+                var timerowlayout = new RowLayout
+                {
+                    Height = Application.GetRealHeight(130),
+                    LineColor=ZigbeeColor.Current.LogicBackgroundColor,
+                };
+                timetypeframelayout.AddChidren(timerowlayout);
+
+                var btntimetext = new Button
+                {
+                    Text = typename,
+                    Gravity = Gravity.Center,
+                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                    SelectedBackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
+                };
+                timerowlayout.AddChidren(btntimetext);
+                if (timename == typename)
+                {
+                    beforeClickButton.IsSelected = false;
+                    beforeClickButton = btntimetext;
+                    btntimetext.IsSelected = true;
+                    strvalue = btntimetext.Text;
+                }
+
+                EventHandler<MouseEventArgs> timesclick = (sender, e) =>
+                {
+                    strvalue = btntimetext.Text;
+                    beforeClickButton.IsSelected = false;
+                    beforeClickButton = btntimetext;
+                    btntimetext.IsSelected = true;
+                };
+                timerowlayout.MouseUpEventHandler += timesclick;
+                btntimetext.MouseUpEventHandler += timesclick;
+
+            }
+
+            btnSave.MouseUpEventHandler += (sender2, e2) =>
+            {
+                flMain.RemoveFromParent();
+                UserView.HomePage.Instance.ScrollEnabled = true;
+                if (timeifon.ContainsKey("StartHour"))
+                {
+                    timeifon.Remove("StartHour");
+                }
+                if (timeifon.ContainsKey("StartMin"))
+                {
+                    timeifon.Remove("StartMin");
+                }
+                if (timeifon.ContainsKey("AdjustTime"))
+                {
+                    timeifon.Remove("AdjustTime");
+                }
+                switch (strvalue)
+                {
+                    case "鎻愬墠10鍒嗛挓":
+                        {
+                            timeifon.Add("AdjustTime", "-10");
+                        }
+                        break;
+                    case "鎻愬墠5鍒嗛挓":
+                        {
+                            timeifon.Add("AdjustTime", "-5");
+                        }
+                        break;
+                    case "鎻愬墠1鍒嗛挓":
+                        {
+                            timeifon.Add("AdjustTime", "-1");
+                        }
+                        break;
+                    case "鏃�":
+                        {
+                            timeifon.Add("AdjustTime", "0");
+                        }
+                        break;
+                    case "寤舵椂1鍒嗛挓":
+                        {
+                            timeifon.Add("AdjustTime", "1");
+                        }
+                        break;
+                    case "寤舵椂5鍒嗛挓":
+                        {
+                            timeifon.Add("AdjustTime", "5");
+                        }
+                        break;
+                    case "寤舵椂10鍒嗛挓":
+                        {
+                            timeifon.Add("AdjustTime", "10");
+                        }
+                        break;
+
+                }
+                SelectedTimeTypeView(middle, TypeValue);
+            };
+        }
     }
 }

--
Gitblit v1.8.0