From aa3d6459c82a97f8f6f504d8a678814fc1089ab5 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 15 十一月 2019 14:20:50 +0800
Subject: [PATCH] 2019.11.15

---
 ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs   |    8 ++
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs                |   72 ++++++++++++++++++++++-
 ZigbeeApp/Shared/Phone/Device/CommonForm/BackButton.cs         |    4 
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs |    8 --
 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml                         |   26 ++++++--
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs |   17 +++--
 ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs    |    1 
 ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide                   |    0 
 ZigbeeApp/Shared/Common/DeviceUI.cs                            |    5 +
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs             |   39 ++++++++++++
 10 files changed, 151 insertions(+), 29 deletions(-)

diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index ac7fa08..b308326 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -2,16 +2,19 @@
   <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.M7BBB18B19152766" />
   <MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.7C08EC3F-1819-4947-B71C-82F809A90074" />
   <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/CommonForm/TopFrameLayout.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Category/Category.cs">
     <Files>
-      <File FileName="Shared/Phone/Device/Category/Category.cs" Line="1562" Column="12" />
-      <File FileName="Shared/Phone/UserView/UserHomeView.cs" />
+      <File FileName="Shared/Phone/Device/Category/Category.cs" Line="1034" Column="60" />
+      <File FileName="Shared/Phone/UserView/UserHomeView.cs" Line="1673" Column="25" />
       <File FileName="Shared/Phone/Device/Room/EditRoom.cs" />
       <File FileName="Shared/Phone/Device/Account/AccountLogin.cs" Line="509" Column="33" />
       <File FileName="Shared/Phone/UserCenter/UserMain/QRCodeForm.cs" />
-      <File FileName="Shared/Phone/Device/AC/ACControl.cs" Line="114" Column="27" />
       <File FileName="GateWay.Droid/Application.cs" Line="106" Column="28" />
-      <File FileName="Shared/Phone/Device/CommonForm/TopFrameLayout.cs" Line="82" Column="33" />
+      <File FileName="Shared/Phone/Device/CommonForm/FunctionMainView.cs" Line="228" Column="36" />
+      <File FileName="Shared/Phone/Device/CommonForm/TopFrameLayout.cs" Line="82" Column="35" />
+      <File FileName="Shared/Common/DeviceUI.cs" Line="1" Column="1" />
+      <File FileName="Shared/Phone/Device/Light/DimmableLightControl.cs" Line="1" Column="1" />
+      <File FileName="Shared/Phone/Device/CommonForm/CategoryFunctionRow.cs" Line="1" Column="1" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -20,12 +23,21 @@
             <Node name="DroidLib" expanded="True" />
             <Node name="GateWay.Droid" expanded="True" />
             <Node name="Shared" expanded="True">
+              <Node name="Common" expanded="True" />
               <Node name="Phone" expanded="True">
                 <Node name="Device" expanded="True">
-                  <Node name="CommonForm" expanded="True">
-                    <Node name="TopFrameLayout.cs" selected="True" />
+                  <Node name="AC" expanded="True" />
+                  <Node name="Account" expanded="True" />
+                  <Node name="Category" expanded="True">
+                    <Node name="Category.cs" selected="True" />
                   </Node>
+                  <Node name="CommonForm" expanded="True" />
+                  <Node name="Light" expanded="True" />
                 </Node>
+                <Node name="UserCenter" expanded="True">
+                  <Node name="DoorLock" expanded="True" />
+                </Node>
+                <Node name="UserView" expanded="True" />
               </Node>
             </Node>
           </Node>
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index eb96f9f..8607cb7 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs
index ce748b1..5b31c90 100644
--- a/ZigbeeApp/Shared/Common/DeviceUI.cs
+++ b/ZigbeeApp/Shared/Common/DeviceUI.cs
@@ -304,6 +304,11 @@
                     //涓户鍣�
                     deviceTypeR = R.MyInternationalizationString.Repeater;
                     break;
+                case DeviceType.DoorLock:
+                    //闂ㄩ攣
+                    deviceTypeR = R.MyInternationalizationString.DoorLock;
+                    break;
+
                 default:
                     deviceTypeR = R.MyInternationalizationString.UnknowDevice;
                     break;
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 1b9b764..7fefc25 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -6,6 +6,7 @@
 using ZigBee.Device;
 using Shared.Phone.Device.CommonForm;
 using Shared.Phone.Device.AC;
