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/EverymonthPage.cs |  422 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 240 insertions(+), 182 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs
index 27e264e..b5394a8 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs
@@ -1,7 +1,4 @@
-锘�
- 
-
-using System;
+锘縰sing System;
 using System.Collections.Generic;
 using Shared;
 using Shared.Phone;
@@ -9,104 +6,266 @@
 using Shared.Common;
 namespace Shared.Phone.Device.Logic
 {
-
     public class EverymonthPage : FrameLayout
     {
-        public EverymonthPage()
+
+      
+        public void Show()
         {
-            Tag = "Logic";
-        }
-        public void Show(string titlename)
-        {
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
+
+            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
+            var topFrameLayout = new FrameLayout
             {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
+                Height = Application.GetRealHeight(140),
+                Y = Application.GetRealHeight(80),
             };
-            this.AddChidren(topRowLayout);
+            AddChidren(topFrameLayout);
 
             var titleName = new Button
             {
-                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,
+                TextID = MyInternationalizationString.cycle,
+                TextSize = 17,
+                TextColor=ZigbeeColor.Current.LogicTextBlackColor,
             };
-            topRowLayout.AddChidren(titleName);
+            topFrameLayout.AddChidren(titleName);
 
-            var clickBtn = new Button
+            var hdl = new Button
             {
-                Width = Application.GetRealWidth(81 + 51),
-                Height = Application.GetRealHeight(58 + 40),
-                Y = Application.GetRealHeight(98 - 40),
+                Width = Application.GetRealWidth(154),
+                Height = Application.GetRealHeight(90),
+                X = Application.GetRealWidth(1080-170),
+                Gravity = Gravity.CenterVertical,
+                UnSelectedImagePath = "Logo/Logo.png",
             };
-            topRowLayout.AddChidren(clickBtn);
-            clickBtn.MouseDownEventHandler += (sender, e) =>
-            {
-                RemoveFromParent();
-            };
+            //topFrameLayout.AddChidren(hdl);
 
             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) => {
+            topFrameLayout.AddChidren(back);
+            back.MouseDownEventHandler += (sender, e) =>
+            {
                 RemoveFromParent();
             };
-            #endregion
 
-            var middle = new FrameLayout
+            var titlerl = new RowLayout
             {
-                Y = topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                Height = Application.GetRealHeight(180),
+                //BackgroundColor = 0xff0f0f0f,
+                Y = Application.GetRealHeight(220),
             };
+            AddChidren(titlerl);
+
+            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 frameLayout = new FrameLayout
+            var startdaterow = new RowLayout
             {
-                Y = Application.GetRealHeight(80),
-                X = Application.GetRealWidth(50),
-                Width = Application.GetRealWidth(1080 - 100),
-                Height = Application.GetRealHeight(180 * 5 + 50),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                Height = Application.GetRealHeight(180),
             };
-            middle.AddChidren(frameLayout);
-            
-       
-            var saveBtn = new Button
-            {
-                Y = middle.Height - Application.GetRealHeight(260),
-                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,
-            };
-            middle.AddChidren(saveBtn);
+            middle.AddChidren(startdaterow);
 
-            var monselectedlist = new List<string>();
-            monselectedlist.Clear();
-            if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 3)
+            var btnstartdatetext = new Button
             {
+                TextAlignment = TextAlignment.CenterLeft,
+                Width = Application.GetRealWidth(300),
+                X = Application.GetRealWidth(30),
+                TextID = MyInternationalizationString.startdate,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+            };
+            startdaterow.AddChidren(btnstartdatetext);
+
+            var btnstartdate = new Button
+            {
+                X = Application.GetRealWidth(330),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(600),
+                TextAlignment = TextAlignment.CenterLeft,
+                Tag = "0",
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+            };
+            startdaterow.AddChidren(btnstartdate);
+
+            var btnstartback = 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,
+            };
+            startdaterow.AddChidren(btnstartback);
+
+            var enddaterow = new RowLayout
+            {
+                Height = Application.GetRealHeight(180),
+            };
+            middle.AddChidren(enddaterow);
+            var btnenddatetext = new Button
+            {
+                TextAlignment = TextAlignment.CenterLeft,
+                Width = Application.GetRealWidth(300),
+                X = Application.GetRealWidth(30),
+                TextID = MyInternationalizationString.enddate,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+            };
+            enddaterow.AddChidren(btnenddatetext);
+
+            var btnenddate = new Button
+            {
+                X = Application.GetRealWidth(330),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(600),
+                TextAlignment = TextAlignment.CenterLeft,
+                Tag = "0",
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+            };
+            enddaterow.AddChidren(btnenddate);
+
+            var btnendtimeback = 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,
+            };
+            enddaterow.AddChidren(btnendtimeback);
+
+
+            EventHandler<MouseEventArgs> startdateclick = (sender33, e33) =>
+            {
+                var list = new List<string> { };
+                for (int day = 1; day <= 31; day++)
+                {
+                    list.Add(day.ToString() + " " + Language.StringByID(MyInternationalizationString.day));
+                }
+                //PickerView.Show(list, (obj) =>
+                //{
+                //    var day = obj.Split(' ')[0];
+                //    if (btnenddate.Tag.ToString() != "0" && int.Parse(btnenddate.Tag.ToString()) < int.Parse(day))
+                //    {
+                //        var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
+                //                               Language.StringByID(MyInternationalizationString.monthday),
+                //                               Language.StringByID(MyInternationalizationString.OK));
+                //        alert.Show();
+                //    }
+                //    else
+                //    {
+                //        btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
+                //        btnstartdate.Tag = day;
+                //        if (string.IsNullOrEmpty(btnenddate.Text))
+                //        {
+                //            btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
+                //            btnenddate.Tag = day;
+                //        }
+                //        Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3;
+                //        int a = int.Parse(btnstartdate.Tag.ToString());
+                //        int b = int.Parse(btnenddate.Tag.ToString());
+                //        string s = "";
+                //        for (int i = 32; i > 0; i--)
+                //        {
+                //            if (i >=a  && i <= b)
+                //            {
+                //                s += "1";
+                //            }
+                //            else
+                //            {
+                //                s += "0";
+                //            }
+                //        }
+                //        var intvalue = Convert.ToInt32(s, 2);
+                //        Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue;
+                //    }
+                //}, Language.StringByID(MyInternationalizationString.complete), "112");
+            };
+            startdaterow.MouseUpEventHandler += startdateclick;
+            btnstartdate.MouseUpEventHandler += startdateclick;
+            btnstartdatetext.MouseUpEventHandler += startdateclick;
+            btnstartback.MouseUpEventHandler += startdateclick;
+
+
+            EventHandler<MouseEventArgs> enddateclick = (sender33, e33) =>
+            {
+                var list = new List<string> { };
+                for (int day = 1; day <= 31; day++)
+                {
+                    list.Add(day.ToString() + " " + Language.StringByID(MyInternationalizationString.day));
+                }
+                //PickerView.Show(list, (obj) =>
+                //{
+                //    var day = obj.Split(' ')[0];
+                //    if (btnstartdate.Tag.ToString() != "0" && int.Parse(btnstartdate.Tag.ToString()) > int.Parse(day))
+                //    {
+                //        var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
+                //                               Language.StringByID(MyInternationalizationString.monthday),
+                //                               Language.StringByID(MyInternationalizationString.OK));
+                //        alert.Show();
+                //    }
+                //    else
+                //    {
+                //        btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
+                //        btnenddate.Tag = day;
+                //        if (string.IsNullOrEmpty(btnstartdate.Text))
+                //        {
+                //            btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
+                //            btnstartdate.Tag = day;
+                //        }
+
+                //        Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3;
+                //        int a = int.Parse(btnstartdate.Tag.ToString());
+                //        int b = int.Parse(btnenddate.Tag.ToString());
+                //        string s = "";
+                //        for (int i = 32; i > 0; i--)
+                //        {
+                //            if (i >= a && i <= b)
+                //            {
+                //                s += "1";
+                //            }
+                //            else
+                //            {
+                //                s += "0";
+                //            }
+                //        }
+                //        var intvalue = Convert.ToInt32(s, 2);
+                //        Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue;
+
+                //    }
+                //}, Language.StringByID(MyInternationalizationString.complete), "112");
+            };
+            enddaterow.MouseUpEventHandler += enddateclick;
+            btnenddate.MouseUpEventHandler += enddateclick;
+            btnenddatetext.MouseUpEventHandler += enddateclick;
+            btnendtimeback.MouseUpEventHandler += enddateclick;
+
+            if(Common.Logic.CurrentLogic.TimeAttribute.Repeat==3){
                 if (Common.Logic.CurrentLogic.TimeAttribute.MonthDate != 0)
                 {
                     string len = "";
+                    int minvalue = 0;
                     var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2);
                     var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length));
                     for (int j = 31; j >= 0; j--)
