From 7a23bcdf0fe5f7442aa95ec2203cd5b6670a910d Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 19 十二月 2019 17:59:33 +0800
Subject: [PATCH] 2019-12-19-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs |  105 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 82 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index e10217c..a8167b2 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -18,7 +18,7 @@
             Tag = "Logic";
         }
         EditText logicTextBox;
-        public void Show(Action action)
+        public async void Show(Action action)
         {
             
             #region  鏈�涓婇潰鐨勫竷灞�浠g爜
@@ -497,7 +497,8 @@
                                 var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; });
                                 if (deviceinof == null)
                                 {
-                                    continue;
+                                    deviceinof = new ZigBee.Device.CommonDevice();
+                                    //continue;
                                 }
                                 ///鏄剧ず璁惧鍚嶇О
                                 var btndevice = new Button
@@ -1195,9 +1196,11 @@
                                 var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); });
                                 if (deviceinof == null)
                                 {
-                                    continue;
+                                    
+                                    deviceinof = new ZigBee.Device.CommonDevice();
+                                    // continue;
                                 }
-
+                               
                                 ///璁惧鍚嶇ОButton
                                 var btndevicename = new Button
                                 {
@@ -1503,11 +1506,25 @@
                             break;
                         case 2:
                             {
-
+                                //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙;
                                 var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); });
+                                //鏈湴娌℃湁瀛樺湪;
                                 if (sceneinof == null)
                                 {
-                                    continue;
+                                    //鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙;
+                                    sceneinof =await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString()));
+                                    //缃戝叧娌℃湁瀛樺湪;
+                                    if (sceneinof == null)
+                                    {
+
+                                        //娉ㄨВ:鏈湴鍜岀綉鍏抽兘涓嶅瓨鍦ㄨ鍦烘櫙,鐣岄潰灏嗕笉浼氭樉绀鸿鍦烘櫙;
+                                        //sceneinof = new SceneUI();
+                                        //绉婚櫎璇ュ満鏅暟鎹�;
+                                        Common.Logic.CurrentLogic.Actions.Remove(actions);
+                                        //绉婚櫎璇ュ満鏅鍥�;
+                                        devicesFrameLayout.RemoveFromParent();
+                                        continue;
+                                    }
                                 }
 
                                 actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png";
@@ -1539,7 +1556,6 @@
                                 Common.Room room = new Common.Room();
                                 btnregionname.Text = room.GetRoomNameBySceneId(sceneinof.Id);
                                 //Send.RoomNmae(btnregionname, deviceinof);
-
 
 
                             }
@@ -1752,6 +1768,7 @@
                             if (e1)
                             {
                                 Common.Logic.CurrentLogic.Actions.Remove(actions);
+                                // devicesFrameLayout.RemoveFromParent();
                                 var logicCommunalPage = new LogicCommunalPage();
                                 UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                                 UserView.HomePage.Instance.PageIndex += 1;
@@ -1888,23 +1905,11 @@
                 Gravity = Gravity.CenterVertical,
             };
             pushswitchRowlayout.AddChidren(btnswitch);
-            btnswitch.MouseUpEventHandler += (sender1, e1) =>
-            {
-                btnswitch.IsSelected = !btnswitch.IsSelected;
-                if (btnswitch.IsSelected)
-                {
-
-                }
-                else
-                {
-
-                }
-            };
 
 
             var custompushFrameLayout = new FrameLayout
             {
-                Height = Application.GetRealHeight(160),
+                Height = Application.GetRealHeight(0),
                 BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
             };
             middle.AddChidren(custompushFrameLayout);
@@ -1952,7 +1957,18 @@
             btncustompush.MouseUpEventHandler += customclick;
             custompushback.MouseUpEventHandler += customclick;
             custompushRowLayout.MouseUpEventHandler += customclick;
-
+            btnswitch.MouseUpEventHandler += (sender1, e1) =>
+            {
+                btnswitch.IsSelected = !btnswitch.IsSelected;
+                if (btnswitch.IsSelected)
+                {
+                    custompushFrameLayout.Height = Application.GetRealHeight(160);
+                }
+                else
+                {
+                    custompushFrameLayout.Height = Application.GetRealHeight(0);
+                }
+            };
             #endregion
 
 
@@ -2015,11 +2031,13 @@
                 }
                 CommonPage.Loading.Hide();
 
-                if (!succeed) {
+                if (!succeed)//succeed鏍囪鏄坊鍔犳垚鍔熻繕鏄け璐�
+                {
                     //缃戝叧鍥炲澶辫触锛屼笉鍏抽棴鐣岄潰锛岃瀹冨仠鐣欏綋鍓嶇晫闈紱
                     //锛堝師鍥狅細鑰冭檻鍒板け璐ラ噸鏂扮紪杈戝師鏉ユ暟鎹粰鐢ㄦ埛甯︽潵浜嗛夯鐑︼級
                     ///鎻愮ず锛氭坊鍔犺嚜鍔ㄥ寲澶辫触锛�
-                    return;
+                    //TipView("娣诲姞鑷姩鍖栧け璐�");
+                    //return;
                 }
                 UserView.HomePage.Instance.RemoveViewByTag("Logic");
                 Category.Category.instance?.RefreshBodyView();
@@ -2520,5 +2538,46 @@
             };
 
         }
+        /// <summary>
+        /// 闂幇寮忔彁绀烘鐨勬柟娉�
+        /// </summary>
+        /// <param name="tipText">鎻愮ず鍐呭</param>
+        /// <param name="second">鍋滅暀鏃堕棿鍗曚綅涓簊</param>
+        public void TipView(string tipText, int second = 1)
+        {
+
+            var frameLayout = new FrameLayout { BackgroundColor = 0x50000000 };
+            this.AddChidren(frameLayout);
+
+            var btn = new Button
+            {
+                Gravity = Gravity.Center,
+                Text = tipText,
+                BackgroundColor = 0xff1f1f1f,
+                Width = Application.GetRealWidth(500),
+                Height = Application.GetRealHeight(100),
+                Radius = (uint)Application.GetRealHeight(50),
+            };
+            frameLayout.AddChidren(btn);
+
+            var dateTime1 = DateTime.Now;
+            new System.Threading.Thread(() =>
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    while (true)
+                    {
+                        if ((DateTime.Now - dateTime1).TotalMilliseconds > second * 1000)
+                        {
+                            //榛樿涓�绉掑叧闂�
+                            frameLayout.RemoveFromParent();
+                            break;
+                        }
+                    }
+                });
+            })
+            { IsBackground = true }.Start();
+
+        }
     }
 }

--
Gitblit v1.8.0