From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 02 九月 2020 17:35:03 +0800
Subject: [PATCH] 2020-09-02-4

---
 ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs |  228 +++++++++++++++++++++-----------------------------------
 1 files changed, 87 insertions(+), 141 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs b/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs
old mode 100644
new mode 100755
index fa588ac..20e4cce
--- a/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs
@@ -16,135 +16,68 @@
 
         }
         Button selectedIcon = new Button();
-        public void Show(CommonDevice common, string name, bool edit, int timevalue)
+        public void Show(CommonDevice common, string name, bool edit, int timevalue,string _if)
         {
 
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
-            {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
-            };
-            this.AddChidren(topRowLayout);
-
-            var titleName = new Button
-            {
-                TextSize = 16,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(600),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                Text = name,
-            };
-            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();
-            };
-
-            var back = new Button
-            {
-                Width = Application.GetRealWidth(30),
-                Height = Application.GetRealHeight(51),
-                X = Application.GetRealWidth(81),
-                Y = Application.GetRealHeight(98),
-                //Gravity = Gravity.CenterVertical;
-                UnSelectedImagePath = "ZigeeLogic/back.png",
-            };
-            topRowLayout.AddChidren(back);
-            back.MouseDownEventHandler += (sender, e) =>
-            {
-                RemoveFromParent();
-            };
+            #region  涓婇潰鐨勫竷灞�浠g爜
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            view.toptitleNameBtn.Text= name;
+            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
             #endregion
 
             var middle = new VerticalScrolViewLayout
             {
-                Y = topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184 - 260),
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184 - 260),
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
+            LogicView.SaveView saveView = new LogicView.SaveView();
+            saveView.frameLayout.Y = middle.Bottom;
+            this.AddChidren(saveView.Show());
+
             int selectetimedvalue = 0;
             var timestrlist = new List<string> { "2", "5", "10", "20", "30", Language.StringByID(MyInternationalizationString.logiccustom) };
-            foreach (var intvalue in timestrlist)
+            foreach (var intValue in timestrlist)
             {
 
-                var timeframelayout = new FrameLayout
-                {
-                    Height = Application.GetRealHeight(160),
-                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                };
-                middle.AddChidren(timeframelayout);
-
-                var timeniconBtn = new Button
-                {
-                    Width = Application.GetRealWidth(81),
-                    Height = Application.GetRealHeight(81),
-                    X = Application.GetRealWidth(58),
-                    Y = Application.GetRealHeight(55),
-                    UnSelectedImagePath = "ZigeeLogic/point.png",
-
-                };
-                timeframelayout.AddChidren(timeniconBtn);
-
-                var timeRow = new RowLayout
-                {
-                    Y = Application.GetRealHeight(30),
-                    Width = Application.GetRealWidth(850),
-                    Height = Application.GetRealHeight(130),
-                    X = Application.GetRealWidth(176),
-                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-                };
-                timeframelayout.AddChidren(timeRow);
-
-                var timeBtn = new Button
-                {
-                    Text = intvalue.ToString() + Language.StringByID(MyInternationalizationString.Minute),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    Tag = intvalue,
-                };
-                timeRow.AddChidren(timeBtn);
+                FunView monView = new FunView();
+                monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png";
+                monView.funnameBtn.Text = intValue + Language.StringByID(MyInternationalizationString.Minute);
+                monView.funnameBtn.Tag = intValue;
+                monView.funnextBtn.Width = Application.GetMinRealAverage(60);
+                monView.funnextBtn.Height = Application.GetMinRealAverage(60);
+                monView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
+                monView.funnextBtn.Visible = false;
+                middle.AddChidren(monView.FunFrameView());
 
 
-                var selected = new SelectedButton(789);
-                timeRow.AddChidren(selected);
                 //鍒ゆ柇涓�涓瓧绗︽槸瀛楃涓茶繕鏄暟瀛�
-                if (intvalue.Length < 3)
+                if (intValue.Length < 3)
                 {
-                    if (timevalue== int.Parse(intvalue) * 60)
+                    if (timevalue == int.Parse(intValue) * 60)
                     {
                         selectedIcon.Visible = false;
-                        selectedIcon = selected;
-                        selected.Visible = true;
+                        selectedIcon = monView.funnextBtn;
+                        monView.funnextBtn.Visible = true;
                     }
                 }
                 else
                 {
-                    timeRow.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
+                    monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//鏈�鍚庝竴琛屽鍔�20楂樺害;
+                    monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///鏀瑰彉鏈�鍚庡姛鑳藉揩绾挎潯棰滆壊
                 }
-                EventHandler<MouseEventArgs> timeclick = (sender, e) =>
+                monView.clickviewBtn.MouseUpEventHandler+= (sender, e) =>
                 {
                     selectedIcon.Visible = false;
-                    selectedIcon = selected;
-                    selected.Visible = true;
-                    if (Language.StringByID(MyInternationalizationString.logiccustom) == timeBtn.Tag.ToString())
+                    selectedIcon = monView.funnextBtn;
+                    monView.funnextBtn.Visible = true;
+                    if (Language.StringByID(MyInternationalizationString.logiccustom) == monView.funnameBtn.Tag.ToString())
                     {
                         var secondList = new List<string>();
                         var minuteList = new List<string>();
-                        for (int i = 0; i < 61; i++)
+                        for (int i = 0; i < 60; i++)
                         {
                             if (i < 10)
                             {
@@ -159,52 +92,39 @@
                             }
 
                         }
-                        int selectIndex1 = timevalue / 60;
-                        int selectIndex2 = timevalue % 60;
-                        PickerView.ShowNormal(minuteList, secondList, new List<string>(), (Index1, Index2, Index3) =>
+                        int selectIndex1 = 0;
+                        int selectIndex2 = 0;
+                        if (timevalue > 3600)
+                        {
+                            selectIndex1 = 60;
+                            selectIndex2 = timevalue - 3600;
+                        }
+                        else
+                        {
+                            selectIndex1 = timevalue / 60;
+                            selectIndex2 = timevalue % 60;
+                        }
+                        PickerView.ShowNormal(minuteList, secondList, null, (Index1, Index2, Index3) =>
                           {
                               selectetimedvalue = int.Parse(minuteList[Index1].Split(' ')[0]) * 60 + int.Parse(secondList[Index2].Split(' ')[0]);
-                              timemethod(common, selectetimedvalue, timevalue, edit);
+                              TimeMethod(common, selectetimedvalue, timevalue, edit, _if);
                           }, selectIndex1, selectIndex2, 0, Language.StringByID(MyInternationalizationString.logiccustom));
                     }
                     else
                     {
-                        selectetimedvalue = int.Parse(timeBtn.Tag.ToString()) * 60;
+                        selectetimedvalue = int.Parse(monView.funnameBtn.Tag.ToString()) * 60;
                     }
                 };
-                timeframelayout.MouseUpEventHandler += timeclick;
-                timeniconBtn.MouseUpEventHandler += timeclick;
-                timeRow.MouseUpEventHandler += timeclick;
-                timeBtn.MouseUpEventHandler += timeclick;
-                selected.MouseUpEventHandler += timeclick;
+             
             }
 
-            var saveFrameLayout = new FrameLayout
+            saveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Y = middle.Bottom,
-                Height = Application.GetRealHeight(260),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
-            };
-            this.AddChidren(saveFrameLayout);
-
-            var btnsave = new Button
-            {
-                X = Application.GetRealWidth(85),
-                Height = Application.GetRealHeight(130),//194
-                Width = Application.GetRealWidth(910),
-                Radius = (uint)Application.GetRealHeight(60),
-                BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
-                TextID = MyInternationalizationString.Save,
-                TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-            };
-            saveFrameLayout.AddChidren(btnsave);
-            btnsave.MouseUpEventHandler += (sender, e) =>
-            {
-                timemethod(common, selectetimedvalue, timevalue, edit);
+                TimeMethod(common, selectetimedvalue, timevalue, edit,_if);
             };
         }
 
