| | |
| | | using static ZigBee.Device.Panel; |
| | | namespace Shared.Phone.UserCenter.Device.Bind |
| | | { |
| | | /// <summary> |
| | | /// 特殊面板的绑定界面【只能绑定特定类型,每种类型只有一个目标】 |
| | | /// </summary> |
| | | public class PaneTargetsBaseForm : BindCommonLayout |
| | | { |
| | | #region 构造函数 |
| | |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="deviceBindType">1:新风;2:温度传感器;3:湿度传感器;4:PM2.5传感器;5:空调目标</param> |
| | | /// <param name="deviceBindType">1:新风;2:温度传感器;3:湿度传感器;4:PM2.5传感器;5:空调目标,6:地暖目标【暂时没做,因为没有该设备,后期增加】</param> |
| | | /// <param name="bindDev">绑定目标 </param> |
| | | public PaneTargetsBaseForm(CommonDevice device, CommonDevice bindDev, DeviceBind.BindInfo.BindType deviceBindType) |
| | | { |
| | |
| | | /// 3:湿度传感器 |
| | | /// 4:PM2.5传感器 |
| | | /// 5:空调目标 |
| | | /// 6:地暖目标【暂时没做,因为没有该设备,后期增加】 |
| | | /// </summary> |
| | | DeviceBind.BindInfo.BindType curDeviceBindType = 0; |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public Action<string> actionAcTarget = null; |
| | | /// <summary> |
| | | /// Fh绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionFhTarget = null; |
| | | /// <summary> |
| | | /// 是否能刷新 |
| | | /// </summary> |
| | | private bool canFresh = false; |
| | |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.AC: |
| | | titleText = Language.StringByID(R.MyInternationalizationString.AcTargets); |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.Fh: |
| | | titleText = Language.StringByID(R.MyInternationalizationString.uFloorHeatingTarget); |
| | | break; |
| | | } |
| | | this.TopFrameLayout(this, titleText); |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | bottomTipPicFrameLayout.AddChidren(btnTipText); |
| | | bottomTipPicFrameLayout.Width = btnTipPicFrameLayout.Width + Application.GetMinReal(2) + btnTipText.GetTextWidth(); |
| | | bottomTipPicFrameLayout.Width = btnTipPicFrameLayout.Width + Application.GetMinReal(12) + btnTipText.GetTextWidth(); |
| | | bottomTipPicFrameLayout.Gravity = Gravity.CenterHorizontal; |
| | | |
| | | EventHandler<MouseEventArgs> eHandlerEmptyTargets = (sender, e) => |
| | |
| | | |
| | | btnFinifh = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(907),
|
| | | Height = Application.GetRealHeight(127),
|
| | | Width = Application.GetRealWidth(907), |
| | | Height = Application.GetRealHeight(127), |
| | | Y = Application.GetRealHeight(49 + 35), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetRealHeight(127) / 2, |
| | |
| | | } |
| | | } |
| | | |
| | | if (index == roomTempList.Count - 1 && index > 3) |
| | | if (index == roomTempList.Count - 1 && index > 2) |
| | | { |
| | | var btnRoomFrameLayoutEmpty = new FrameLayout |
| | | { |
| | |
| | | X = devicePic.Right + Application.GetRealWidth(20), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 15, |
| | | Text = Common.LocalDevice.Current.GetDeviceEpointName(device), |
| | | Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device), |
| | | }; |
| | | rowLayout.AddChidren(btnBindName); |
| | | |
| | |
| | | { |
| | | line2.Visible = false; |
| | | } |
| | | if (Common.LocalDevice.Current.CheckDeviceIsOnline(device) == true)
|
| | | {
|
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.TextBlack;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
|
| | | if (HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(device) == true) |
| | | { |
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.TextBlack; |
| | | } |
| | | else |
| | | { |
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; |
| | | } |
| | | switch (curDeviceBindType) |
| | | { |
| | |
| | | devicePic.UnSelectedImagePath = "Device/SensorTemperature.png"; |
| | | if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | btnBindName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.Humidity: |
| | | devicePic.UnSelectedImagePath = "Device/SensorHumidity.png"; |
| | | if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | btnBindName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.PM: |
| | |
| | | var mainKey = bindDev.BindMacAddr + bindDev.BindEpoint; |
| | | |
| | | //分配的目标列表 |
| | | if (Shared.Common.LocalDevice.Current.listAllDevice.Count != 0) |
| | | if (HdlDeviceCommonLogic.Current.listAllDevice.Count != 0) |
| | | { |
| | | var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); |
| | | if (dev != null) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | if (device != null) |
| | | { |
| | | BindTypeTargetsList(device, bindDev); |
| | |
| | | var dev = undistruibuteDevList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); |
| | | if (dev != null) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | if (device != null) |
| | | { |
| | | BindTypeTargetsList(device, bindDev); |
| | |
| | | foreach (var dev in targetList) |
| | | { |
| | | //获取本地设备列表 |
| | | var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; |
| | | var localDeviceList = HdlDeviceCommonLogic.Current.listAllDevice; |
| | | var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == dev.DeviceAddr && obj.DeviceEpoint == dev.DeviceEpoint); |
| | | if (tempDev != null) |
| | | { |
| | |
| | | { |
| | | curControlDev.currentSelectRoomId = tempDevRoom.Id; |
| | | curControlDev.currentSelectFloorId = tempDevRoom.FloorId; |
| | | }
|
| | | else
|
| | | {
|
| | | curControlDev.currentSelectRoomId = "UndistributedId";
|
| | | } |
| | | else |
| | | { |
| | | curControlDev.currentSelectRoomId = "UndistributedId"; |
| | | } |
| | | } |
| | | |
| | | if (canUpdateBindName) |
| | | { |
| | | //更新外面目标名字:具体名字【刷新本地界面会导致外部目标变化】 |
| | | string bindName = Common.LocalDevice.Current.GetDeviceEpointName(dev); |
| | | string bindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dev); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.Temperature: |
| | |
| | | addBindInfo.BindType = 0; |
| | | addBindInfo.BindMacAddr = de.DeviceAddr; |
| | | addBindInfo.BindEpoint = de.DeviceEpoint; |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de); |
| | | addBindeDev.BindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(de); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.Temperature: |
| | | if (de.Type == DeviceType.PMSensor) |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | addBindeDev.BindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | break; |
| | | case BindInfo.BindType.Humidity: |
| | | if (de.Type == DeviceType.PMSensor) |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | addBindeDev.BindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | break; |
| | | } |
| | |
| | | { |
| | | case BindInfo.BindType.FreshAir: |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | //新风面板的新风设备,则不显示 |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | if (deviceEnumInfo.ConcreteType != DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | { |
| | | if (device.Type == DeviceType.FreshAir) |
| | | { |
| | |
| | | return; |
| | | } |
| | | //获取本地设备列表 |
| | | var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; |
| | | var localDeviceList = HdlDeviceCommonLogic.Current.listAllDevice; |
| | | var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == bindDev.DeviceAddr && obj.DeviceEpoint == bindDev.DeviceEpoint); |
| | | if (tempDev != null) |
| | | { |