| | |
| | | /// </summary> |
| | | public int OldIconPathType; |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | public EditRoom() |
| | |
| | | |
| | | public override void RemoveFromParent()
|
| | | {
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
|
| | |
|
| | | CommonPage.Instance.IsDrawerLockMode = false;
|
| | | base.RemoveFromParent();
|
| | |
| | | Height = Application.GetMinRealAverage(444), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), |
| | | ImagePath = room.BackgroundImageType==0? room.BackgroundImage: System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage) |
| | | ImagePath = room.BackgroundImageType == 0 ? room.BackgroundImage : System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage) |
| | | }; |
| | | bodyFrameLayout.AddChidren(backGround); |
| | | backGround.SetViewShadow(true); |
| | | if (room.BackgroundImageType != 0) |
| | | { |
| | | backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(backGround.ImagePath); |
| | | } |
| | | backGround.MouseUpEventHandler += backGroundIMGHander; |
| | | |
| | | var infoFL = new FrameLayout |
| | |
| | | nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.RoomName)} :"); |
| | | nameRow.SetTitle(room.Name); |
| | | infoFL.AddChidren(nameRow); |
| | | if(room.IsLove) |
| | | { |
| | | nameRow.NameText.Enable = false; |
| | | } |
| | | |
| | | var floorRow = new DeviceInfoRow(308); |
| | | floorRow.Init(); |
| | | floorRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongFloor)} :"); |
| | | infoFL.AddChidren(floorRow); |
| | | if (!room.IsLove) |
| | | if (Config.Instance.Home.FloorDics.Count > 0 && room.IsLove == false) |
| | | { |
| | | floorRow.SetTitle(room.FloorName); |
| | | floorRow.ClickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (Config.Instance.Home.FloorDics != null) |
| | | { |
| | | List<string> floorIds = new List<string> { }; |
| | | List<string> floorNames = new List<string> { }; |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | } |
| | | |
| | | PickerView.Show(floorNames, (index) => |
| | | { |
| | | room.FloorId = floorIds[index]; |
| | | floorRow.SetTitle(room.FloorName); |
| | | }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | }; |
| | | infoFL.AddChidren(floorRow); |
| | | } |
| | | |
| | | floorRow.SetTitle(room.FloorName); |
| | | floorRow.ClickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (Config.Instance.Home.FloorDics != null) |
| | | { |
| | | List<string> floorIds = new List<string> { }; |
| | | List<string> floorNames = new List<string> { }; |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | } |
| | | |
| | | PickerView.Show(floorNames, (index) => |
| | | { |
| | | room.FloorId = floorIds[index]; |
| | | floorRow.SetTitle(room.FloorName); |
| | | }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | }; |
| | | |
| | | |
| | | var temperatureRow = new DeviceInfoRow(446); |
| | | temperatureRow.Init(); |
| | | temperatureRow.SetTipTitle(R.MyInternationalizationString.Temperature); |
| | |
| | | return; |
| | | } |
| | | room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}"; |
| | | temperatureRow.SetTitle(R.MyInternationalizationString.Getting); |
| | | |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) => |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A设备属性上报, (Action<ZigBee.Device.CommonDevice>)((report) => |
| | | { |
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report); |
| | | if (room.TemperatrueDevice != mainKeys) |
| | |
| | | return; |
| | | } |
| | | //移除掉事件 |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | |
| | | foreach (var data in report.DeviceStatusReport.AttriBute) |
| | | { |
| | |
| | | { |
| | | //0℃ |
| | | temperatureRow.NameText.Text = "0.0℃"; |
| | | room.Temperatrue = 0; |
| | | } |
| | | else if (data.AttriButeData > 32767) |
| | | { |
| | |
| | | //小数点需要一位 |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "℃"; |
| | | room.Temperatrue = int.Parse(strValue) * 0.1; |
| | | } |
| | | else |
| | | { |
| | |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "℃"; |
| | | room.Temperatrue = int.Parse(strValue) *0.1; |
| | | } |
| | | } |
| | | } |
| | |
| | | (selectTemp as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity(); |
| | | }; |
| | | }; |
| | | |
| | | if (string.IsNullOrEmpty(room.TemperatrueDevice) == false) |
| | | { |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) => |
| | | temperatureRow.SetTitle(R.MyInternationalizationString.Getting); |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A设备属性上报, (Action<ZigBee.Device.CommonDevice>)((report) => |
| | | { |
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report); |
| | | if (room.TemperatrueDevice != mainKeys) |
| | |
| | | return; |
| | | } |
| | | //移除掉事件 |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice"); |
| | | |
| | | foreach (var data in report.DeviceStatusReport.AttriBute) |
| | | { |
| | |
| | | { |
| | | //0℃ |
| | | temperatureRow.NameText.Text = "0.0℃"; |
| | | room.Temperatrue = 0; |
| | | } |
| | | else if (data.AttriButeData > 32767) |
| | | { |
| | |
| | | //小数点需要一位 |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "℃"; |
| | | room.Temperatrue = int.Parse(strValue) * 0.1; |
| | | } |
| | | else |
| | | { |
| | |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "℃"; |
| | | room.Temperatrue = int.Parse(strValue) * 0.1; |
| | | } |
| | | } |
| | | } |
| | |
| | | (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | temperatureRow.SetTitle(R.MyInternationalizationString.No); |
| | | } |
| | | |
| | | |
| | | var humidityRow = new DeviceInfoRow(585); |
| | | humidityRow.Init(); |
| | |
| | | return; |
| | | } |
| | | room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}"; |
| | | humidityRow.SetTitle(R.MyInternationalizationString.Getting); |
| | | |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice"); |
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) => |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice"); |
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice", ReceiveComandDiv.A设备属性上报, (report) => |
| | | { |
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report); |
| | | if (room.HumidityDevice != mainKeys) |
| | |
| | | return; |
| | | } |
| | | //移除掉事件 |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice"); |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice"); |
| | | foreach (var data in report.DeviceStatusReport.AttriBute) |
| | | { |
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue) |
| | |
| | | { |
| | | //0 |
| | | humidityRow.NameText.Text = "0.0%"; |
| | | room.Humidity = 0; |
| | | } |
| | | else |
| | | { |
| | |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | humidityRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "%"; |
| | | room.Humidity = int.Parse(strValue) * 0.1; |
| | | } |
| | | } |
| | | } |
| | |
| | | }; |
| | | if (string.IsNullOrEmpty(room.HumidityDevice) == false) |
| | | { |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice"); |
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) => |
| | | humidityRow.SetTitle(R.MyInternationalizationString.Getting); |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice"); |
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice", ReceiveComandDiv.A设备属性上报, (report) => |
| | | { |
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report); |
| | | if (room.HumidityDevice != mainKeys) |
| | |
| | | return; |
| | | } |
| | | //移除掉事件 |
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice"); |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice"); |
| | | foreach (var data in report.DeviceStatusReport.AttriBute) |
| | | { |
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue) |
| | |
| | | { |
| | | //0 |
| | | humidityRow.NameText.Text = "0.0%"; |
| | | room.Humidity = 0; |
| | | } |
| | | else |
| | | { |
| | |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | humidityRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "%"; |
| | | room.Humidity = int.Parse(strValue) * 0.1; |
| | | } |
| | | } |
| | | } |
| | |
| | | (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | humidityRow.SetTitle(R.MyInternationalizationString.No); |
| | | } |
| | | |
| | | if (Config.Instance.Home.FloorDics.Count == 0 || room.IsLove) |
| | | { |
| | | temperatureRow.Y = Application.GetRealHeight(308); |
| | | humidityRow.Y= Application.GetRealHeight(446); |
| | | } |
| | | |
| | | var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); |
| | | var confirm = new Device.CommonForm.CompleteButton(1700, 900, 127); |
| | | confirm.SetTitle(R.MyInternationalizationString.Confrim); |
| | | AddChidren(confirm); |
| | | confirm.MouseUpEventHandler += (sender, e) => |
| | |
| | | } |
| | | if (IconPathType == 0) |
| | | { |
| | | room.BackgroundImage = backGround.UnSelectedImagePath; |
| | | room.BackgroundImage = backGround.ImagePath; |
| | | } |
| | | else |
| | | { |
| | |
| | | action?.Invoke(); |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Height = Application.GetRealHeight(450), |
| | | Width = Application.GetRealWidth(selectRow_Width), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetRealHeight(17), |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | itemFL.Animate = Animate.DownToUp; |
| | | //itemFL.Animate = Animate.DownToUp; |
| | | |
| | | var selectLocalPicture = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.LocalPicture, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize = 17 |
| | | }; |
| | | itemFL.AddChidren(selectLocalPicture); |
| | | var selectLocalLine = new Button() |
| | | { |
| | | Y = selectLocalPicture.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | itemFL.AddChidren(selectLocalLine); |
| | | |
| | |
| | | Y = selectLocalLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.Photograph, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize = 17 |
| | | }; |
| | | itemFL.AddChidren(selectPhotographBtn); |
| | | var selectPhotographLine = new Button() |
| | | { |
| | | Y = selectPhotographBtn.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2, |
| | | }; |
| | | itemFL.AddChidren(selectPhotographLine); |
| | | |
| | |
| | | Y = selectPhotographLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.MyAblums, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize = 17 |
| | | }; |
| | | itemFL.AddChidren(selectAblumsBtn); |
| | | |
| | |
| | | TextID = R.MyInternationalizationString.Cancel, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | | Radius = (uint)Application.GetRealHeight(17) |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | TextSize = 17 |
| | | }; |
| | | selectFL.AddChidren(cancelBtn); |
| | | |
| | |
| | | { |
| | | IconPathType = 0; |
| | | backGround.ImageBytes = null; |
| | | backGround.UnSelectedImagePath = imgPath; |
| | | backGround.ImagePath = imgPath; |
| | | }; |
| | | }; |
| | | selectPhotographBtn.MouseUpEventHandler += (send, ee) => |
| | |
| | | { |
| | | if (IconPathType != 0) |
| | | { |
| | | Global.DeleteFilebyHomeId(backGround.UnSelectedImagePath); |
| | | Global.DeleteFilebyHomeId(backGround.ImagePath); |
| | | } |
| | | |
| | | IconPathType = 1; |
| | | backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath); |
| | | backGround.UnSelectedImagePath = imagePath; |
| | | backGround.ImagePath = imagePath; |
| | | System.IO.File.Delete(imagePath); |
| | | |
| | | }, fileName, 2, 1); |
| | |
| | | { |
| | | if (IconPathType != 0) |
| | | { |
| | | Global.DeleteFilebyHomeId(backGround.UnSelectedImagePath); |
| | | Global.DeleteFilebyHomeId(backGround.ImagePath); |
| | | } |
| | | |
| | | IconPathType = 2; |
| | | backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath); |
| | | backGround.UnSelectedImagePath = imagePath; |
| | | backGround.ImagePath = imagePath; |
| | | System.IO.File.Delete(imagePath); |
| | | |
| | | }, fileName, 2, 1); |