-        public void timemethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit)
+        public void TimeMethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit,string  _if)
         {
 
             var deviceConditionsInfo = new Dictionary<string, string>();
@@ -214,9 +134,9 @@
             deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString());
             deviceConditionsInfo.Add("Cluster_ID", "1280");
             deviceConditionsInfo.Add("AttriButeId", "1281");
-            deviceConditionsInfo.Add("AttriButeData1", "0");
+            deviceConditionsInfo.Add("AttriButeData1", "1");
             deviceConditionsInfo.Add("AttriButeData2", "0");
-            deviceConditionsInfo.Add("Range", "1");
+            deviceConditionsInfo.Add("Range", "5");
             if (selectetimedvalue != 0)
             {
                 if (timevalue != selectetimedvalue)
@@ -234,18 +154,44 @@
             {
                 if (!edit)
                 {
-                    var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
-                                           Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
-                                           Language.StringByID(MyInternationalizationString.complete));
+
+                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+                        Language.StringByID(MyInternationalizationString.delaytip),
+                        Language.StringByID(MyInternationalizationString.confrim));
                     alert.Show();
                     return;
                 }
 
             }
-            var logicCommunalPage = new LogicCommunalPage();
-            UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-            UserView.HomePage.Instance.PageIndex += 1;
-            logicCommunalPage.Show(() => { });
+
+            switch (_if)
+            {
+                case "logic":
+                    {
+                        //鑷姩鍖�
+                        var logicCommunalPage = new LogicCommunalPage();
+                        UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                        UserView.HomePage.Instance.PageIndex += 1;
+                        logicCommunalPage.Show(() => { });
+                    }
+                    break;
+                case "mould":
+                    {
+                        //鑷姩鍖栨帹鑽愭ā鏉�
+                        var templatePage = new TemplatePage();
+                        UserView.HomePage.Instance.AddChidren(templatePage);
+                        UserView.HomePage.Instance.PageIndex += 1;
+                        templatePage.Show();
+                    }
+                    break;
+
+            }
+
+
+            //var logicCommunalPage = new LogicCommunalPage();
+            //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+            //UserView.HomePage.Instance.PageIndex += 1;
+            //logicCommunalPage.Show(() => { });
 
         }
     }

--
Gitblit v1.8.0