| | |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | EditAction = null; |
| | | base.RemoveFromParent(); |
| | | } |
| | | #endregion |
| | |
| | | |
| | | AddTop(); |
| | | |
| | | AddBodyView(device); |
| | | AddBodyView(device,room); |
| | | |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// AddBodyView |
| | | /// </summary> |
| | | public void AddBodyView(DeviceUI device) |
| | | public void AddBodyView(DeviceUI device, Common.Room room) |
| | | { |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | |
| | | }; |
| | | bodyFrameLayout.AddChidren(infoFL); |
| | | var rectCornerID = HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight; |
| | | infoFL.SetCornerWithSameRadius(Application.GetRealHeight(50), rectCornerID); |
| | | infoFL.SetCornerWithSameRadius(Application.GetRealHeight(58), rectCornerID); |
| | | |
| | | var tipBtn = new Button |
| | | { |
| | |
| | | }; |
| | | infoFL.AddChidren(tipBtn); |
| | | |
| | | var nameRow = new DeviceInfoEditRow(170); |
| | | var infoScrolView = new VerticalScrolViewLayout |
| | | { |
| | | Y = Application.GetRealHeight(170-12), |
| | | Height = Application.GetRealHeight(600), |
| | | ScrollEnabled = false, |
| | | VerticalScrollBarEnabled = false |
| | | }; |
| | | infoFL.AddChidren(infoScrolView); |
| | | |
| | | var nameFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | infoScrolView.AddChidren(nameFL); |
| | | var nameRow = new DeviceInfoEditRow(12); |
| | | nameRow.Init(); |
| | | nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : "); |
| | | nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceEpointName); |
| | | infoFL.AddChidren(nameRow); |
| | | nameFL.AddChidren(nameRow); |
| | | |
| | | var zoneRow = new DeviceInfoRow(308); |
| | | |
| | | var zoneFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | if (room != null && room.IsLove == false) |
| | | { |
| | | infoScrolView.AddChidren(zoneFL); |
| | | } |
| | | var zoneRow = new DeviceInfoRow(12); |
| | | zoneRow.Init(); |
| | | zoneRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongZone)} : "); |
| | | zoneRow.SetTitle(roomName); |
| | | infoFL.AddChidren(zoneRow); |
| | | zoneFL.AddChidren(zoneRow); |
| | | |
| | | var modelRow = new DeviceInfoRow(446); |
| | | var modelFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | infoScrolView.AddChidren(modelFL); |
| | | 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.HideNext(true); |
| | | infoFL.AddChidren(modelRow); |
| | | modelFL.AddChidren(modelRow); |
| | | |
| | | if (device.CommonDevice.Type==ZigBee.Device.DeviceType.OnOffOutput) |
| | | if (device.CommonDevice.Type==DeviceType.OnOffOutput || device.CommonDevice.Type==DeviceType.AirSwitch) |
| | | { |
| | | functionTypeRow = new DeviceInfoRow(585); |
| | | var typeFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | infoScrolView.AddChidren(typeFL); |
| | | functionTypeRow = new DeviceInfoRow(12); |
| | | functionTypeRow.Init(); |
| | | functionTypeRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionType)} : "); |
| | | //functionTypeRow.SetTitle(device.CommonDevice.DfunctionType); |
| | | infoFL.AddChidren(functionTypeRow); |
| | | typeFL.AddChidren(functionTypeRow); |
| | | var dfunctionType = device.CommonDevice.DfunctionType; |
| | | |
| | | //功能类型的翻译名字 |
| | |
| | | } |
| | | }; |
| | | }; |
| | | |
| | | //sharedRow = new DeviceInfoRow(723); |
| | | //sharedRow.Init(); |
| | | //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : "); |
| | | //sharedRow.SetTitle("2人"); |
| | | //infoFL.AddChidren(sharedRow); |
| | | } |
| | | else |
| | | { |
| | | //sharedRow = new DeviceInfoRow(585); |
| | | //sharedRow.Init(); |
| | | //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : "); |
| | | //sharedRow.SetTitle("2人"); |
| | | //infoFL.AddChidren(sharedRow); |
| | | } |
| | | |
| | | var confirmBtn = new CommonForm.CompleteButton(962, 907, 127); |
| | | confirmBtn.SetTitle(R.MyInternationalizationString.Confrim); |
| | | |
| | | var confirmBtn = new CommonForm.CompleteButton(962, 900, 127); |
| | | confirmBtn.SetTitle(R.MyInternationalizationString.Save); |
| | | infoFL.AddChidren(confirmBtn); |
| | | |
| | | #region event |
| | | EventHandler<MouseEventArgs> selectZoneEvent = (sender, e) => |
| | | { |
| | | List<string> floorIds = new List<string> { }; |
| | | List<string> floorNames = new List<string> { }; |
| | | List<List<string>> roomNames = new List<List<string>> { }; |
| | | List<List<Common.Room>> rooms = new List<List<Common.Room>> { }; |
| | | List<Common.Room> rs = new List<Common.Room> { }; |
| | | List<string> rNames = new List<string> { }; |
| | | if (Config.Instance.Home.FloorDics.Count>0) |
| | | var zone = new SelectZone(); |
| | | zone.Init(); |
| | | zone.ZoneAction += (selectRoom) => |
| | | { |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0) |
| | | { |
| | | roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key)); |
| | | rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key)); |
| | | } |
| | | } |
| | | PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) => |
| | | { |
| | | curRoom = rooms[index1][index2]; |
| | | zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(floorIds[index1])} , {rooms[index1][index2].Name}"); |
| | | }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongZone), |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | else |
| | | { |
| | | for(int i=0;i<Common.Room.Lists.Count;i++) |
| | | { |
| | | var r = Common.Room.Lists[i]; |
| | | if (r.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | rs.Add(r); |
| | | rNames.Add(r.Name); |
| | | } |
| | | PickerView.Show(rNames, (index1) => |
| | | { |
| | | curRoom = rs[index1]; |
| | | zoneRow.SetTitle(rs[index1].Name); |
| | | }, 0,Language.StringByID(R.MyInternationalizationString.BelongZone), |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | curRoom = selectRoom; |
| | | zoneRow.SetTitle(selectRoom.GetZoneName()); |
| | | }; |
| | | }; |
| | | zoneRow.ClickBtn.MouseUpEventHandler += selectZoneEvent; |
| | | |
| | |
| | | CommonPage.Loading.Start(); |
| | | if (device.CommonDevice == null) |
| | | { |
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain); |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); |
| | | return; |
| | | } |
| | | if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput) |
| | | if (device.CommonDevice.Type == DeviceType.OnOffOutput || device.CommonDevice.Type == DeviceType.AirSwitch) |
| | | { |
| | | if (device.IsCustomizeImage == false) |
| | | { |