From a5b3c4bae726ef6770d4bfcbf2f4b50a37ed4a15 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 06 三月 2020 15:31:36 +0800 Subject: [PATCH] 删除了郭雪城的 DeviceUi 这个类 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs | 156 +++++++++++++++++++++++++++++---------------------- 1 files changed, 89 insertions(+), 67 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs index 3031802..dd33da8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs @@ -6,22 +6,44 @@ { public class UserDoorLockPage : DoorLockCommonLayout, ZigBee.Common.IStatus { - - public UserDoorLockPage(Shared.Common.Room room, DeviceUI doorLock) + /// <summary> + /// 鏋勯�犲嚱鏁� + /// </summary> + /// <param name="room"></param> + /// <param name="doorLock"></param> + public UserDoorLockPage(Shared.Common.Room room, CommonDevice doorLock) { - this.doorLock = doorLock.CommonDevice as ZigBee.Device.DoorLock; + this.doorLock = doorLock as ZigBee.Device.DoorLock; currentRoom = room; deviceUI = doorLock; BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; ZigBee.Device.ZbGateway.StatusList.Add(this); } - #region 鈼� 鍙橀噺鐢虫槑__________________________ + #region 鍙橀噺鐢虫槑 + /// <summary> + /// 褰撳墠闂ㄩ攣 + /// </summary> ZigBee.Device.DoorLock doorLock; + /// <summary> + /// 搴曢儴甯冨眬 + /// </summary> FrameLayout bottomFrameLayout; + /// <summary> + /// 褰撳墠鎴块棿 + /// </summary> Shared.Common.Room currentRoom; - DeviceUI deviceUI; + /// <summary> + /// 璁惧UI瀵硅薄 + /// </summary> + CommonDevice deviceUI; + /// <summary> + /// 璁剧疆浜屾楠岃瘉Action + /// </summary> Action action; + /// <summary> + /// 涓儴甯冨眬涓棬閿佸悕绉版樉绀� + /// </summary> Button btnDoorLockTitle; #endregion @@ -30,8 +52,7 @@ /// </summary> public void Show() { - this.TopFrameLayout(this, ""); - + this.TopFrameLayout(this, ""); EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => { RemoveFromParent(); @@ -44,7 +65,7 @@ { X = Application.GetRealWidth(850 - 116), Height = Application.GetRealHeight(69), - Width = Application.GetRealWidth(69), + Width = Application.GetRealWidth(0), }; this.titleFrameLayout.AddChidren(btnShare); @@ -64,49 +85,31 @@ UnSelectedImagePath = "DoorLock/SettingIcon.png", }; btnFuncSetFrameLayout.AddChidren(btnFuncSet); - btnFuncSet.MouseDownEventHandler += (sender, e) => + EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) => { - if (UserCenterResourse.UserInfo.AuthorityNo == 1) + var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock); + Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + functionSetting.Show(); + functionSetting.devicNameAction += (deviceRename) => { - var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock); - Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - functionSetting.Show(); - functionSetting.devicNameAction += (deviceRename) => + if (!string.IsNullOrEmpty(deviceRename)) { - if (!string.IsNullOrEmpty(deviceRename)) - { - btnDoorLockTitle.Text = deviceRename; - //鏀规埧闂� - Shared.Common.Room.CurrentRoom.ChangedRoom(deviceUI.CommonDevice, currentRoom.Id); - deviceUI.CommonDevice.ReSave(); - } - }; - } - else - { - var functionSettingSub = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock); - Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSettingSub); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - functionSettingSub.Show(); - functionSettingSub.devicNameAction += (deviceRename) => - { - if (!string.IsNullOrEmpty(deviceRename)) - { - btnDoorLockTitle.Text = deviceRename; - } - }; - } + btnDoorLockTitle.Text = deviceRename; + //鏀规埧闂� + HdlRoomLogic.Current.ChangedRoom(deviceUI, currentRoom.Id); + deviceUI.ReSave(); + } + }; }; - - btnShare.MouseDownEventHandler += (sender, e) => - { - - }; - + btnFuncSetFrameLayout.MouseDownEventHandler += btnFuncSetHander; + btnFuncSet.MouseDownEventHandler += btnFuncSetHander; + MidFrameLayoutContent(); } - + /// <summary> + /// 涓儴甯冨眬 + /// </summary> public void MidFrameLayoutContent() { #region UI @@ -127,43 +130,59 @@ Height = Application.GetRealHeight(60), X = Application.GetRealWidth(372), Y = Application.GetRealHeight(46), - TextColor = Shared.Common.ZigbeeColor.Current.XMBlack , + TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, TextSize = 15, TextAlignment = TextAlignment.Center, - IsBold =true, + IsBold = true, }; midTopFrameLayout.AddChidren(btnDoorLockTitle); //鑾峰彇Mac鍚嶅瓧 btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock); + var btnRecordFrameLayout = new FrameLayout() + { + Width = Application.GetRealWidth(69+15+46), + Height = Application.GetRealHeight(69+46 * 2), + X = Application.GetRealWidth(752-46), + }; + midTopFrameLayout.AddChidren(btnRecordFrameLayout); + var btnRecord = new Button() { Width = Application.GetRealWidth(69), Height = Application.GetRealHeight(69), - X = Application.GetRealWidth(752), + X = Application.GetRealWidth(46), Y = Application.GetRealHeight(46), UnSelectedImagePath = "DoorLock/RecordIcon.png", }; - midTopFrameLayout.AddChidren(btnRecord); - btnRecord.MouseDownEventHandler += (sender, e) => + btnRecordFrameLayout.AddChidren(btnRecord); + EventHandler<MouseEventArgs> handerRecord = (sender, e) => { //鍘嗗彶璁板綍 ---- stan var form = new DeviceDoorLock.DoorLockHistoryLogForm(); form.AddForm(this.doorLock.DeviceAddr); }; + btnRecordFrameLayout.MouseDownEventHandler += handerRecord; + btnRecord.MouseDownEventHandler += handerRecord; + var btnCollectFrameLayout = new FrameLayout() + { + Width = Application.GetRealWidth(69+15+46), + Height = Application.GetRealHeight(69+46*2), + X = Application.GetRealWidth(850-15), + }; + midTopFrameLayout.AddChidren(btnCollectFrameLayout); var btnCollect = new Button() { Width = Application.GetRealWidth(69), Height = Application.GetRealHeight(69), - X = Application.GetRealWidth(850), + X = Application.GetRealWidth(15), Y = Application.GetRealHeight(46), UnSelectedImagePath = "Item/Collection.png", SelectedImagePath = "Item/CollectionSelected.png" }; - midTopFrameLayout.AddChidren(btnCollect); - var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == deviceUI.FileName); - if (de == null) + btnCollectFrameLayout.AddChidren(btnCollect); + if (HdlRoomLogic.Current.IsCollectInRoom(deviceUI) == false) { btnCollect.IsSelected = false; } @@ -171,19 +190,20 @@ { btnCollect.IsSelected = true; } - btnCollect.MouseDownEventHandler += (sender, e) => + EventHandler < MouseEventArgs > handerCollect = (sender, e) => { btnCollect.IsSelected = !btnCollect.IsSelected; if (btnCollect.IsSelected) { - Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(deviceUI.FileName);//鏀惰棌 + HdlRoomLogic.Current.AddLoveDevice(deviceUI);//鏀惰棌 } else { - Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName); //鍙栨秷鏀惰棌 + HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);//鍙栨秷鏀惰棌 } }; - + btnCollectFrameLayout.MouseDownEventHandler += handerCollect; + btnCollect.MouseDownEventHandler += handerCollect; var btnCurrentText = new Button() { Width = Application.GetRealWidth(100), @@ -332,6 +352,7 @@ btnCurrentFrameLayout.AddChidren(btnCurrentRoomName); #endregion + #region 鏁版嵁澶勭悊 EventHandler<MouseEventArgs> hander1 = async (sender, e) => { openFrameLayout.Enable = false; @@ -351,8 +372,8 @@ { btnDoorLockTitle.Text = deviceRename; //鏀规埧闂� - Shared.Common.Room.CurrentRoom.ChangedRoom(deviceUI.CommonDevice, currentRoom.Id); - deviceUI.CommonDevice.ReSave(); + HdlRoomLogic.Current.ChangedRoom(deviceUI, currentRoom.Id); + deviceUI.ReSave(); } }; openFrameLayout.Enable = true; @@ -360,14 +381,14 @@ } else { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance); + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess)); openFrameLayout.Enable = true; btnDoorOpenPic.Enable = true; } } else { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance); + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed)); openFrameLayout.Enable = true; btnDoorOpenPic.Enable = true; } @@ -379,10 +400,10 @@ { if (!string.IsNullOrEmpty(deviceRename)) { - btnDoorLockTitle.Text = deviceRename; - //鏀规埧闂� - Shared.Common.Room.CurrentRoom.ChangedRoom(deviceUI.CommonDevice, currentRoom.Id); - deviceUI.CommonDevice.ReSave(); + btnDoorLockTitle.Text = deviceRename; + //鏀规埧闂� + HdlRoomLogic.Current.ChangedRoom(deviceUI, currentRoom.Id); + deviceUI.ReSave(); } }; openFrameLayout.Enable = true; @@ -398,9 +419,10 @@ }; closeFrameLayout.MouseUpEventHandler += hander2; btnDoorClosePic.MouseUpEventHandler += hander2; + #endregion } - #region 鈼� 鎺ュ彛瀹炵幇__________________________ + #region 鎺ュ彛瀹炵幇 /// <summary> /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange() /// </summary> -- Gitblit v1.8.0