| | |
| | | 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:地暖目标,7:Co2目标</param> |
| | | /// <param name="bindDev">绑定目标 </param> |
| | | public PaneTargetsBaseForm(CommonDevice device, CommonDevice bindDev, DeviceBind.BindInfo.BindType deviceBindType) |
| | | { |
| | |
| | | /// 3:湿度传感器 |
| | | /// 4:PM2.5传感器 |
| | | /// 5:空调目标 |
| | | /// 6:地暖目标 |
| | | /// 7:Co2目标 |
| | | /// </summary> |
| | | DeviceBind.BindInfo.BindType curDeviceBindType = 0; |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public Action<string> actionPMTarget = null; |
| | | /// <summary> |
| | | /// Co2绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionCo2Target = null; |
| | | /// <summary> |
| | | /// Ac绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionAcTarget = null; |
| | | /// <summary> |
| | | /// Fh绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionFhTarget = null; |
| | | /// <summary> |
| | | /// 是否能刷新 |
| | | /// </summary> |
| | |
| | | case DeviceBind.BindInfo.BindType.AC: |
| | | titleText = Language.StringByID(R.MyInternationalizationString.AcTargets); |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.Fh: |
| | | titleText = Language.StringByID(R.MyInternationalizationString.uFloorHeatingTarget); |
| | | break; |
| | | //case DeviceBind.BindInfo.BindType.CO2: |
| | | //titleText = Language.StringByID(R.MyInternationalizationString.CO2Source); |
| | | //break; |
| | | } |
| | | this.TopFrameLayout(this, titleText); |
| | | EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => |
| | |
| | | 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 |
| | | { |
| | |
| | | { |
| | | 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 (Common.LocalDevice.Current.CheckDeviceIsOnline(device) == true) |
| | | { |
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.TextBlack; |
| | | } |
| | | else |
| | | { |
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; |
| | | } |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device }); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case DeviceBind.BindInfo.BindType.FreshAir: |
| | |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.Humidity: |
| | | devicePic.UnSelectedImagePath = "Device/SensorHumidity.png"; |
| | |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.PM: |
| | | devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png"; |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.CO2: |
| | | devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png"; |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.AC: |
| | |
| | | canFresh = false; |
| | | midVerticalScrolViewLayout.EndHeaderRefreshing(); |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5007" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | |
| | | this.midFrameLayout.RemoveAll(); |
| | | |
| | |
| | | { |
| | | curControlDev.currentSelectRoomId = tempDevRoom.Id; |
| | | curControlDev.currentSelectFloorId = tempDevRoom.FloorId; |
| | | }
|
| | | else
|
| | | {
|
| | | curControlDev.currentSelectRoomId = "UndistributedId";
|
| | | } |
| | | else |
| | | { |
| | | curControlDev.currentSelectRoomId = "UndistributedId"; |
| | | //目标在未分配时,默认第一个楼层 |
| | | curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | if (dev.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { dev }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | } |
| | | break; |
| | | case BindInfo.BindType.Humidity: |
| | | if (dev.Type == DeviceType.PMSensor) |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | if (dev.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { dev }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | if (btnTipPic.IsSelected) |
| | | { |
| | | //删除情况1:绑定空目标必须取消按键中已经存在的目标 |
| | | //当绑定空目标,要删除已经存在按键的目标 |
| | | if (oldTargetList.Count != 0) |
| | | { |
| | | //删除按键中已经绑定的目标个数【删除成功个数】 |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_1" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | ShowReLoadView(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_3" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_2" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_4" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | ShowReLoadView(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_6" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_5" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_7" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | |
| | | case BindInfo.BindType.AC: |
| | | addBindInfo.BindCluster = 513; |
| | | break; |
| | | case BindInfo.BindType.CO2: |
| | | addBindInfo.BindCluster = 1037; |
| | | break; |
| | | } |
| | | addBindInfo.BindType = 0; |
| | | addBindInfo.BindMacAddr = de.DeviceAddr; |
| | | addBindInfo.BindEpoint = de.DeviceEpoint; |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de); |
| | | |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { de }); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.Temperature: |
| | |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.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); |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5001" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | |
| | | ShowReLoadView(); |
| | | ReLoadAction += () => |
| | |
| | | new Tip() |
| | | { |
| | | MaxWidth = 150, |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindFailed), |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5001_1" + ")", |
| | | Direction = AMPopTipDirection.None, |
| | | CloseTime = 1 |
| | | }.Show(CommonPage.Instance); |
| | |
| | | new Tip() |
| | | { |
| | | MaxWidth = 150, |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError), |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError) + "(" + "5001_2" + ")", |
| | | Direction = AMPopTipDirection.None, |
| | | CloseTime = 1 |
| | | }.Show(CommonPage.Instance); |
| | |
| | | /// <param name="bindDev"></param> |
| | | void BindTypeTargetsList(CommonDevice device, BindListResponseObj bindDev) |
| | | { |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.FreshAir: |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | |
| | | //新风面板的新风设备,则不显示 |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | { |
| | |
| | | var bDev = device as TemperatureSensor; |
| | | if (bDev.SensorDiv == 1) |
| | | { |
| | | oldTargetList.Add(device); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1026) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.PMSensor) |
| | |
| | | if (bDev.SensorDiv == 2) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1029) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.FreshAirHumiditySensor) |
| | |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | else if (device.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1066) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case BindInfo.BindType.AC: |
| | | if (device.Type == DeviceType.Thermostat) |
| | |
| | | } |
| | | } |
| | | break; |
| | | case BindInfo.BindType.CO2: |
| | | if (device.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1037) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | targetList.Clear(); |