From 06802250b4b9041d39d568c1dbe77684075006b2 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 11 三月 2020 10:03:44 +0800
Subject: [PATCH] 上传一个版本

---
 ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs |  191 +++++++++++++++--------------------------------
 1 files changed, 63 insertions(+), 128 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
index 12402f0..213e42d 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
@@ -16,125 +16,70 @@
         {
             Tag = "Logic";
         }
+     
+        ///鎴块棿婊戝姩鎺т欢
+        public HorizontalScrolViewLayout roomhorizontalScrol = new HorizontalScrolViewLayout
+        {
+            Width = Application.GetRealWidth(1080 - 58),
+            Height = Application.GetRealHeight(200),
+            Y = Application.GetRealHeight(184),
+            X = Application.GetRealWidth(58),
+        };
+        public VerticalScrolViewLayout middle = new VerticalScrolViewLayout
+        {
+            Width = Application.GetRealWidth(1080),
+            Height = Application.GetRealHeight(1920 - 260 - 200 - 184),
+            BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+        };
+        public FrameLayout saveframeLayout = new FrameLayout {
+            Height = Application.GetRealHeight(260),
+            BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+        };
+
         Button roombjButton = new Button();
         Button roomTextButton = new Button();
         Button clickbutton = new Button();
-        HorizontalScrolViewLayout roomhorizontalScrol;
-        VerticalScrolViewLayout middle;
         public string clickTag = "no";
         public SceneUI tempScene = null;
         Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
-        public void Show()
+        public void Show(string sceneType)
         {
+            #region  涓婇潰鐨勫竷灞�浠g爜
             UserView.HomePage.Instance.ScrollEnabled = false;
             this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView(true));
+            view.toptitleNameBtn.TextID =MyInternationalizationString.addscene;
+            view.clickBtn.MouseDownEventHandler += (sender, e) =>
             {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
-            };
-            this.AddChidren(topRowLayout);
-
-            var titleName = new Button
-            {
-                TextSize = 17,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(160),
-                Width = Application.GetRealWidth(600),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                TextID = MyInternationalizationString.addscene,
-                IsBold = true,
-            };
-            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();
                 UserView.HomePage.Instance.ScrollEnabled = true;
-            };
-
-            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();
-                UserView.HomePage.Instance.ScrollEnabled = true;
             };
-
-            var foolrname = new Button
+            view.foolrnameBtn.Text = Config.Instance.Home.GetCurrentFloorName;
+            if (Config.Instance.Home.FloorDics.Count < 2)
             {
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterRight,
-                X = Application.GetRealWidth(1080 - 400 - 120),
-                Width = Application.GetRealWidth(400),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                //TextID = MyInternationalizationString.customroom,
-                Text = Config.Instance.Home.GetCurrentFloorName,
-                TextSize = 14,
-            };
-            topRowLayout.AddChidren(foolrname);
-            var dropdown = new Button
+                ///娌℃湁妤煎眰鎴栬�呭彧鏈変竴涓ゼ灞傦紝榛樿涓嶆樉绀哄浘鏍囧拰鏂囨湰;
+                view.foolrnameBtn.Visible = false;
+                view.dropdownBtn.Visible = false;
+                view.foolrclickBtn.Visible = false;
+            }
+            if (Config.Instance.Home.FloorDics.Count == 0)
             {
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterRight,
-                X = foolrname.Right,
-                Width = Application.GetRealWidth(72),
-                Height = Application.GetRealHeight(72),
-                Y = Application.GetRealHeight(92),
-                UnSelectedImagePath = "ZigeeLogic/drop-down.png",
-            };
-            topRowLayout.AddChidren(dropdown);
+                Config.Instance.Home.CurrentFloorId = "";
+            }
             #endregion
-
+
             ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
             var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms();
             if (listAllRoom.Count == 0)
             {
                 return;
             }
