| | |
| | | }; |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | var lightControl = new Phone.Device.Light.OnOffControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | var lightControl = new Phone.Device.Light.OnOffControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | } |
| | | else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | var lightControl = new Phone.Device.Light.PlugControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | } |
| | | else |
| | | { |
| | | var lightControl = new Phone.Device.Light.LightControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | var lightControl = new Phone.Device.Light.AirSwitchControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | UserView.HomePage.Instance.AddChidren(dimmableLightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //dimmableLightControl.action = RefreshBodyView; |
| | | dimmableLightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | dimmableLightControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | var deviceRow = new CategoryFunctionRow(0, 35); |
| | | deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | //deviceRow.SetOnLineStatu(ac.IsOnline == 1); |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.IsSelected = ac.currentSystemMode != 1; |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | |
| | | UserView.HomePage.Instance.AddChidren(acControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | acControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | acControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | UserView.HomePage.Instance.AddChidren(rollerShadeControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | rollerShadeControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | rollerShadeControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock) |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | 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); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | } |
| | | } |
| | | |
| | | |
| | | //删除设备 |
| | | EventHandler<MouseEventArgs> delEvent = (delSender, delE) => |
| | |
| | | sameTypeList.Remove(deviceUI); |
| | | if (Common.Room.CurrentRoom.GetLoveRoom().DeviceUIList.Find((obj) => obj.FileName == deviceUI.FileName) != null) |
| | | { |
| | | Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName); |
| | | } |
| | | } |
| | | if (sameTypeList.Count == 0) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ReFreshDeviceAction |
| | | /// </summary> |
| | | /// <param name="curRoom"></param> |
| | | /// <param name="sameTypeList"></param> |
| | | /// <param name="devListScrolView"></param> |
| | | /// <param name="deviceRow"></param> |
| | | private void ReFreshDeviceAction(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionRow deviceRow) |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false) |
| | | { |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ReFreshDeviceAction |
| | | /// </summary> |
| | | /// <param name="curRoom"></param> |
| | | /// <param name="sameTypeList"></param> |
| | | /// <param name="devListScrolView"></param> |
| | | /// <param name="deviceRow"></param> |
| | | private void ReFreshDeviceActionForWin(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionForWinRow deviceRow) |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false) |
| | | { |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// AddRoomView |
| | | /// </summary> |
| | | private void AddRoomView() |