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/DeviceTarget.cs |  361 +++++++++++----------------------------------------
 1 files changed, 78 insertions(+), 283 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
index 9d85f19..637efc3 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
@@ -15,318 +15,113 @@
         {
             Tag = "Logic";
         }
-        public void Show ()
+        /// <summary>
+        /// 娣诲姞鐩爣鍔熻兘绫�
+        /// </summary>
+        /// <param name="str1">璁惧鐣岄潰璇嗗埆瀛楃涓�</param>
+        /// <param name="str2">鍦烘櫙鐣岄潰璇嗗埆瀛楃涓�</param>
+        public void Show (string str1,string str2)
         {
-            
-            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
 
-            var topFrameLayout = new FrameLayout
+            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
+
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            view.toptitleNameBtn.TextID = MyInternationalizationString.addaction;
+            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
+            #endregion
+
+
+            var middle = new FrameLayout
             {
-                Height = Application.GetRealHeight(140),
-                Y = Application.GetRealHeight(80),
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
-            AddChidren(topFrameLayout);
-
-
-            var titleName = new Button {
-                //Text = "娣诲姞鎵ц鐩爣",
-                //TextID = MyInternationalizationString.addImplementationgoals,
-                TextSize = 17,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-            };
-            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",
-            };
-            topFrameLayout.AddChidren (back);
-            back.MouseDownEventHandler += (sender, e) => {
-                RemoveFromParent ();
-            };
-
-          
-            var middle = new VerticalScrolViewLayout ();
-            middle.Y = topFrameLayout.Bottom;
-            middle.Height = Application.GetRealHeight(1920 - 220);
-            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
             this.AddChidren(middle);
 
-            var deviceRowLayout = new RowLayout
+            #region ----- 璁惧------
+
+            FunView deviceview= new FunView();
+            deviceview.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png";
+            deviceview.funnameBtn.TextID = MyInternationalizationString.device;
+            middle.AddChidren(deviceview.FunFrameView());
+            deviceview.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Height = Application.GetRealHeight(180),
-                //BackgroundColor = 0xff323232,
-            };
-            middle.AddChidren (deviceRowLayout);
-
-            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,
-            };
-            deviceRowLayout.AddChidren (device);
-
-            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,
-            };
-            deviceRowLayout.AddChidren (btndeviceback);
-
-            EventHandler<MouseEventArgs> deviceclick = (sender, e) => {
-                Common.Logic.LogicDviceList.Clear();
-                if (Common.Logic.LogicDviceList.Count == 0)
-                {
-                    Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
-                }
-                var logicDevicePage = new LogicDevicePage();
-                UserView.HomePage.Instance.AddChidren(logicDevicePage);
+                var roomAndDeviceView = new RoomAndDeviceView();
+                UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
                 UserView.HomePage.Instance.PageIndex += 1;
-                logicDevicePage.Show();
-
+                roomAndDeviceView.IfType = str1;
+                roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addaction));
             };
-             deviceRowLayout.MouseUpEventHandler += deviceclick;
-             device.MouseUpEventHandler += deviceclick;
-             btndeviceback.MouseUpEventHandler += deviceclick;
 
-            var sceneRowLayout = new RowLayout {
-                Height = Application.GetRealHeight (180),
-                //BackgroundColor = 0xff323232,
-                Y=deviceRowLayout.Bottom,
-            };
-            middle.AddChidren (sceneRowLayout);
+            #endregion
 
-            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 (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) => {
-                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;
-
-
-            ///宸叉湁鑷姩鍖�
-            var existenceRowLayout = new RowLayout
+            #region ----- 鍦烘櫙------
+            FunView sceneview= new FunView();
+            sceneview.iconBtn.UnSelectedImagePath = "ZigeeLogic/scene.png";
+            sceneview.funnameBtn.TextID = MyInternationalizationString.scene;
+            sceneview.funFrameLayout.Y = deviceview.funFrameLayout.Bottom;
+            middle.AddChidren(sceneview.FunFrameView());
+            sceneview.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Height = Application.GetRealHeight(180),
-                //BackgroundColor = 0xff323232,
-                Y = sceneRowLayout.Bottom,
-            };
-            middle.AddChidren(existenceRowLayout);
-
-            var existence = new Button
-            {
-                Width = Application.GetRealWidth(400),
-                TextID = MyInternationalizationString.Alreadyautomated,
-                //Text = "宸叉湁鑷姩鍖�",
-                TextSize = 16,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-            };
-            existenceRowLayout.AddChidren(existence);
-
-            var btnexistenceback = 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,
-            };
-            existenceRowLayout.AddChidren(btnexistenceback);
-
-            EventHandler<MouseEventArgs> existenceclick = (sender, e) => {
-                var logicListPage = new LogicListPage();
-                UserView.HomePage.Instance.AddChidren(logicListPage);
+                var addScenePage = new AddScenePage();
+                UserView.HomePage.Instance.AddChidren(addScenePage);
                 UserView.HomePage.Instance.PageIndex += 1;
-                logicListPage.Show();
+                addScenePage.Show(str2);
             };
