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/DeviceTarget.cs |  373 +++++++++++++++++++++++-----------------------------
 1 files changed, 164 insertions(+), 209 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
index 6d8fc64..d40a92b 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
@@ -17,116 +17,75 @@
         }
         public void Show ()
         {
+            
+            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
 
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
+            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,
+
+            var titleName = new Button {
+                TextID = MyInternationalizationString.addaction,
+                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.addaction,
+                X = Application.GetRealWidth(150),
             };
-            topRowLayout.AddChidren(titleName);
+            topFrameLayout.AddChidren (titleName);
 
-            var clickBtn = new Button
-            {
-                Width = Application.GetRealWidth(81 + 51),
-                Height = Application.GetRealHeight(58 + 40),
-                Y = Application.GetRealHeight(98 - 40),
+            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(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);
+            topFrameLayout.AddChidren (back);
             back.MouseDownEventHandler += (sender, e) => {
-                RemoveFromParent();
+                RemoveFromParent ();
             };
-            #endregion
 
-            
-            var middle = new FrameLayout
-            {
-                Y = topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
-            };
+          
+            var middle = new VerticalScrolViewLayout ();
+            middle.Y = topFrameLayout.Bottom;
+            middle.Height = Application.GetRealHeight(1920 - 220);
+            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
             this.AddChidren(middle);
 
             #region ----- 璁惧------    
-            var deviceframelayout = new FrameLayout
+            var deviceRowLayout = new RowLayout
             {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Height = Application.GetRealHeight(180),
+                //BackgroundColor = 0xff323232,
             };
-            middle.AddChidren(deviceframelayout);
+            middle.AddChidren (deviceRowLayout);
 
-            var deviceiconBtn = new Button
-            {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-                UnSelectedImagePath = "ZigeeLogic/function.png",
-
-            };
-            deviceframelayout.AddChidren(deviceiconBtn);
-
-            var devicerow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            deviceframelayout.AddChidren(devicerow);
-
-
-            var btndevice = new Button
-            {
+            var device = new Button {
+                Width = Application.GetRealWidth (400),
                 TextID = MyInternationalizationString.device,
+                //Text = "璁惧",
+                TextSize = 16,
                 TextAlignment = TextAlignment.CenterLeft,
+                X = Application.GetRealWidth (40),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
             };
-            devicerow.AddChidren(btndevice);
+            deviceRowLayout.AddChidren (device);
 
-            var btndeviceback = new Button
-            {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                X = Application.GetRealWidth(789),
-                Gravity = Gravity.CenterVertical,
+            var btndeviceback = new Button {
+                Width = Application.GetRealWidth (110),
+                Height = Application.GetRealHeight (110),
                 UnSelectedImagePath = "ZigeeLogic/next.png",
-
+                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
+                X = Application.GetRealWidth (1080-140),//550
+                Gravity = Gravity.CenterVertical,
             };
-            devicerow.AddChidren(btndeviceback);
+            deviceRowLayout.AddChidren (btndeviceback);
 
-            EventHandler<MouseEventArgs> devicestateclick = (sender, e) =>
-            {
+            EventHandler<MouseEventArgs> deviceclick = (sender, e) => {
                 Common.Logic.LogicDviceList.Clear();
                 if (Common.Logic.LogicDviceList.Count == 0)
                 {
@@ -138,122 +97,90 @@
                 logicDevicePage.Show();
 
             };
-            deviceframelayout.MouseUpEventHandler += devicestateclick;
-            btndevice.MouseUpEventHandler += devicestateclick;
-            btndeviceback.MouseUpEventHandler += devicestateclick;
-            deviceiconBtn.MouseUpEventHandler += devicestateclick;
-            devicerow.MouseUpEventHandler += devicestateclick;
-            #endregion
+             deviceRowLayout.MouseUpEventHandler += deviceclick;
+             device.MouseUpEventHandler += deviceclick;
+             btndeviceback.MouseUpEventHandler += deviceclick;
+#endregion
 
-            #region ----- 鍦烘櫙------
-
-
-            var sceneframelayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                Y= deviceframelayout.Bottom,
-            };
-            middle.AddChidren(sceneframelayout);
-
-            var sceneiconBtn = new Button
-            {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-                UnSelectedImagePath = "ZigeeLogic/scene.png",
-
-            };
-            sceneframelayout.AddChidren(sceneiconBtn);
-
-
+            #region ----- 鍦烘櫙------        
             var sceneRowLayout = new RowLayout {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                Height = Application.GetRealHeight (180),
+                //BackgroundColor = 0xff323232,
+                Y=deviceRowLayout.Bottom,
             };
-            sceneframelayout.AddChidren (sceneRowLayout);
+            middle.AddChidren (sceneRowLayout);
 
             var scene = new Button {
+                Width = Application.GetRealWidth (400),
                 TextID = MyInternationalizationString.scene,
+                //Text = "鍦烘櫙",
+                TextSize = 16,
                 TextAlignment = TextAlignment.CenterLeft,
+                X = Application.GetRealWidth (40),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
             };
             sceneRowLayout.AddChidren (scene);
 
             var btnsceneback = new Button {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                X = Application.GetRealWidth(789),
-                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth (110),
+                Height = Application.GetRealHeight (110),
                 UnSelectedImagePath = "ZigeeLogic/next.png",
+                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
+                X = Application.GetRealWidth (1080-140),//550
+                Gravity = Gravity.CenterVertical,
             };
             sceneRowLayout.AddChidren (btnsceneback);
 
-            EventHandler<MouseEventArgs> sceneclick = (sender, e) =>
-            {
-                var addScenePage = new AddScenePage();
-                UserView.HomePage.Instance.AddChidren(addScenePage);
-                UserView.HomePage.Instance.PageIndex += 1;
-                addScenePage.Show();
+            EventHandler<MouseEventArgs> sceneclick = (sender, e) => {
+                CommonPage.Loading.Start ();
+                System.Threading.Tasks.Task.Run (() => {
+                    Application.RunOnMainThread (() => {
+                        CommonPage.Loading.Hide ();
+                        var addScenePage = new AddScenePage ();
+                        UserView.HomePage.Instance.AddChidren (addScenePage);
+                        UserView.HomePage.Instance.PageIndex += 1;
+                        addScenePage.Show ();
+
+                    });
+                });
             };
              sceneRowLayout.MouseUpEventHandler += sceneclick;
              scene.MouseUpEventHandler += sceneclick;
              btnsceneback.MouseUpEventHandler += sceneclick;
-            sceneframelayout.MouseUpEventHandler += sceneclick;
-            sceneiconBtn.MouseUpEventHandler += sceneclick;
-            #endregion
+#endregion
 
             #region ----- 瀹夐槻妯″紡------        
-            var securityframelayout = new FrameLayout
+            ///瀹夐槻妯″紡
+            var securityRowLayout = new RowLayout
             {
-                Height = Application.GetRealHeight(160),
-                Y = sceneframelayout.Bottom,
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Height = Application.GetRealHeight(180),
+                //BackgroundColor = 0xff323232,
+                Y = sceneRowLayout.Bottom,
             };
-            middle.AddChidren(securityframelayout);
+            middle.AddChidren(securityRowLayout);
 
-            var securityiconBtn = new Button
+            var security = new Button
             {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                UnSelectedImagePath = "ZigeeLogic/security.png",
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-            };
-            securityframelayout.AddChidren(securityiconBtn);
-
-            var securityrow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            securityframelayout.AddChidren(securityrow);
-
-
-            var btnsecurity = new Button
-            {
-                TextAlignment = TextAlignment.CenterLeft,
+                Width = Application.GetRealWidth(400),
                 TextID = MyInternationalizationString.securitymode,
+                //Text = "瀹夐槻妯″紡",
+                TextSize = 16,
+                TextAlignment = TextAlignment.CenterLeft,
+                X = Application.GetRealWidth(40),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
             };
-            securityrow.AddChidren(btnsecurity);
+            securityRowLayout.AddChidren(security);
 
             var btnsecurityback = new Button
             {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(110),
+                Height = Application.GetRealHeight(110),
                 UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = Application.GetRealWidth(789),
+                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
+                X = Application.GetRealWidth(1080 - 140),//550
                 Gravity = Gravity.CenterVertical,
             };
-            securityrow.AddChidren(btnsecurityback);
+            securityRowLayout.AddChidren(btnsecurityback);
 
             EventHandler<MouseEventArgs> securityclick = (sender, e) => {
                 var securityMode = new SecurityMode();
@@ -262,11 +189,9 @@
                 securityMode.Show();
             };
 
-            securityframelayout.MouseUpEventHandler += securityclick;
-            btnsecurity.MouseUpEventHandler += securityclick;
+            securityRowLayout.MouseUpEventHandler += securityclick;
+            security.MouseUpEventHandler += securityclick;
             btnsecurityback.MouseUpEventHandler += securityclick;
-            securityiconBtn.MouseUpEventHandler += securityclick;
-            securityrow.MouseUpEventHandler += securityclick;
             #endregion
 
             #region ----- 宸叉湁鑷姩鍖�------      
@@ -276,7 +201,7 @@
             {
                 Height = Application.GetRealHeight(180),
                 //BackgroundColor = 0xff323232,
-                Y = securityframelayout.Bottom,
+                Y = securityRowLayout.Bottom,
             };
             //middle.AddChidren(existenceRowLayout);
 
@@ -315,71 +240,101 @@
             btnexistenceback.MouseUpEventHandler += existenceclick;
             #endregion
 
-            #region ----- 寤舵椂------
-
-            var delayedframelayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                Y = securityframelayout.Bottom,
-            };
-            middle.AddChidren(delayedframelayout);
-
-            var delayediconBtn = new Button
-            {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-                UnSelectedImagePath = "ZigeeLogic/delay.png",
-
-            };
-            delayedframelayout.AddChidren(delayediconBtn);
-
+            #region ----- 寤舵椂------        
             var delayedRowLayout = new RowLayout
             {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Height = Application.GetRealHeight(180),
+                //BackgroundColor = 0xff323232,
+                Y=securityRowLayout.Bottom,
             };
-            delayedframelayout.AddChidren(delayedRowLayout);
+           //middle.AddChidren(delayedRowLayout);
 
             var delayed = new Button
             {
-                TextAlignment = TextAlignment.CenterLeft,
+                Width = Application.GetRealWidth(400),
                 TextID = MyInternationalizationString.delayed,
+                //Text = "寤舵椂",
+                TextSize = 16,
+                TextAlignment = TextAlignment.CenterLeft,
+                X = Application.GetRealWidth(40),
                 TextColor = ZigbeeColor.Current.LogicTextBlackColor,
             };
             delayedRowLayout.AddChidren(delayed);
 
             var btndelayedback = new Button
             {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(110),
+                Height = Application.GetRealHeight(110),
                 UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = Application.GetRealWidth(789),
+                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
+                X = Application.GetRealWidth(1080 - 140),//550
                 Gravity = Gravity.CenterVertical,
             };
             delayedRowLayout.AddChidren(btndelayedback);
 
             EventHandler<MouseEventArgs> delayedclick = (sender, e) =>
             {
-                var delayTime = new DelayTime();
-                UserView.HomePage.Instance.AddChidren(delayTime);
-                UserView.HomePage.Instance.PageIndex += 1;
-                delayTime.Show();
+                //var delayTime = new DelayTime();
+                //UserView.HomePage.Instance.AddChidren(delayTime);
+                //UserView.HomePage.Instance.PageIndex += 1;
+                //delayTime.Show();
+                DelayTimeView();
             };
 
             delayedRowLayout.MouseUpEventHandler += delayedclick;
             delayed.MouseUpEventHandler += delayedclick;
             btndelayedback.MouseUpEventHandler += delayedclick;
-            delayedframelayout.MouseUpEventHandler += delayedclick;
-            delayediconBtn.MouseUpEventHandler += delayedclick;
-            #endregion
+#endregion
         }
 
-        
+        public static  void DelayTimeView(Dictionary<string, object> delayactionsInfo=null)
+        {
+            var listValues = new List<string>();
+            for (int i = 0; i < 60; i++)
+            {
+                listValues.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.second));
+            }
+            var list = new List<KeyValuePair<string, string[]>> { };
+            for (int i = 0; i <= 60; i++)
+            {
+                list.Add(new KeyValuePair<string, string[]>(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute), listValues.ToArray()));
+            }
+
+            /*
+            PickerView.Show(list, (obj) =>
+            {
+                var minute = obj.Split(',')[0].Split(' ')[0];
+                var second = obj.Split(',')[1].Split(' ')[0];
+                int value = int.Parse(minute) * 60 + int.Parse(second);
+                if (value == 0)
+                {
+                    var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
+                                                   "鏃堕棿涓嶈兘涓�0",
+                                                  Language.StringByID(MyInternationalizationString.complete));
+                    alert.Show();
+                    return;
+                }
+                if (delayactionsInfo == null)
+                {
+                    Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
+                    actionsInfo.Add("LinkType", 10);
+                    actionsInfo.Add("DelayTime", value);
+                    Common.Logic.CurrentLogic.Actions.Add(actionsInfo);
+                }
+                else
+                {
+                    if (delayactionsInfo.ContainsKey("DelayTime"))
+                    {
+                        delayactionsInfo.Remove("DelayTime");
+                    }
+                    delayactionsInfo.Add("DelayTime", value);
+                }
+                var logicCommunalPage = new LogicCommunalPage { };
+                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                UserView.HomePage.Instance.PageIndex += 1;
+                logicCommunalPage.Show(() => { });
+            }, Language.StringByID(MyInternationalizationString.complete), "");
+            */
+        }
     }
 }

--
Gitblit v1.8.0