+using Shared.Phone.UserCenter.DoorLock;
 
 namespace Shared.Phone.Device.Category
 {
@@ -1341,7 +1342,6 @@
                                 }
                             }
 
-
                             var deviceTypeRowLayout = new RowLayout()
                             {
                                 Height = Application.GetRealHeight(129 + 35),
@@ -1404,7 +1404,44 @@
                         }
                         else
                         {
+                            var deviceTypeRowLayout = new RowLayout()
+                            {
+                                Height = Application.GetRealHeight(129 + 35),
+                                LineColor = ZigbeeColor.Current.GXCBackgroundColor,
+                                Tag = deviceUI
+                            };
+                            deviceListScrolView.AddChidren(deviceTypeRowLayout);
 
+                            var deviceRow = new CategoryFunctionRow(0, 35);
+                            deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                            deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                            deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
+                            deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
+                            deviceRow.HideSwitchBtn(true);
+                            deviceTypeRowLayout.AddChidren(deviceRow);
+
+
+                            deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
+                            {
+                                var userDoorLockPage = new UserDoorLockPage(room, deviceUI);
+                                HomePage.Instance.AddChidren(userDoorLockPage);
+                                HomePage.Instance.PageIndex += 1;
+                                userDoorLockPage.Show();
+                            };
+
+                            var editBtn = new CommonForm.RowLayoutEditButton()
+                            {
+                                Tag = deviceUI
+                            };
+                            deviceTypeRowLayout.AddRightView(editBtn);
+                            editBtn.MouseUpEventHandler += deviceDetailHandler;
+
+                            var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
+                            {
+                                Tag = deviceUI
+                            };
+                            deviceTypeRowLayout.AddRightView(delBtn);
+                            delBtn.MouseUpEventHandler += delEvent;
                         }
                     }
                 };
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/BackButton.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/BackButton.cs
index 5b67e19..45aebf9 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/BackButton.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/BackButton.cs
@@ -13,8 +13,8 @@
         public BackButton()
         {
             X = Application.GetRealWidth(58);
-            Height = Application.GetMinRealAverage(58);
-            Width = Application.GetMinRealAverage(58);
+            Height = Application.GetMinRealAverage(110);
+            Width = Application.GetMinRealAverage(110);
             UnSelectedImagePath = "Account/Back.png";
             SelectedImagePath = "Account/BackSelected.png";
             Gravity = Gravity.CenterVertical;
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs
index 8d6e9e6..ce78534 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs
@@ -219,5 +219,13 @@
         {
             CollectButton.IsSelected = collect;
         }
+        /// <summary>
+        /// CanControl
+        /// </summary>
+        /// <param name="cmd"></param>
+        public void CanControl(bool cmd)
+        {
+            SwitchButton.Visible = cmd;
+        }
     }
 }
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
index c3be1ed..5d57d60 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
@@ -204,6 +204,7 @@
         /// </summary>
         public DimmableLightControl()
         {
+            UserView.HomePage.Instance.ScrollEnabled = false;
             BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
             ZbGateway.StatusList.Add(this);
         }
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs
old mode 100755
new mode 100644
index 29ec891..ac3e430
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs
@@ -47,13 +47,7 @@
             this.btnBack.MouseUpEventHandler += eHandlerBack;
             this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
             this.MidFrameLayout(this);
-            this.titleFrameLayout.MouseUpEventHandler += (sender, e) =>
-            {
-                var userDoorLockPage = new UserDoorLockPage(doorLock, curAccountObj);
-                Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
-                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                userDoorLockPage.Show();
-            };
+            
             bodyView = new VerticalScrolViewLayout()
             {
             };
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
old mode 100755
new mode 100644
index 4044118..92b6910
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -6,11 +6,13 @@
 {
     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;
-            //currentRoom = room;Shared.Common.Room room, 
-            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);
         }
 
@@ -18,6 +20,7 @@
         ZigBee.Device.DoorLock doorLock;
         FrameLayout bottomFrameLayout;
         Shared.Common.Room currentRoom;
+        DeviceUI deviceUI;
         Action action;
         #endregion
 