+            #endregion
 
-            existenceRowLayout.MouseUpEventHandler += existenceclick;
-            existence.MouseUpEventHandler += existenceclick;
-            btnexistenceback.MouseUpEventHandler += existenceclick;
-
-            ///瀹夐槻妯″紡
-            var securityRowLayout = new RowLayout
+            #region ----- 瀹夐槻妯″紡------
+            FunView securityview= new FunView();
+            securityview.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png";
+            securityview.funnameBtn.TextID = MyInternationalizationString.securitymode;
+            securityview.funFrameLayout.Y = sceneview.funFrameLayout.Bottom;
+            if (str1 == LogicView.IfString.Action_Logic)
+            {   ///鑱斿姩浜嬩欢杈撳嚭-涓嶆敮鎸佸畨闃叉ā寮�
+                ///鑷姩鍖栬緭鍑�-鏀寔瀹夐槻妯″紡
+                middle.AddChidren(securityview.FunFrameView());
+            }
+            else
             {
-                Height = Application.GetRealHeight(180),
-                //BackgroundColor = 0xff323232,
-                Y = existenceRowLayout.Bottom,
-            };
-            middle.AddChidren(securityRowLayout);
-
-            var security = new Button
+                ///鏀瑰彉鏈�鍚庡姛鑳藉揩绾挎潯棰滆壊
+                sceneview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
+            }
+            securityview.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Width = Application.GetRealWidth(400),
-                TextID = MyInternationalizationString.securitymode,
-                //Text = "瀹夐槻妯″紡",
-                TextSize = 16,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(40),
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-            };
-            securityRowLayout.AddChidren(security);
-
-            var btnsecurityback = 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,
-            };
-            securityRowLayout.AddChidren(btnsecurityback);
-
-            EventHandler<MouseEventArgs>securityclick = (sender, e) => {
                 var securityMode = new SecurityMode();
                 UserView.HomePage.Instance.AddChidren(securityMode);
                 UserView.HomePage.Instance.PageIndex += 1;
                 securityMode.Show();
             };
 
-            securityRowLayout.MouseUpEventHandler += securityclick;
-            security.MouseUpEventHandler += securityclick;
-            btnsecurityback.MouseUpEventHandler += securityclick;
+            #endregion
 
+            #region ----- 寤舵椂------
 
-
-            var delayedRowLayout = new RowLayout
+            FunView delayedview = new FunView();
+            delayedview.iconBtn.UnSelectedImagePath = "ZigeeLogic/delay.png";
+            delayedview.funnameBtn.TextID = MyInternationalizationString.delayed;
+            delayedview.funFrameLayout.Y = securityview.funFrameLayout.Bottom;
+            delayedview.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//鏈�鍚庝竴琛屽鍔�20楂樺害;
+            delayedview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///鏀瑰彉鏈�鍚庡姛鑳藉揩绾挎潯棰滆壊
+            if (str1 == LogicView.IfString.Action_Logic)
             {
-                Height = Application.GetRealHeight(180),
-                //BackgroundColor = 0xff323232,
-                Y=securityRowLayout.Bottom,
-            };
-           middle.AddChidren(delayedRowLayout);
-
-            var delayed = new Button
-            {
-                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(110),
-                Height = Application.GetRealHeight(110),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                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();
-                DelayTimeView();
-            };
-
-            delayedRowLayout.MouseUpEventHandler += delayedclick;
-            delayed.MouseUpEventHandler += delayedclick;
-            btndelayedback.MouseUpEventHandler += delayedclick;
-
-        }
-
-        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));
+                ///鑱斿姩浜嬩欢杈撳嚭-涓嶆敮鎸佸欢鏃�
+                ///鑷姩鍖栬緭鍑�-鏀寔寤舵椂
+                middle.AddChidren(delayedview.FunFrameView());
             }
-            var list = new List<KeyValuePair<string, string[]>> { };
-            for (int i = 0; i <= 60; i++)
+            delayedview.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                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);
+                var delayTime = new DelayTime();
+                UserView.HomePage.Instance.AddChidren(delayTime);
                 UserView.HomePage.Instance.PageIndex += 1;
-                logicCommunalPage.Show(() => { });
-            }, Language.StringByID(MyInternationalizationString.complete), "");
-            */
+                delayTime.Show();
+            };
+        
+            #endregion
         }
+
+        
     }
 }

--
Gitblit v1.8.0