From 16604a593202f2f87adf71abd57d036fe7da3b52 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 18 十一月 2019 10:39:42 +0800
Subject: [PATCH] 同步了全部的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs |   94 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 73 insertions(+), 21 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
index 3754458..891421a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -6,16 +6,21 @@
 {
     public class UserDoorLockPage : DoorLockCommonLayout, ZigBee.Common.IStatus
     {
-        public UserDoorLockPage(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj)
+
+        public UserDoorLockPage(Shared.Common.Room room ,DeviceUI doorLock)
         {
-            this.doorLock = doorLock;
-            BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
+            this.doorLock = doorLock.CommonDevice as ZigBee.Device.DoorLock;
+            currentRoom = room;
+            deviceUI = doorLock;
+             BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
             ZigBee.Device.ZbGateway.StatusList.Add(this);
         }
 
         #region 鈼� 鍙橀噺鐢虫槑__________________________
         ZigBee.Device.DoorLock doorLock;
         FrameLayout bottomFrameLayout;
+        Shared.Common.Room currentRoom;
+        DeviceUI deviceUI;
         Action action;
         #endregion
 
@@ -36,27 +41,44 @@
 
             var btnShare = new Button
             {
-                X = Application.GetRealWidth(850),
+                X = Application.GetRealWidth(850 - 116),
                 Height = Application.GetRealHeight(69),
                 Width = Application.GetRealWidth(69),
-                UnSelectedImagePath = "DoorLock/ShareIcon.png",
             };
             this.titleFrameLayout.AddChidren(btnShare);
 
+            var btnFuncSetFrameLayout = new FrameLayout
+            {
+                X = Application.GetRealWidth(850 - 116),
+                Height = Application.GetRealHeight(69),
+                Width = Application.GetRealWidth(69 * 2 + 58),
+            };
+            this.titleFrameLayout.AddChidren(btnFuncSetFrameLayout);
+
             var btnFuncSet = new Button
             {
-                X = Application.GetRealWidth(953),
+                X = Application.GetRealWidth(103),
                 Height = Application.GetRealHeight(69),
                 Width = Application.GetRealWidth(69),
                 UnSelectedImagePath = "DoorLock/SettingIcon.png",
             };
-            this.titleFrameLayout.AddChidren(btnFuncSet);
+            btnFuncSetFrameLayout.AddChidren(btnFuncSet);
             btnFuncSet.MouseDownEventHandler += (sender, e) =>
             {
-                var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
-                Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
-                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                userDoorLockPage.Show();
+                if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+                {
+                    var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
+                    Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
+                    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                    userDoorLockPage.Show();
+                }
+                else
+                {
+                    var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock);
+                    Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
+                    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                    userDoorLockPage.Show();
+                }
             };
 
             btnShare.MouseDownEventHandler += (sender, e) =>
@@ -108,11 +130,9 @@
             midTopFrameLayout.AddChidren(btnRecord);
             btnRecord.MouseDownEventHandler += (sender, e) =>
             {
-                var doorLock = new ZigBee.Device.DoorLock();
-                var doorLockRecord = new Shared.Phone.UserCenter.DoorLock.HistoryRecordPage(doorLock);
-                Shared.Phone.UserView.HomePage.Instance.AddChidren(doorLockRecord);
-                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                doorLockRecord.Show();
+                //鍘嗗彶璁板綍 ----   stan
+                var form = new DeviceDoorLock.DoorLockHistoryLogForm();
+                form.AddForm(this.doorLock.DeviceAddr);
             };
 
             var btnCollect = new Button()
@@ -121,11 +141,21 @@
                 Height = Application.GetRealHeight(69),
                 X = Application.GetRealWidth(850),
                 Y = Application.GetRealHeight(46),
-                UnSelectedImagePath = "DoorLock/FavoriteIcon.png",
+                UnSelectedImagePath = "Item/Collection.png",
+                SelectedImagePath = "Item/CollectionSelected.png"
             };
             midTopFrameLayout.AddChidren(btnCollect);
             btnCollect.MouseDownEventHandler += (sender, e) =>
             {
+                btnCollect.IsSelected = !btnCollect.IsSelected;
+                if (btnCollect.IsSelected)
+                {
+                    Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName); //鍙栨秷鏀惰棌
+                }
+                else
+                {
+                    Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(deviceUI.FileName);//鏀惰棌
+                }
             };
 
             var btnCurrentText = new Button()
@@ -167,7 +197,7 @@
 
             var btnFrameLayout = new FrameLayout()
             {
-                Width = Application.GetRealWidth(420 - 46),//639-35
+                Width = Application.GetRealWidth(420 - 46),
                 Height = Application.GetRealHeight(446),
                 X = btnDoorLockPic.Right,
                 Y = Application.GetRealHeight(354),
@@ -258,7 +288,7 @@
                 Height = Application.GetRealHeight(49),
                 X = Application.GetRealWidth(150),
                 Y = Application.GetRealHeight(46),
-                Text = "瀹㈠巺",
+                Text = currentRoom.Name,
                 TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                 TextSize = 12,
                 TextAlignment = TextAlignment.CenterLeft,
@@ -268,13 +298,35 @@
 
             EventHandler<MouseEventArgs> hander1 = async (sender, e) =>
              {
-                 RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus);
+                 if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                 {
+                     var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                     if (result == false)
+                     {
+                         var result1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                         if (result1 == true)
+                         {
+                             RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus);
+                         }
+                         else
+                         {
+                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                         }
+                     }
+                     else
+                     {
+                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                     }
+                 }
+                 else
+                 {
+                     RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus);
+                 }
              };
             openFrameLayout.MouseUpEventHandler += hander1;
             btnDoorOpenPic.MouseUpEventHandler += hander1;
             EventHandler<MouseEventArgs> hander2 = (sender, e) =>
             {
-                //new Tip() { MaxWidth = 150, Text = "涓嶆敮鎸佽繙绋嬪叧閿�", Direction = AMPopTipDirection.Down, CloseTime = 2 }.Show(openFrameLayout);
                 btnDoorLockPic.IsSelected = false;
                 progressButton.Y = Application.GetRealHeight(347);
             };

--
Gitblit v1.8.0