From 2bf5ec775cb57d8015bee58c745a1e48081ff1b1 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 15 十月 2019 11:06:05 +0800
Subject: [PATCH] 首次合并了全部的代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs |  275 +++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 175 insertions(+), 100 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs
index b654589..e23911d 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs
@@ -13,61 +13,87 @@
             Tag = "Logic";
         }
   
-        public void Show ()
+        public void Show (string titlename)
         {
             var weeklist = new List<string> ();
 
-            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
-            var topFrameLayout = new FrameLayout
+
+            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
+            var topRowLayout = new RowLayout
             {
-                Height = Application.GetRealHeight(140),
-                Y = Application.GetRealHeight(80),
+                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
+                Height = Application.GetRealHeight(184),
+                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
             };
-            AddChidren(topFrameLayout);
+            this.AddChidren(topRowLayout);
 
             var titleName = new Button
             {
-                TextID = MyInternationalizationString.cycle,
-                TextSize = 17,
+                TextSize = 16,
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextAlignment = TextAlignment.CenterLeft,
+                X = Application.GetRealWidth(176),
+                Width = Application.GetRealWidth(400),
+                Height = Application.GetRealHeight(69),
+                Y = Application.GetRealHeight(92),
+                Text = titlename,
             };
-            topFrameLayout.AddChidren (titleName);
-                       
-            var back = new Button {
-                Width = Application.GetRealWidth (110),
-                Height = Application.GetRealHeight (110),
-                X = Application.GetRealWidth (20),
-                Gravity = Gravity.CenterVertical,
-                UnSelectedImagePath = "ZigeeLogic/Back.png",
+            topRowLayout.AddChidren(titleName);
+
+            var clickBtn = new Button
+            {
+                Width = Application.GetRealWidth(81 + 51),
+                Height = Application.GetRealHeight(58 + 40),
+                Y = Application.GetRealHeight(98 - 40),
             };
-            topFrameLayout.AddChidren (back);
-            back.MouseDownEventHandler += (sender, e) =>
+            topRowLayout.AddChidren(clickBtn);
+            clickBtn.MouseDownEventHandler += (sender, e) =>
             {
                 RemoveFromParent();
             };
 
-            var titlerl = new RowLayout {
-                Height = Application.GetRealHeight (180),
-                Y = Application.GetRealHeight (220),
+            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",
             };
-            AddChidren (titlerl);
+            topRowLayout.AddChidren(back);
+            back.MouseDownEventHandler += (sender, e) => {
+                RemoveFromParent();
+            };
+            #endregion
 
-            titlerl.AddChidren (
-             new Button {
-                 X = Application.GetRealWidth (40),
-                 //Text = "璇烽�夋嫨閲嶅鎵ц鍛ㄦ湡",
-                 TextID = MyInternationalizationString.repeat,
-                 TextSize = 17,
-                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-             }
-            );
 
-            var middle = new VerticalScrolViewLayout ();
-            middle.Y = titlerl.Bottom;
-            middle.Height = Application.GetRealHeight (1920 - 220 - 180);
-            middle.BackgroundColor =ZigbeeColor.Current.LogicBackgroundColor;
-            this.AddChidren (middle);
+            var middle = new VerticalScrolViewLayout
+            {
+                Y = topRowLayout.Bottom,
+                Height = Application.GetRealHeight(1920 - 184-260),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
+            this.AddChidren(middle);
+
+            var saveFramelayout = new FrameLayout
+            {
+                Y = middle.Bottom,
+                Height = Application.GetRealHeight(260),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
+            this.AddChidren(saveFramelayout);
+            var saveBtn= new Button
+            {
+                X = Application.GetRealWidth(85),
+                Height = Application.GetRealHeight(130),//194
+                Width = Application.GetRealWidth(910),
+                Radius = (uint)Application.GetRealHeight(60),
+                BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
+                TextID = MyInternationalizationString.Save,
+                TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
+            };
+            saveFramelayout.AddChidren(saveBtn);
 
             if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 5)
             {
@@ -127,41 +153,70 @@
                         Language.StringByID(MyInternationalizationString.sat),
                         Language.StringByID(MyInternationalizationString.sun),
             });
-            foreach (var name in cyclelist) {
-                var cyclerwLayout = new RowLayout {
-                    Height = Application.GetRealHeight (180),
-                };
-                middle.AddChidren (cyclerwLayout);
+            foreach (var name in cyclelist)
+            {
 
-                var btnname = new Button {
-                    X = Application.GetRealWidth (40),
-                    Width = Application.GetRealWidth (600),
-                    Gravity = Gravity.CenterVertical,
+                var weekFramelayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(160),
+                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                };
+                middle.AddChidren(weekFramelayout);
+
+                var weekIconBtn = new Button
+                {
+                    Width = Application.GetRealWidth(81),
+                    Height = Application.GetRealHeight(81),
+                    UnSelectedImagePath = "ZigeeLogic/point.png",
+                    X = Application.GetRealWidth(58),
+                    Y = Application.GetRealHeight(55),
+                };
+                weekFramelayout.AddChidren(weekIconBtn);
+
+                var weekRow = new RowLayout
+                {
+                    Y = Application.GetRealHeight(30),
+                    Width = Application.GetRealWidth(850),
+                    Height = Application.GetRealHeight(130),
+                    X = Application.GetRealWidth(176),
+                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                };
+                weekFramelayout.AddChidren(weekRow);
+
+
+                var weekTextBtn = new Button
+                {
                     TextAlignment = TextAlignment.CenterLeft,
                     Text = name,
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 };
-                cyclerwLayout.AddChidren (btnname);
+                weekRow.AddChidren(weekTextBtn);
 
-                var btnCheck = new Button {
-                    Width = Application.GetRealWidth (115),
-                    Height = Application.GetRealHeight (110),
+                var selectedBtn = new Button
+                {
+                    X = Application.GetRealWidth(789),
+                    Width = Application.GetMinRealAverage(60),
+                    Height = Application.GetMinRealAverage(60),
+                    UnSelectedImagePath = "ZigeeLogic/selected.png",
                     Gravity = Gravity.CenterVertical,
-                    X = Application.GetRealWidth (1080-140),
-                    SelectedImagePath = "ZigeeLogic/CheckOn.png",
-                    UnSelectedImagePath = "ZigeeLogic/Check.png",
+                    Visible = false,
                 };
-                cyclerwLayout.AddChidren (btnCheck);
+                weekRow.AddChidren(selectedBtn);
 
-                var str = weeklist.Find ((o) => { return o == name; });
-                if (str != null) {
-                    btnCheck.IsSelected = true;
+                if (Language.StringByID(MyInternationalizationString.sun) == name)
+                {
+                    weekRow.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
                 }
-                ///閫変腑鏃堕棿 
+
+                var str = weeklist.Find((o) => { return o == name; });
+                if (str != null)
+                {
+                    selectedBtn.Visible = true;
+                }
                 EventHandler<MouseEventArgs> weekclick = (sender, e) =>
                 {
-                    btnCheck.IsSelected = !btnCheck.IsSelected;
-                    if (btnCheck.IsSelected)
+                    selectedBtn.Visible = !selectedBtn.Visible;
+                    if (selectedBtn.Visible)
                     {
                         var d = weeklist.Find((o) => { return o == name; });
                         if (d == null)
@@ -171,54 +226,74 @@
                     }
                     else
                     {
-                        weeklist.RemoveAll((o) => {
+                        weeklist.RemoveAll((o) =>
+                        {
                             return o == name;
                         });
                     }
-                    int weekvalue = 0;
-                    foreach (var strname in weeklist)
-                    {
-                        if (Language.StringByID(MyInternationalizationString.mon) == strname)
-                        {
-                            weekvalue += 1;
-                        }
-                        else if (Language.StringByID(MyInternationalizationString.tue) == strname)
-                        {
-                            weekvalue += 2;
-                        }
-                        else if (Language.StringByID(MyInternationalizationString.wed) == strname)
-                        {
-                            weekvalue += 4;
-                        }
-                        else if (Language.StringByID(MyInternationalizationString.thu) == strname)
-                        {
-                            weekvalue += 8;
-                        }
-                        else if (Language.StringByID(MyInternationalizationString.frl) == strname)
-                        {
-                            weekvalue += 16;
-                        }
-                        else if (Language.StringByID(MyInternationalizationString.sat) == strname)
-                        {
-                            weekvalue += 32;
-                        }
-                        else if (Language.StringByID(MyInternationalizationString.sun) == strname)
-                        {
-                            weekvalue += 64;
-                        }
-                    }
 
-                    Common.Logic.CurrentLogic.TimeAttribute.Repeat = 5;
-                    Common.Logic.CurrentLogic.TimeAttribute.WeekDay = weekvalue;
                 };
-                cyclerwLayout.MouseUpEventHandler += weekclick;
-                btnname.MouseUpEventHandler += weekclick;
-                btnCheck.MouseUpEventHandler += weekclick;
-               
+                weekFramelayout.MouseUpEventHandler += weekclick;
+                weekTextBtn.MouseUpEventHandler += weekclick;
+                selectedBtn.MouseUpEventHandler += weekclick;
+                weekIconBtn.MouseUpEventHandler += weekclick;
+                weekRow.MouseUpEventHandler += weekclick;
+
             }
 
 
-           
+            saveBtn.MouseUpEventHandler += (sender, e) =>
+            {
+
+                int weekvalue = 0;
+                foreach (var strname in weeklist)
+                {
+                    if (Language.StringByID(MyInternationalizationString.mon) == strname)
+                    {
+                        weekvalue += 1;
+                    }
+                    else if (Language.StringByID(MyInternationalizationString.tue) == strname)
+                    {
+                        weekvalue += 2;
+                    }
+                    else if (Language.StringByID(MyInternationalizationString.wed) == strname)
+                    {
+                        weekvalue += 4;
+                    }
+                    else if (Language.StringByID(MyInternationalizationString.thu) == strname)
+                    {
+                        weekvalue += 8;
+                    }
+                    else if (Language.StringByID(MyInternationalizationString.frl) == strname)
+                    {
+                        weekvalue += 16;
+                    }
+                    else if (Language.StringByID(MyInternationalizationString.sat) == strname)
+                    {
+                        weekvalue += 32;
+                    }
+                    else if (Language.StringByID(MyInternationalizationString.sun) == strname)
+                    {
+                        weekvalue += 64;
+                    }
+                }
+                if (weekvalue == 0)
+                {
+                    var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
+                                                      Language.StringByID(MyInternationalizationString.selectweek),
+                                                  Language.StringByID(MyInternationalizationString.complete));
+
+                    alert.Show();
+                    return;
+                }
+                Common.Logic.CurrentLogic.TimeAttribute.Repeat = 5;
+                Common.Logic.CurrentLogic.TimeAttribute.WeekDay = weekvalue;
+
+                var logicCommunalPage = new LogicCommunalPage { };
+                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                UserView.HomePage.Instance.PageIndex += 1;
+                logicCommunalPage.Show(() => { });
+            };
 
 
 

--
Gitblit v1.8.0