@@ -141,11 +144,11 @@
                 btnCollect.IsSelected = !btnCollect.IsSelected;
                 if (btnCollect.IsSelected)
                 {
-                    // Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(doorLock.FileName); //鍙栨秷鏀惰棌
+                    Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName); //鍙栨秷鏀惰棌
                 }
                 else
                 {
-                    //Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(doorLock.FileName);//鏀惰棌
+                    Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(deviceUI.FileName);//鏀惰棌
                 }
             };
 
@@ -279,7 +282,7 @@
                 Height = Application.GetRealHeight(49),
                 X = Application.GetRealWidth(150),
                 Y = Application.GetRealHeight(46),
-                // Text = currentRoom.Name,
+                Text = currentRoom.Name,
                 TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                 TextSize = 12,
                 TextAlignment = TextAlignment.CenterLeft,
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 21003fa..3ee1dd4 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -4,6 +4,7 @@
 using Shared.Phone.Device.AC;
 using ZigBee.Device;
 using Shared.Phone.Device.CommonForm;
+using Shared.Phone.UserCenter.DoorLock;
 
 namespace Shared.Phone.UserView
 {
@@ -1008,7 +1009,6 @@
                         deviceVerticalScrolViewLayout.AddChidren(itemView);
                     }
 
-
                     //鍒犻櫎璁惧
                     EventHandler<MouseEventArgs> delEvent = (sender, e) =>
                     {
@@ -1614,14 +1614,65 @@
                             var dimmableLightControl = new Phone.Device.Light.DimmableLightControl();
                             UserView.HomePage.Instance.AddChidren(dimmableLightControl);
                             UserView.HomePage.Instance.PageIndex += 1;
-                            UserView.HomePage.Instance.ScrollEnabled = false;
                             //dimmableLightControl.action = RefreshBodyView;
                             dimmableLightControl.Show(device, Room.CurrentRoom);
                         };
 
                         lightView.CollectButton.MouseUpEventHandler += collectionEvent;
                     }
-                    else if (device.CommonDevice.Type == DeviceType.OnOffSwitch)
+                    else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.DoorLock)
+                    {
+                        //闂ㄩ攣
+                        var dimmableLight = device.CommonDevice as DoorLock;
+                        //琛ヤ笂闈炶繙绋�
+                        if (dimmableLight.Gateway == null)
+                        {
+                            continue;
+                        }
+                        if (dimmableLight.Gateway.IsVirtual)
+                        {
+                            ReadStatus(dimmableLight, () =>
+                            {
+                                dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
+                            });
+                        }
+                        else
+                        {
+                            if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
+                            {
+                                dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
+                            }
+                        }
+
+                        var lightView = new FunctionMainView(xx, yy);
+                        itemView.AddChidren(lightView);
+                        lightView.Init();
+                        lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
+                        lightView.SetStatuText(device.GetDeviceStatu());
+                        lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                        lightView.IsSelected = dimmableLight.IsOnline == 1;
+                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                        lightView.CanControl(false);
+                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
+                        if (dev == null)
+                        {
+                            lightView.CollectButton.IsSelected = false;
+                        }
+                        else
+                        {
+                            lightView.CollectButton.IsSelected = true;
+                        }
+
+                        lightView.CardBG.MouseUpEventHandler += (sender, e) =>
+                        {
+                            var userDoorLockPage = new UserDoorLockPage(Room.CurrentRoom,device);
+                            HomePage.Instance.AddChidren(userDoorLockPage);
+                            HomePage.Instance.PageIndex += 1;
+                            userDoorLockPage.Show();
+                        };
+                        lightView.CollectButton.MouseUpEventHandler += collectionEvent;
+                    }
+                    else
                     {
                         var lightView = new FunctionMainView(xx, yy);
                         itemView.AddChidren(lightView);
@@ -1629,9 +1680,20 @@
                         lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                         lightView.SetStatuText(device.GetDeviceStatu());
                         lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
-                        //lightView.SetStatu(true);
-                        lightView.IsSelected = true;
+                        lightView.CanControl(false);
+                        lightView.IsSelected = device.CommonDevice.IsOnline == 1;
                         lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+
+                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
+                        if (dev == null)
+                        {
+                            lightView.CollectButton.IsSelected = false;
+                        }
+                        else
+                        {
+                            lightView.CollectButton.IsSelected = true;
+                        }
+                        lightView.CollectButton.MouseUpEventHandler += collectionEvent;
                     }
                 }
             }

--
Gitblit v1.8.0