| | |
| | | using Shared.Phone.Device.AC; |
| | | using Shared.Phone.UserCenter.DoorLock; |
| | | using Shared.Phone.Device.DeviceLogic; |
| | | using Shared.Phone.UserCenter; |
| | | |
| | | namespace Shared.Phone.Device.Category |
| | | { |
| | |
| | | UserView.HomePage.Instance.AddChidren(scene); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | scene.Show(); |
| | | scene.AddAction = () => |
| | | { |
| | | ShowScene(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | //删除设备 |
| | | EventHandler<MouseEventArgs> delEvent = (delSender, delE) => |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | | var alert = new CustomAlert(); |
| | | AddChidren(alert); |
| | | alert.Show(Language.StringByID(R.MyInternationalizationString.DeleteFunction)); |
| | | alert.ResultEventHandler += (e2) => |
| | | { |
| | | if (e2) |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceListScrolView.RemoveViewByTag((delSender as Button).Tag); |
| | | sameTypeList.Remove(deviceUI); |
| | | } |
| | | else |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.CommonDevice); |
| | | deviceListScrolView.RemoveViewByTag((delSender as Button).Tag); |
| | | sameTypeList.Remove(deviceUI); |
| | | } |
| | | //if (sameTypeList.Count == 0) |
| | | //{ |
| | | // RefreshBodyView(); |
| | | //} |
| | | } |
| | | }; |
| | | Height = Application.GetRealHeight(127 + 35), |
| | | LineColor = ZigbeeColor.Current.GXCClearColor, |
| | | Tag = deviceUI, |
| | | SubViewWidth=Application.GetRealWidth(184) |
| | | }; |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.action = RefreshBodyView; |
| | | }; |
| | | deviceListScrolView.AddChidren(deviceTypeRowLayout); |
| | | |
| | | if (deviceUI.CommonDevice.Type == DeviceType.OnOffOutput) |
| | | { |
| | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | 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(light.IsOnline == 1); |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.IsSelected = light.OnOffStatus == 1; |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | |
| | | } |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | Tag = deviceUI |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | 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(airSwitch.IsOnline == 1); |
| | | deviceRow.IsSelected = airSwitch.OnOffStatus == 1; |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | zbGateway = deviceUI.CommonDevice.Gateway; |
| | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | |
| | |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | Tag = deviceUI |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | 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(dimmableLight.IsOnline == 1); |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.IsSelected = dimmableLight.OnOffStatus == 1; |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | |
| | | dimmableLightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | Tag = deviceUI |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | 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); |
| | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | var acControl = new Phone.Device.AC.ACControl(); |
| | |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | acControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | } |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.WindowCoveringDevice) |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | | Height = Application.GetRealHeight(129 + 35), |
| | | LineColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | Tag = deviceUI |
| | | }; |
| | | deviceListScrolView.AddChidren(deviceTypeRowLayout); |
| | | |
| | | var deviceRow = new CategoryFunctionForWinRow(0, 35); |
| | | deviceRow.Init(deviceUI); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | //deviceRow.SetOnLineStatu(rollerShade.IsOnline == 1); |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0; |
| | | deviceRow.SetRollerShadeIcon(rollerShade.WcdType); |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI, |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | var rollerShadeControl = new Phone.Device.Curtain.RollerShadeControl(); |
| | |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | rollerShadeControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock) |
| | | { |
| | | 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); |
| | |
| | | HomePage.Instance.PageIndex += 1; |
| | | userDoorLockPage.Show(); |
| | | }; |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | Tag = deviceUI |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.IASZone) |
| | | { |
| | | 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.HideSwitchBtn(true); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | Tag = deviceUI |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.TemperatureSensor) |
| | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | 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.HideSwitchBtn(true); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | Tag = deviceUI |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | |
| | | } |
| | | } |
| | | 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); |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | | { |
| | | Tag = deviceUI |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | }; |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | |
| | | //删除设备 |
| | | EventHandler<MouseEventArgs> delEvent = (delSender, delE) => |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.DeleteFunction)); |
| | | alert.Show(); |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceListScrolView.RemoveViewByTag((delSender as Button).Tag); |
| | | sameTypeList.Remove(deviceUI); |
| | | } |
| | | else |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.CommonDevice); |
| | | deviceListScrolView.RemoveViewByTag((delSender as Button).Tag); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (Common.Room.CurrentRoom.GetLoveRoom().DeviceUIList.Find((obj) => obj.FileName == deviceUI.FileName) != null) |
| | | { |
| | | Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | } |
| | | } |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshBodyView(); |
| | | } |
| | | }; |
| | | }; |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | | if (Common.Room.CurrentRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | catch { } |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |