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/Device/Curtain/RollerShadeControl.cs | 78 +++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs b/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs index 8ce3b44..ff4d23b 100755 --- a/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs @@ -13,7 +13,7 @@ /// <summary> /// The action. /// </summary> - public Action<DeviceUI,Common.Room> action; + public Action<CommonDevice, Common.Room> action; /// <summary> /// 鏀惰棌鎸夐挳 @@ -22,7 +22,7 @@ /// <summary> /// 浼犺繃鏉ョ殑璁惧 /// </summary> - private DeviceUI device; + private CommonDevice device; /// <summary> /// 浼犺繃鏉ョ殑鎴块棿 /// </summary> @@ -125,12 +125,12 @@ { var deviceUI = this.device; //璁惧涓虹┖ - if (deviceUI.CommonDevice == null) + if (deviceUI == null) { return; } //鏄惁涓哄綋鍓嶈澶� - if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) + if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr) { return; } @@ -139,10 +139,10 @@ if (common.DeviceStatusReport.AttriBute[0].AttributeId == 8) { //绐楀笜鐧惧垎姣� - var rollerShade = deviceUI.CommonDevice as Rollershade; + var rollerShade = deviceUI as Rollershade; rollerShade.DeviceStatusReport = common.DeviceStatusReport; rollerShade.WcdCurrentPositionLiftPercentage = common.DeviceStatusReport.AttriBute[0].AttriButeData; - StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} { deviceUI.GetDeviceStatu()}"; + StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI)}"; if(rollerShade.WcdType==0) { curtainRollSeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage; @@ -156,7 +156,7 @@ else if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0) { ////绐楀笜绫诲瀷 - var rollerShade = device.CommonDevice as Rollershade; + var rollerShade = device as Rollershade; rollerShade.DeviceStatusReport = common.DeviceStatusReport; rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData; rollerShade.LastDateTime = DateTime.Now; @@ -265,10 +265,10 @@ /// </summary> /// <param name="dev">Device.</param> /// <param name="room">Room.</param> - public void Show(DeviceUI dev, Shared.Common.Room room) + public void Show(CommonDevice dev, Shared.Common.Room room) { device = dev; - zbGateway = this.device.CommonDevice.Gateway; + zbGateway = this.device.Gateway; this.room = room; AddTop(); @@ -276,7 +276,7 @@ AddBodyView(device); - var rollerShade = device.CommonDevice as ZigBee.Device.Rollershade; + var rollerShade = device as ZigBee.Device.Rollershade; //涓嶄笂闈炶繙绋� if (rollerShade.Gateway == null) { @@ -286,7 +286,7 @@ { UserHomeView.ReadStatus(rollerShade, () => { - ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); + ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device); }); } else @@ -294,11 +294,11 @@ //闃叉鐭椂闂村唴澶氭璇诲彇 if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); + ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device); } } - if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) + if (UserCenter.HdlRoomLogic.Current.IsCollectInRoom(device) == false) { collectionBtn.IsSelected = false; } @@ -346,7 +346,7 @@ /// <summary> /// AddBodyView /// </summary> - public void AddBodyView(DeviceUI device) + public void AddBodyView(CommonDevice device) { bodyFrameLayout = new FrameLayout() { @@ -384,7 +384,7 @@ Width = Application.GetRealWidth(500), Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, - Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice), + Text = Common.LocalDevice.Current.GetDeviceEpointName(device), TextColor = ZigbeeColor.Current.GXCTextBlackColor, TextSize = 15, IsBold=true @@ -398,7 +398,7 @@ Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, TextColor = ZigbeeColor.Current.GXCTextGrayColor, - Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}", + Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}", TextSize = 10 }; itemView.AddChidren(StatuBtn); @@ -414,7 +414,7 @@ itemView.AddChidren(OpenOrUpBtn); OpenOrUpBtn.MouseUpEventHandler += (sender, e) => { - (device.CommonDevice as Rollershade).CurtainUpDownStopControl(0); + (device as Rollershade).CurtainUpDownStopControl(0); }; StopBtn = new Button @@ -429,7 +429,7 @@ itemView.AddChidren(StopBtn); StopBtn.MouseUpEventHandler += (sender, e) => { - (device.CommonDevice as Rollershade).CurtainUpDownStopControl(2); + (device as Rollershade).CurtainUpDownStopControl(2); }; CloseOrDownBtn = new Button @@ -442,19 +442,19 @@ itemView.AddChidren(CloseOrDownBtn); CloseOrDownBtn.MouseUpEventHandler += (sender, e) => { - (device.CommonDevice as Rollershade).CurtainUpDownStopControl(1); + (device as Rollershade).CurtainUpDownStopControl(1); }; - if ((device.CommonDevice as Rollershade).WcdType == -1) + if ((device as Rollershade).WcdType == -1) { CommonPage.Loading.Start(); new System.Threading.Thread(() => { - Rollershade.ReadWcdTypeAction(device.CommonDevice, () => + Rollershade.ReadWcdTypeAction(device, () => { Application.RunOnMainThread(() => { - SetRollerShadeIcon((device.CommonDevice as Rollershade).WcdType); + SetRollerShadeIcon((device as Rollershade).WcdType); CommonPage.Loading.Hide(); }); }); @@ -462,7 +462,7 @@ { IsBackground = true }.Start(); } - SetCurtainType(itemView, (device.CommonDevice as Rollershade).WcdType); + SetCurtainType(itemView, (device as Rollershade).WcdType); var roomBG = new Button { @@ -533,9 +533,9 @@ { sendedControlCommand = false; zbGateway.ReportAction += UpdateDeviceControllStatu; - (device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(0); + (device as ZigBee.Device.Rollershade).CurtainUpDownStopControl(0); //鎺у埗寤舵椂鍥炶皟 - DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + UserCenter.HdlDeviceOtherLogic.Current.SendCommandDelayAction(device, () => { if (Parent == null) { @@ -544,7 +544,7 @@ RemoveUpdateControlDeviceStatuAction(); if (sendedControlCommand == false) { - DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); + UserCenter.HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL); } }); } @@ -558,9 +558,9 @@ { sendedControlCommand = false; zbGateway.ReportAction += UpdateDeviceControllStatu; - (device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(1); + (device as ZigBee.Device.Rollershade).CurtainUpDownStopControl(1); //鎺у埗寤舵椂鍥炶皟 - DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + UserCenter.HdlDeviceOtherLogic.Current.SendCommandDelayAction(device, () => { if (Parent == null) { @@ -569,7 +569,7 @@ RemoveUpdateControlDeviceStatuAction(); if (sendedControlCommand == false) { - DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); + UserCenter.HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL); } }); } @@ -583,9 +583,9 @@ { sendedControlCommand = false; zbGateway.ReportAction += UpdateDeviceControllStatu; - (device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(2); + (device as ZigBee.Device.Rollershade).CurtainUpDownStopControl(2); //鎺у埗寤舵椂鍥炶皟 - DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + UserCenter.HdlDeviceOtherLogic.Current.SendCommandDelayAction(device, () => { if (Parent == null) { @@ -594,7 +594,7 @@ RemoveUpdateControlDeviceStatuAction(); if (sendedControlCommand == false) { - DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); + UserCenter.HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL); } }); } @@ -615,7 +615,7 @@ return; } var tempDevice = (CommonDevice)objValue; - if (tempDevice.DeviceEpoint != this.device.CommonDevice.DeviceEpoint || tempDevice.DeviceAddr != this.device.CommonDevice.DeviceAddr) + if (tempDevice.DeviceEpoint != this.device.DeviceEpoint || tempDevice.DeviceAddr != this.device.DeviceAddr) { //涓嶆槸褰撳墠璁惧鐨勬帹閫侊紝鍒欎笉澶勭悊 return; @@ -708,13 +708,13 @@ curtainRollSeekBar.Width = Application.GetRealWidth(438); curtainRollSeekBar.Height = Application.GetRealHeight(576); curtainRollSeekBar.Gravity = Gravity.CenterHorizontal; - curtainRollSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage; + curtainRollSeekBar.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage; layout.AddChidren(curtainRollSeekBar); curtainRollSeekBar.IsProgressTextShow = false; curtainRollSeekBar.CurtainPaddingTop = Application.GetRealHeight(110); curtainRollSeekBar.OnStopTrackingTouchEvent += (sender, e) => { - (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); + (device as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); }; curtainRollSeekBar.OnStartTrackingTouchEvent += (sender, e) => @@ -748,12 +748,12 @@ curtainSeekBar.Height = Application.GetRealHeight(513); curtainSeekBar.Gravity = Gravity.CenterHorizontal; curtainSeekBar.IsProgressTextShow = false; - curtainSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage; + curtainSeekBar.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage; layout.AddChidren(curtainSeekBar); curtainSeekBar.OnStopTrackingTouchEvent += (sender, e) => { - (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainSeekBar.Progress); + (device as Rollershade).WcdGoToTiltValue(curtainSeekBar.Progress); }; curtainSeekBar.OnStartTrackingTouchEvent += (sender, e) => @@ -855,12 +855,12 @@ { if (collectionBtn.IsSelected) { - Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName); + UserCenter.HdlRoomLogic.Current.DeleteLoveDevice(device); collectionBtn.IsSelected = false; } else { - Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName); + UserCenter.HdlRoomLogic.Current.AddLoveDevice(device); collectionBtn.IsSelected = true; } } -- Gitblit v1.8.0