File was renamed from ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared.Common; |
| | | using Shared.Phone.UserCenter.Device.Bind; |
| | | using ZigBee.Common; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter.DevicePanel |
| | | { |
| | | /// <summary>
|
| | | /// 方悦新风面板的按键配置界面
|
| | | /// 面板的按键配置界面【该类暂时舍弃】
|
| | | /// </summary> |
| | | public class PanelFangyueFreshAirButtonSettionForm : EditorCommonForm |
| | | public class PanelSimpleEnvironmentButtonSettionForm : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________
|
| | | |
| | |
| | | /// <summary> |
| | | /// PM目标名字 |
| | | /// </summary> |
| | | private string bindPmName = string.Empty; |
| | | private string bindAcName = string.Empty; |
| | | /// <summary> |
| | | /// 被绑目标是新风 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | private CommonDevice bindHumidityDev; |
| | | /// <summary> |
| | | /// 被绑目标是PM2.5 |
| | | /// 被绑目标是空调 |
| | | /// </summary> |
| | | private CommonDevice bindPMDev; |
| | | private CommonDevice bindAcDev; |
| | | // <summary> |
| | | /// 按键中被绑定的目标列表 |
| | | /// </summary> |
| | |
| | | {
|
| | | this.deviceObj = i_device;
|
| | | //获取数据 |
| | | ReadDoorLockUserInfo(deviceObj); |
| | | InitInfo(deviceObj); |
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPanelSettion));
|
| | |
| | | //图片
|
| | | var btnPic = new PicViewControl(426, 426);
|
| | | btnPic.Y = Application.GetRealHeight(150);
|
| | | btnPic.UnSelectedImagePath = "RealDevice/ButtonPanelFangyueFreshAir.png";
|
| | | btnPic.UnSelectedImagePath = "RealDevice/ButtonPanelSimpleEnvironment.png";
|
| | | btnPic.Gravity = Gravity.CenterHorizontal;
|
| | | listBackControl.frameTable.AddChidren(btnPic);
|
| | |
|
| | |
| | | /// </summary>
|
| | | private void InitMenuRow()
|
| | | {
|
| | | this.listview.RemoveAll();
|
| | | this.listview.RemoveAll(); |
| | | //Ac来源 |
| | | this.AddAcRow();
|
| | | //添加新风目标 |
| | | this.AddFreshAirRow(); |
| | | //PM2.5来源 |
| | | this.AddPMRow(); |
| | | //添加温度来源 |
| | | this.AddTemperatureSensorRow(); |
| | | //添加湿度来源 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 初始化数据_________________________ |
| | | |
| | | #region ■ 数据处理_________________________ |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | void ReadDoorLockUserInfo(CommonDevice curControlDev) |
| | | void InitInfo(CommonDevice curControlDev) |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | 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); |
| | | }); |
| | | } |
| | | } |
| | |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取绑定目标 |
| | | /// </summary> |
| | | /// <param name="curControlDev"></param> |
| | | /// <returns></returns> |
| | | private async System.Threading.Tasks.Task<bool> GetBindName(CommonDevice curDev) |
| | | { |
| | | bool result = false; |
| | | //获取面板中存在的绑定目标 |
| | | var curControlDev = new CommonDevice(); |
| | | curControlDev.DeviceAddr = curDev.DeviceAddr; |
| | | curControlDev.CurrentGateWayId = curDev.CurrentGateWayId; |
| | | curControlDev.Type = curDev.Type; |
| | | int count = 0; |
| | | for (int i = 1; i < 3; i++) |
| | | { |
| | | curControlDev.DeviceEpoint = i; |
| | | |
| | | var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev); |
| | | if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null) |
| | | { |
| | | bindList = panelBindListRes.getAllBindResponseData.BindList; |
| | | foreach (var bDev in bindList) |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (device.Type == DeviceType.FreshAir) |
| | | { |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | //新风面板的新风设备,则不显示 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | { |
| | | continue; |
| | | } |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindFreshAirName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindFreshAirName = bDev.ESName; |
| | | } |
| | | |
| | | bindFreshAirDev = device; |
| | | } |
| | | else if (device.Type == DeviceType.TemperatureSensor) |
| | | { |
| | | var bD = device as TemperatureSensor; |
| | | if (bD.SensorDiv == 1) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindTemperatureName = bDev.ESName; |
| | | } |
| | | bindTemperatureDev = device; |
| | | } |
| | | if (bD.SensorDiv == 2) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindHumidityName = bDev.ESName; |
| | | } |
| | | |
| | | bindHumidityDev = device; |
| | | } |
| | | } |
| | | else if (device.Type == DeviceType.FreshAirHumiditySensor) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindHumidityName = bDev.ESName; |
| | | } |
| | | |
| | | bindHumidityDev = device; |
| | | } |
| | | else if (device.Type == DeviceType.Thermostat) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindAcName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindAcName = bDev.ESName; |
| | | } |
| | | |
| | | bindAcDev = device; |
| | | } |
| | | else if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | if (bDev.BindCluster == 1026) |
| | | { |
| | | bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | bindTemperatureDev = device; |
| | | } |
| | | if (bDev.BindCluster == 1029) |
| | | { |
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | bindHumidityDev = device; |
| | | } |
| | | } |
| | | } |
| | | count++; |
| | | if (count == 2) |
| | | { |
| | | result = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ Ac来源_________________________ |
| | | /// <summary> |
| | | /// Ac来源行 |
| | | /// </summary> |
| | | private void AddAcRow() |
| | | { |
| | | //Ac |
| | | var rowAc = new FrameRowControl(listview.rowSpace / 2); |
| | | listview.AddChidren(rowAc); |
| | | rowAc.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.AcTargets), 600); |
| | | //底线 |
| | | rowAc.AddBottomLine(); |
| | | //右箭头 |
| | | rowAc.AddRightArrow(); |
| | | var msg = Language.StringByID(R.MyInternationalizationString.nothing); |
| | | if (!string.IsNullOrEmpty(bindAcName)) |
| | | { |
| | | msg = bindAcName; |
| | | } |
| | | var btnAcStatu = rowAc.AddMostRightView(msg, 700); |
| | | rowAc.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.deviceObj.DeviceEpoint = 1; |
| | | var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.AC); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | paneTargetsBaseFormp.Show(); |
| | | |
| | | paneTargetsBaseFormp.actionAcTarget += (bindName) => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (string.IsNullOrEmpty(bindName)) |
| | | { |
| | | btnAcStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); |
| | | } |
| | | else |
| | | { |
| | | btnAcStatu.Text = bindName; |
| | | } |
| | | }); |
| | | }; |
| | | }; |
| | | } |
| | | #endregion |
| | |
|
| | |
| | | var btnNewWindStatu = rowNewWind.AddMostRightView(msg, 700);
|
| | | |
| | | rowNewWind.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindFreshAirDev, 1); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); |
| | | { |
| | | this.deviceObj.DeviceEpoint = 2; |
| | | var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.FreshAir); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | addDevicePage.Show(); |
| | | |
| | | addDevicePage.actionFreshAirTarget += (bindName) => |
| | | paneTargetsBaseFormp.Show(); |
| | | paneTargetsBaseFormp.actionFreshAirTarget += (bindName) => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | }); |
| | | }; |
| | | |
| | | }; |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 获取绑定目标 |
| | | /// </summary> |
| | | /// <param name="curControlDev"></param> |
| | | /// <returns></returns> |
| | | private async System.Threading.Tasks.Task<bool> GetBindName(CommonDevice curDev) |
| | | { |
| | | bool result = false; |
| | | //获取面板中存在的绑定目标 |
| | | FreshAir curControlDev = curDev as FreshAir; |
| | | var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev); |
| | | if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null) |
| | | { |
| | | bindList = panelBindListRes.getAllBindResponseData.BindList; |
| | | foreach (var bDev in bindList) |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); |
| | | |
| | | if (device.Type == DeviceType.FreshAir) |
| | | { |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | //新风面板的新风设备,则不显示 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | { |
| | | continue; |
| | | } |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindFreshAirName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindFreshAirName = bDev.ESName; |
| | | } |
| | | |
| | | bindFreshAirDev = device; |
| | | } |
| | | if (device.Type == DeviceType.TemperatureSensor) |
| | | { |
| | | var bD = device as TemperatureSensor; |
| | | if (bD.SensorDiv == 1) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindTemperatureName = bDev.ESName; |
| | | } |
| | | bindTemperatureDev = device; |
| | | } |
| | | if (bD.SensorDiv == 2) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindHumidityName = bDev.ESName; |
| | | } |
| | | |
| | | bindHumidityDev = device; |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.FreshAirHumiditySensor) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindHumidityName = bDev.ESName; |
| | | } |
| | | |
| | | bindHumidityDev = device; |
| | | } |
| | | if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | if (bDev.BindCluster == 1026) |
| | | { |
| | | bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | bindTemperatureDev = device; |
| | | } |
| | | if (bDev.BindCluster == 1029) |
| | | { |
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | bindHumidityDev = device; |
| | | } |
| | | if (bDev.BindCluster == 1066) |
| | | { |
| | | if (string.IsNullOrEmpty(bDev.ESName)) |
| | | { |
| | | bindPmName = Common.LocalDevice.Current.GetDeviceEpointName(device); |
| | | } |
| | | else |
| | | { |
| | | bindPmName = bDev.ESName; |
| | | } |
| | | |
| | | bindPMDev = device; |
| | | } |
| | | } |
| | | } |
| | | result = true; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | #region ■ PM2.5来源_________________________ |
| | | /// <summary> |
| | | /// PM2.5来源行 |
| | | /// </summary> |
| | | private void AddPMRow() |
| | | { |
| | | //PM2.5 |
| | | var rowPM = new FrameRowControl(listview.rowSpace / 2); |
| | | listview.AddChidren(rowPM); |
| | | rowPM.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.PM25Source), 600); |
| | | //底线 |
| | | rowPM.AddBottomLine(); |
| | | //右箭头 |
| | | rowPM.AddRightArrow(); |
| | | var msg = Language.StringByID(R.MyInternationalizationString.nothing); |
| | | if (!string.IsNullOrEmpty(bindPmName)) |
| | | { |
| | | msg = bindPmName; |
| | | } |
| | | var btnPMStatu = rowPM.AddMostRightView(msg, 700); |
| | | rowPM.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindPMDev, 4); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | addDevicePage.Show(); |
| | | |
| | | addDevicePage.actionPMTarget += (bindName) => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (string.IsNullOrEmpty(bindName)) |
| | | { |
| | | btnPMStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); |
| | | } |
| | | else |
| | | { |
| | | btnPMStatu.Text = bindName; |
| | | } |
| | | }); |
| | | }; |
| | | }; |
| | | } |
| | | #endregion |
| | |
| | | var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700); |
| | | rowTemPerature.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindTemperatureDev, 2); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); |
| | | this.deviceObj.DeviceEpoint = 1; |
| | | var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.Temperature); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | addDevicePage.Show(); |
| | | |
| | | addDevicePage.actionTemperatureTarget += (bindName) => |
| | | paneTargetsBaseFormp.Show(); |
| | | paneTargetsBaseFormp.actionTemperatureTarget += (bindName) => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700); |
| | | rowHumidity.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindHumidityDev, 3); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); |
| | | this.deviceObj.DeviceEpoint = 1; |
| | | var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.Humidity); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | addDevicePage.Show(); |
| | | |
| | | addDevicePage.actionHumidityTarget += (bindName) => |
| | | paneTargetsBaseFormp.Show(); |
| | | paneTargetsBaseFormp.actionHumidityTarget += (bindName) => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | //右箭头
|
| | | rowLight.AddRightArrow();
|
| | | rowLight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //给新风面板建立一个新的支持面板对象,用200端点设置
|
| | | var panel = new Panel();
|
| | | panel.DeviceAddr = this.deviceObj.DeviceAddr;
|
| | | panel.DeviceEpoint = 200; |
| | | panel.CurrentGateWayId = this.deviceObj.CurrentGateWayId; |
| | | var form = new PanelFangyueFreshAirBackLightSettionForm();
|
| | | form.AddForm(panel);
|
| | | { |
| | | var form = new PanelBrightnessAdjustForm();
|
| | | form.AddForm(this.deviceObj);
|
| | | }; |
| | | } |
| | | #endregion
|
| | |
| | |
|
| | | #endregion
|
| | | }
|
| | | } |
| | | } |