| | |
| | | /// <summary> |
| | | /// action |
| | | /// </summary> |
| | | public Action<DeviceUI,Common.Room> EditAction; |
| | | public Action<CommonDevice, Common.Room> EditAction; |
| | | /// <summary> |
| | | /// curRoom |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="room"></param> |
| | | public void Show(DeviceUI device, Common.Room room) |
| | | public void Show(CommonDevice device, Common.Room room) |
| | | { |
| | | Init(device); |
| | | |
| | |
| | | /// <summary> |
| | | /// AddBodyView |
| | | /// </summary> |
| | | public void AddBodyView(DeviceUI device, Common.Room room) |
| | | public void AddBodyView(CommonDevice device, Common.Room room) |
| | | { |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | |
| | | }; |
| | | bodyFrameLayout.AddChidren(deviceIMG); |
| | | |
| | | var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice); |
| | | var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device); |
| | | |
| | | var deviceTypeName = new Button() |
| | | { |
| | |
| | | var nameRow = new DeviceInfoEditRow(12); |
| | | nameRow.Init(); |
| | | nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : "); |
| | | nameRow.SetTitle(string.IsNullOrEmpty(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)); |
| | | nameRow.SetTitle(string.IsNullOrEmpty(Common.LocalDevice.Current.GetDeviceEpointName(device)) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : Common.LocalDevice.Current.GetDeviceEpointName(device)); |
| | | nameFL.AddChidren(nameRow); |
| | | |
| | | |
| | |
| | | var modelRow = new DeviceInfoRow(12); |
| | | modelRow.Init(); |
| | | modelRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongModel)} : "); |
| | | modelRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceName); |
| | | modelRow.SetTitle(string.IsNullOrEmpty(device.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.DeviceName); |
| | | modelRow.HideNext(true); |
| | | modelFL.AddChidren(modelRow); |
| | | |
| | | if (device.CommonDevice.Type==DeviceType.OnOffOutput || device.CommonDevice.Type==DeviceType.AirSwitch) |
| | | if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.AirSwitch) |
| | | { |
| | | var typeFL = new FrameLayout |
| | | { |
| | |
| | | functionTypeRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionType)} : "); |
| | | //functionTypeRow.SetTitle(device.CommonDevice.DfunctionType); |
| | | typeFL.AddChidren(functionTypeRow); |
| | | var dfunctionType = device.CommonDevice.DfunctionType; |
| | | var dfunctionType = device.DfunctionType; |
| | | |
| | | //功能类型的翻译名字 |
| | | string strT = string.Empty; |
| | |
| | | |
| | | functionTypeRow.ClickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var DfunctionType = device.CommonDevice.DfunctionType; |
| | | var DfunctionType = device.DfunctionType; |
| | | |
| | | //功能类型的翻译名字 |
| | | int nowSelectNo = 1; |
| | |
| | | //记录起当前选择的功能类型 |
| | | if (selectNo == 0) |
| | | { |
| | | device.CommonDevice.DfunctionType = DeviceFunctionType.A开关; |
| | | device.DfunctionType = DeviceFunctionType.A开关; |
| | | } |
| | | else if (selectNo == 1) |
| | | { |
| | | device.CommonDevice.DfunctionType = DeviceFunctionType.A灯光; |
| | | device.DfunctionType = DeviceFunctionType.A灯光; |
| | | } |
| | | else |
| | | { |
| | | device.CommonDevice.DfunctionType = DeviceFunctionType.A插座; |
| | | device.DfunctionType = DeviceFunctionType.A插座; |
| | | } |
| | | }; |
| | | }; |
| | |
| | | zone.ZoneAction += (selectRoom) => |
| | | { |
| | | curRoom = selectRoom; |
| | | zoneRow.SetTitle(selectRoom.GetZoneName()); |
| | | zoneRow.SetTitle(HdlRoomLogic.Current.GetZoneName(selectRoom)); |
| | | }; |
| | | }; |
| | | zoneRow.ClickBtn.MouseUpEventHandler += selectZoneEvent; |
| | |
| | | { |
| | | deviceIMG.UnSelectedImagePath = unSelectedImagePath; |
| | | deviceIMG.SelectedImagePath = selectedImagePath; |
| | | device.CommonDevice.IsCustomizeImage = true; |
| | | device.IsCustomizeImage = true; |
| | | }; |
| | | }; |
| | | deviceIMG.MouseUpEventHandler += selectDeviceIconEvent; |
| | |
| | | try |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | if (device.CommonDevice == null) |
| | | if (device == null) |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); |
| | | return; |
| | | } |
| | | if (device.CommonDevice.Type == DeviceType.OnOffOutput || device.CommonDevice.Type == DeviceType.AirSwitch) |
| | | if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.AirSwitch) |
| | | { |
| | | if (device.IsCustomizeImage == false) |
| | | { |
| | | if (device.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | if (device.DfunctionType == DeviceFunctionType.A开关) |
| | | { |
| | | device.CommonDevice.IconPath = "Device/Switch.png"; |
| | | device.IconPath = "Device/Switch.png"; |
| | | } |
| | | else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | else if (device.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | device.CommonDevice.IconPath = "Device/Socket1.png"; |
| | | device.IconPath = "Device/Socket1.png"; |
| | | } |
| | | else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A灯光) |
| | | else if (device.DfunctionType == DeviceFunctionType.A灯光) |
| | | { |
| | | device.CommonDevice.IconPath = "Device/Light.png"; |
| | | device.IconPath = "Device/Light.png"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //改图片 |
| | | device.CommonDevice.IconPath = deviceIMG.UnSelectedImagePath; |
| | | device.IconPath = deviceIMG.UnSelectedImagePath; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //改图片 |
| | | device.CommonDevice.IconPath = deviceIMG.UnSelectedImagePath; |
| | | device.IconPath = deviceIMG.UnSelectedImagePath; |
| | | } |
| | | bool result; |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | result = await LocalDevice.Current.ReName(device.CommonDevice, nameRow.NameText.Text.Trim()); |
| | | result = await LocalDevice.Current.ReName(device, nameRow.NameText.Text.Trim()); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | if (result) |
| | | { |
| | | //改房间 |
| | | Shared.Common.Room.CurrentRoom.ChangedRoom(device.CommonDevice, curRoom.Id); |
| | | device.CommonDevice.ReSave(); |
| | | HdlRoomLogic.Current.ChangedRoom(device, curRoom.Id); |
| | | device.ReSave(); |
| | | EditAction?.Invoke(device, curRoom); |
| | | RemoveFromParent(); |
| | | } |
| | |
| | | /// Init |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | public void Init(DeviceUI device) |
| | | public void Init(CommonDevice device) |
| | | { |
| | | roomName = device.GetZone(); |
| | | befRoom = Common.Room.CurrentRoom.GetRoomByDevice(device.CommonDevice); |
| | | curRoom = Common.Room.CurrentRoom.GetRoomByDevice(device.CommonDevice); |
| | | roomName = HdlRoomLogic.Current.GetRoomNameByDevice(device, ","); |
| | | befRoom = HdlRoomLogic.Current.GetRoomByDevice(device); |
| | | curRoom = HdlRoomLogic.Current.GetRoomByDevice(device); |
| | | } |
| | | #endregion |
| | | } |