-            ///鎴块棿婊戝姩鎺т欢
-             roomhorizontalScrol = new HorizontalScrolViewLayout()
-            {
-                Width = Application.GetRealWidth(1080 - 58),
-                Height = Application.GetRealHeight(200),
-                Y = topRowLayout.Bottom,
-                X = Application.GetRealWidth(58),
-            };
+         
             this.AddChidren(roomhorizontalScrol);
-
-
-
-            middle = new VerticalScrolViewLayout();
             middle.Y = roomhorizontalScrol.Bottom;
-            middle.Height = Application.GetRealHeight(1920 - 260 - 200 - 184);
-            middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
             this.AddChidren(middle);
-
-            var saveframeLayout = new FrameLayout
-            {
-                Y = middle.Bottom,
-                Height = Application.GetRealHeight(260),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
-            };
+            saveframeLayout.Y = middle.Bottom;
             this.AddChidren(saveframeLayout);
 
             var btnsave = new Button
@@ -166,17 +111,26 @@
                 }
                 actionsInfo.Add("LinkType", 2);
                 LogicIfon.AddSceneactions(tempScene, actionsInfo);
-                var logicCommunalPage = new LogicCommunalPage();
-                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
-                UserView.HomePage.Instance.PageIndex += 1;
-                logicCommunalPage.Show(() => { });
+                if (sceneType ==LogicView.IfString.Action_LogicScene)
+                {
+                    //鑷姩鍖栧満鏅�
+                    var logicCommunalPage = new LogicCommunalPage();
+                    UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    logicCommunalPage.Show(() => { });
+                }
+                else {
+                    //闂ㄩ攣鍦烘櫙
+                    var lockLogicCommunalPage = new DoorLockLogic.LockLogicCommunalPage();
+                    UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    lockLogicCommunalPage.Show(() => { });
+                }
 
             };
 
-         
-
             ///妤煎眰鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> foorlclick = (sender, e) =>
+            view.foolrclickBtn.MouseUpEventHandler += (sender, e) =>
             {
 
                 var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
@@ -249,7 +203,7 @@
                         TextSize = 14,
                     };
                     foolrRowLayout.AddChidren(btnfoolrname);
-                    if (foolrname.Text == foolr.Value)
+                    if (view.foolrnameBtn.Text == foolr.Value)
                     {
                         btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
                         btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
@@ -258,10 +212,10 @@
                     EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
                     {
                         roomhorizontalScrol.RemoveAll();
-                        foolrname.Text = btnfoolrname.Text;
+                        view.foolrnameBtn.Text = btnfoolrname.Text;
                         middle.RemoveAll();
                         flMain.RemoveFromParent();
-                        var list = Send.GetRoomList(btnfoolrname.Tag.ToString());
+                        var list = Method.GetRoomList(sceneType, btnfoolrname.Tag.ToString());
                         AllRoomView(list);
 
                     };
@@ -272,32 +226,13 @@
                 }
 
             };
-            foolrname.MouseUpEventHandler += foorlclick;
-            dropdown.MouseUpEventHandler += foorlclick;
-
-            ///绗竴娆¤繘鏉�
-            var roomlists = new List<Common.Room>();
-            roomlists.Clear();
-            if (Config.Instance.Home.FloorDics.Count < 2)
+            ///鎴块棿鍒楄〃
+            var roomlists = Method.GetRoomList(sceneType, Config.Instance.Home.CurrentFloorId);
+            if (roomlists.Count == 0)
             {
-                foolrname.Visible = false;
-                dropdown.Visible = false;
-                if (Config.Instance.Home.FloorDics.Count == 0)
-                {
-                    roomlists.AddRange(listAllRoom);
-                }
-                else
-                {
-                    roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
-                }
+                ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
+                return;
             }
-            else
-            {
-                roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
-
-            }
-
-
             ///绗竴娆¤繘鏉�
             AllRoomView(roomlists);
 

--
Gitblit v1.8.0