@@ -119,121 +278,20 @@
                         var strvalue = len.Substring(j, 1);
                         if (strvalue == "1")
                         {
-                            monselectedlist.Add((j + 1).ToString());
+                            minvalue = j + 1;
+                            break;
                         }
                     }
+
+                    btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day);
+                    btnstartdate.Tag = minvalue.ToString();
+                    btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + maxvalue.Length.ToString() + Language.StringByID(MyInternationalizationString.day);
+                    btnenddate.Tag = maxvalue.Length.ToString();
+
 
                 }
             }
-
-
-            int k = 1;
-            for (int i = 0; i < 5; i++)
-            {
-                var timeRow = new RowLayout
-                {
-                    Height = Application.GetRealHeight(180),
-                    Y = Application.GetRealHeight(180 * i),
-                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
-                };
-                frameLayout.AddChidren(timeRow);
-                for (int j = 1; j < 8; j++)
-                {
-                    if (k > 31)
-                    {
-                        continue;
-                    }
-
-                    var monBtn = new Button
-                    {
-
-                        Text = k.ToString().Length == 1 ? "0" + k.ToString() : k.ToString(),
-                        Y = Application.GetRealHeight(40),
-                        Height = Application.GetRealHeight(100),
-                        Width = Application.GetRealWidth(100),
-                        X = Application.GetRealWidth(35 * j) + Application.GetRealWidth(100 * (j - 1)),
-                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                        SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                        Radius = (uint)Application.GetRealHeight(50),
-                        BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                        SelectedBackgroundColor = ZigbeeColor.Current.LogicAddColor,
-                        Tag = k,
-                    };
-                    timeRow.AddChidren(monBtn);
-
-
-
-                    if (monselectedlist.Contains(k.ToString()))
-                    {
-                        monBtn.IsSelected = true;
-                    }
-                    k++;
-
-                    monBtn.MouseDownEventHandler += (sender, e) =>
-                    {
-                        monBtn.IsSelected = !monBtn.IsSelected;
-                        var selectedmon = monselectedlist.Find((c) => { return c == monBtn.Tag.ToString(); });
-                        if (monBtn.IsSelected)
-                        {
-                            if (selectedmon == null)
-                            {
-                                monselectedlist.Add(monBtn.Tag.ToString());
-
-                            }
-
-                        }
-                        else
-                        {
-                            if (selectedmon != null)
-                            {
-                                monselectedlist.Remove(monBtn.Tag.ToString());
-                            }
-                        }
-                    };
-                }
-            }
-
-
-
-            saveBtn.MouseUpEventHandler += (sedder, e) =>
-            {
-
-                if (monselectedlist.Count == 0)
-                {
-                    var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
-                                                     Language.StringByID(MyInternationalizationString.selectweek),
-                                                 Language.StringByID(MyInternationalizationString.complete));
-
-                    alert.Show();
-                    return;
-                }
-                string s = "";
-                for (int i = 32; i > 0; i--)
-                {
-                    var selectedmon = monselectedlist.Find((a) => { return a == i.ToString(); });
-                    if (selectedmon != null)
-                    {
-                        s += "1";
-                    }
-                    else
-                    {
-                        s += "0";
-                    }
-
-                }
-                var intvalue = Convert.ToInt32(s, 2);
-                Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3;
-                Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue;
-
-                var logicCommunalPage = new LogicCommunalPage();
-                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-                UserView.HomePage.Instance.PageIndex += 1;
-                logicCommunalPage.Show(() => { });
-
-            };
-
-
-
         }
     }
-}
\ No newline at end of file
+           
+}

--
Gitblit v1.8.0