| | |
| | | using System; |
| | | using Shared.Common; |
| | | using ZigBee.Device; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using Shared.Phone.UserView; |
| | | |
| | | namespace Shared.Phone.Device.AC |
| | | { |
| | |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | ///// <summary> |
| | | ///// The top view. |
| | | ///// </summary> |
| | | private CommonForm.TopFrameLayout top; |
| | | /// <summary> |
| | | /// 更多设置 |
| | | /// </summary> |
| | | private Button moreBtn; |
| | | /// <summary> |
| | | /// 传过来的设备 |
| | | /// </summary> |
| | | private DeviceUI device; |
| | | /// <summary> |
| | | /// 传过来的ac |
| | | /// </summary> |
| | | private ZigBee.Device.AC ac; |
| | | /// <summary> |
| | | /// 传过来的房间 |
| | | /// </summary> |
| | | private Shared.Common.Room room; |
| | | /// <summary> |
| | | /// The middle fl. |
| | | /// </summary> |
| | | private FrameLayout midFL; |
| | | |
| | | /// <summary> |
| | | /// 收藏按钮 |
| | | /// </summary> |
| | | private Button collectionBtn; |
| | | /// <summary> |
| | | /// 当前室内温度 |
| | | /// 传过来的设备 |
| | | /// </summary> |
| | | private DeviceUI device; |
| | | /// <summary> |
| | | /// 传过来的房间 |
| | | /// </summary> |
| | | private Shared.Common.Room room; |
| | | |
| | | /// <summary> |
| | | /// 房间 |
| | | /// </summary> |
| | | private Button roomBtn; |
| | | /// <summary> |
| | | /// 房间名 |
| | | /// </summary> |
| | | private Button roomName; |
| | | /// <summary> |
| | | /// 网关 |
| | | /// </summary> |
| | | private ZbGateway zbGateway = null; |
| | | /// <summary> |
| | | /// 是否发送控制命令成功了 |
| | | /// </summary> |
| | | private bool sendedControlCommand = false; |
| | | |
| | | /// <summary> |
| | | /// bodyFrameLayout |
| | | /// </summary> |
| | | private FrameLayout bodyFrameLayout; |
| | | /// <summary> |
| | | /// 室温 |
| | | /// </summary> |
| | | private Button indoorTemperatureBtn; |
| | | |
| | | /// <summary> |
| | | /// OpenOrUpBtn |
| | | /// </summary> |
| | | public Button OpenOrUpBtn; |
| | | /// <summary> |
| | | /// OpenOrUpBtn |
| | | /// </summary> |
| | | public Button CloseOrDownBtn; |
| | | /// <summary> |
| | | /// StopBtn |
| | | /// </summary> |
| | | public Button StopBtn; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 当前模式 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | private Button fanModeBtn; |
| | | /// <summary> |
| | | /// 扫风模式 |
| | | /// </summary> |
| | | private Button FanSwingModeBtn; |
| | | /// <summary> |
| | | /// 风速选择视图 |
| | | /// </summary> |
| | | private Dialog fanModeDialog; |
| | |
| | | /// </summary> |
| | | private Dialog acModeDialog; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 传过来的ac |
| | | /// </summary> |
| | | private ZigBee.Device.AC ac; |
| | | #endregion |
| | | |
| | | #region ◆ 接口__________________________ |
| | | #region ◆ 接口___________________________ |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// </summary> |
| | |
| | | public void Changed(CommonDevice common) |
| | | { |
| | | |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IL ogic status. |
| | | /// </summary> |
| | | /// <param name="logic">Logic.</param> |
| | | public void ChangedILogicStatus(ZigBee.Device.Logic logic) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IS cene status. |
| | | /// </summary> |
| | | /// <param name="scene">Scene.</param> |
| | | public void ChangedISceneStatus(Scene scene) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | /// <summary> |
| | | /// 设备状态更新接口 |
| | |
| | | try |
| | | { |
| | | var deviceUI = device; |
| | | //设备为空 |
| | | if (deviceUI.CommonDevice == null) |
| | | { |
| | | return; |
| | | } |
| | | //是否为当前设备 |
| | | if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) |
| | | { |
| | | return; |
| | | } |
| | | if (deviceUI.CommonDevice.Type == DeviceType.Thermostat) |
| | | |
| | | if (common.DeviceStatusReport.CluterID == 513) |
| | | { |
| | | //Thermostat功能 |
| | | if (common.DeviceStatusReport.CluterID == 513) |
| | | var attriButeList = common.DeviceStatusReport.AttriBute; |
| | | if (attriButeList == null || attriButeList.Count == 0) |
| | | { |
| | | var attriButeList = common.DeviceStatusReport.AttriBute; |
| | | if (attriButeList == null || attriButeList.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | ac.DeviceStatusReport = common.DeviceStatusReport; |
| | | switch (attriButeList[0].AttributeId) |
| | | { |
| | | case 0: |
| | | //此属性表明室内当前的温度 * 100,实际温度为“LocalTemperature / 100”,单位:℃ |
| | | ac.currentLocalTemperature = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | ac.LastDateTime = DateTime.Now; |
| | | indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.IndoorTemperature)} {ac.currentLocalTemperature} ℃"; |
| | | //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} ℃"; |
| | | break; |
| | | return; |
| | | } |
| | | deviceUI.CommonDevice.DeviceStatusReport = common.DeviceStatusReport; |
| | | var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | switch (attriButeList[0].AttributeId) |
| | | { |
| | | case 0: |
| | | ac.currentLocalTemperature = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} ℃"; |
| | | //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} ℃"; |
| | | break; |
| | | |
| | | case 17: |
| | | //此属性表明此设备当前的制冷温度,实际温度为“CoolingSetpoint / 100”,单位:℃。 |
| | | ac.currentCoolingSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 17: |
| | | ac.currentCoolingSetpoint = curTemp; |
| | | if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) |
| | | { |
| | | currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} ℃"; |
| | | } |
| | | |
| | | case 18: |
| | | //此属性表明此设备当前的制热温度,实际温度为“HeatingSetpoint / 100”,单位:℃。 |
| | | ac.currentHeatingSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 4096: |
| | | //此属性表明此设备当前的自动温度,实际温度为“AutoSetpoint / 100”,单位:℃。 |
| | | ac.currentAutoSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 18: |
| | | ac.currentHeatingSetpoint = curTemp; |
| | | if (ac.currentSystemMode == 4) |
| | | { |
| | | currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} ℃"; |
| | | } |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 28: |
| | | //此属性描述恒温设备正处于哪种模式 |
| | | //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8 |
| | | ac.currentSystemMode = attriButeList[0].AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | if (ac.currentSystemMode == 0) |
| | | { |
| | | switchBtn.IsSelected = false; |
| | | modeBtn.IsSelected = false; |
| | | modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); |
| | | modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); |
| | | currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); |
| | | } |
| | | else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8) |
| | | { |
| | | switchBtn.IsSelected = true; |
| | | modeBtn.IsSelected = true; |
| | | modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); |
| | | modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); |
| | | currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); |
| | | case 4096: |
| | | ac.currentAutoSetpoint = curTemp; |
| | | if (ac.currentSystemMode == 1) |
| | | { |
| | | currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} ℃"; |
| | | } |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} ℃"; |
| | | } |
| | | break; |
| | | } |
| | | case 28: |
| | | //此属性描述恒温设备正处于哪种模式 |
| | | //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8 |
| | | ac.currentSystemMode = attriButeList[0].AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | if (ac.currentSystemMode == 0) |
| | | { |
| | | switchBtn.IsSelected = false; |
| | | modeBtn.IsSelected = false; |
| | | modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); |
| | | modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); |
| | | currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); |
| | | currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} ℃"; |
| | | |
| | | fanModeBtn.IsSelected = false; |
| | | FanSwingModeBtn.IsSelected = false; |
| | | } |
| | | else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8) |
| | | { |
| | | switchBtn.IsSelected = true; |
| | | modeBtn.IsSelected = true; |
| | | modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); |
| | | modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); |
| | | currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); |
| | | currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} ℃"; |
| | | |
| | | fanModeBtn.IsSelected = true; |
| | | FanSwingModeBtn.IsSelected = true; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | //Fan Control功能 |
| | | |
| | | if (common.DeviceStatusReport.CluterID == 514) |
| | | { |
| | | var attriButeList = common.DeviceStatusReport.AttriBute; |
| | |
| | | fanModeBtn.SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode); |
| | | fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode); |
| | | break; |
| | | case 4096: |
| | | //风扇当前的扫风模式 |
| | | ac.currentFanSwingMode = attriButeList[0].AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | FanSwingModeBtn.IsSelected = true; |
| | | FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode); |
| | | FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode); |
| | | break; |
| | | } |
| | | //***新改***设备状态上报中,当CluterID=3,证明设备在线,直接标记 |
| | | //else if ((common as ToggleLight).DeviceStatusReport.CluterID == 3) |
| | | //{ |
| | | //var light = deviceUI.CommonDevice as ToggleLight; |
| | | //light.IsOnline = 1; |
| | | //deviceIMG.IsSelected = light.IsOnline == 1; |
| | | //light.LastDateTime = DateTime.Now; |
| | | //} |
| | | } |
| | | //***新改 * **设备状态上报中,当CluterID = 3,证明设备在线,直接标记 |
| | | else if (common.DeviceStatusReport.CluterID == 3) |
| | | { |
| | | ac.IsOnline = 1; |
| | | switchBtn.IsSelected = true; |
| | | ac.LastDateTime = DateTime.Now; |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | System.Console.WriteLine($"Error:{ex.Message}"); |
| | |
| | | } |
| | | if (deviceUI.CommonDevice.Type == DeviceType.Thermostat) |
| | | { |
| | | ac = deviceUI.CommonDevice as ZigBee.Device.AC; |
| | | ac.IsOnline = (common as DimmableLight).IsOnline; |
| | | ac.IsOnline = common.IsOnline; |
| | | ac.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 重写移除_______________________ |
| | | |
| | | /// <summary> |
| | | /// Removes from parent. |
| | | /// Changeds the IL ogic status. |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | /// <param name="logic">Logic.</param> |
| | | public void ChangedILogicStatus(ZigBee.Device.Logic logic) |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | base.RemoveFromParent(); |
| | | //throw new NotImplementedException(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Changeds the IS cene status. |
| | | /// </summary> |
| | | /// <param name="scene">Scene.</param> |
| | | public void ChangedISceneStatus(Scene scene) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | #endregion |
| | | |
| | | #region ◆ 构造方法_______________________ |
| | | #region ◆ 构造方法________________________ |
| | | |
| | | /// <summary> |
| | | /// 构造方法 |
| | | /// </summary> |
| | | public ACControl() |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; |
| | | ZigBee.Device.ZbGateway.StatusList.Add(this); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 初始化________________________ |
| | | #region ◆ 重写移除方法____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化 |
| | | /// Removes from parent. |
| | | /// </summary> |
| | | /// <param name="device">Device.</param> |
| | | /// <param name="room">Room.</param> |
| | | private void InitAC(DeviceUI device, Common.Room room) |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Add(this); |
| | | this.device = device; |
| | | ZigBee.Device.ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | base.RemoveFromParent(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 显示界面________________________ |
| | | |
| | | /// <summary> |
| | | /// 显示界面 |
| | | /// </summary> |
| | | /// <param name="dev">Device.</param> |
| | | /// <param name="room">Room.</param> |
| | | public void Show(DeviceUI dev, Shared.Common.Room room) |
| | | { |
| | | device = dev; |
| | | zbGateway = this.device.CommonDevice.Gateway; |
| | | this.room = room; |
| | | this.ac = device.CommonDevice as ZigBee.Device.AC; |
| | | AddTop(); |
| | | |
| | | //添加topview |
| | | AddTopView(); |
| | | //添加midview |
| | | AddMidview(); |
| | | //绑定事件 |
| | | BindEvent(); |
| | | //收藏 |
| | | InitCollection(); |
| | | AddBodyView(device); |
| | | |
| | | if (ac.Gateway == null) |
| | | { |
| | | return; |
| | | } |
| | | if (ac.Gateway.IsVirtual) |
| | | { |
| | | //发送读取状态命令 |
| | |
| | | ac.ReadAutoSetpoint(); |
| | | ac.ReadFanMode(); |
| | | ac.ReadSystemMode(); |
| | | ac.ReadSystemFansSwingMode(); |
| | | }); |
| | | } |
| | | else |
| | |
| | | ac.ReadAutoSetpoint(); |
| | | ac.ReadFanMode(); |
| | | ac.ReadSystemMode(); |
| | | ac.ReadSystemFansSwingMode(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Inits the collection. |
| | | /// </summary> |
| | | private void InitCollection() |
| | | { |
| | | var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | { |
| | | collectionBtn.IsSelected = true; |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | BindEvent(); |
| | | |
| | | #region ◆ 显示界面_______________________ |
| | | /// <summary> |
| | | /// 显示界面 |
| | | /// </summary> |
| | | /// <param name="device">Device.</param> |
| | | /// <param name="room">Room.</param> |
| | | public void Show(DeviceUI device, Shared.Common.Room room) |
| | | { |
| | | InitAC(device, room); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ topview_______________________ |
| | | #region ◆ Add____________________________ |
| | | |
| | | /// <summary> |
| | | /// Adds the top view. |
| | | /// AddTop |
| | | /// </summary> |
| | | private void AddTopView() |
| | | public void AddTop() |
| | | { |
| | | top = new CommonForm.TopFrameLayout(); |
| | | var top = new TopFrameLayout(); |
| | | AddChidren(top); |
| | | top.InitTopview(); |
| | | top.backButton.MouseUpEventHandler += (sender, e) => |
| | |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | AddMoreview(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Adds the moreview. |
| | | /// </summary> |
| | | private void AddMoreview() |
| | | { |
| | | moreBtn = new CommonForm.SelectedStatuButton() |
| | | var sharedBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(CommonPage.AppRealWidth - 150), |
| | | Width = Application.GetMinReal(110), |
| | | Height = Application.GetMinReal(110), |
| | | X = Application.GetRealWidth(850), |
| | | Width = Application.GetMinReal(69), |
| | | Height = Application.GetMinReal(69), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Item/More.png", |
| | | SelectedImagePath = "Item/MoreSelected.png", |
| | | UnSelectedImagePath = "Item/Shared.png" |
| | | }; |
| | | top.topView.AddChidren(sharedBtn); |
| | | |
| | | var moreBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(953), |
| | | Width = Application.GetMinReal(69), |
| | | Height = Application.GetMinReal(69), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Item/More.png" |
| | | }; |
| | | top.topView.AddChidren(moreBtn); |
| | | } |
| | | |
| | | moreBtn.MouseUpEventHandler += More; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 更多设置 |
| | | /// AddBodyView |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="e">E.</param> |
| | | private void MoreEvent(object sender, MouseEventArgs e) |
| | | public void AddBodyView(DeviceUI device) |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.action = () => |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | | Show(device, room); |
| | | Y = Application.GetRealHeight(184), |
| | | Height = Application.GetRealHeight(1737), |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, |
| | | }; |
| | | } |
| | | AddChidren(bodyFrameLayout); |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ midview_______________________ |
| | | |
| | | /// <summary> |
| | | /// Adds the midview. |
| | | /// </summary> |
| | | private void AddMidview() |
| | | { |
| | | midFL = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), |
| | | Y = top.Bottom, |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | AddChidren(midFL); |
| | | |
| | | AddItemview(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ itemview_______________________ |
| | | /// <summary> |
| | | /// Adds the itemview. |
| | | /// </summary> |
| | | private void AddItemview() |
| | | { |
| | | var itemView = new FrameLayout() |
| | | { |
| | | Y=Application.GetRealHeight(115), |
| | | Y = Application.GetRealHeight(115), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = Application.GetRealHeight(1316), |
| | | Radius = CommonPage.BigFormRadius, |
| | | Height = Application.GetRealHeight(1457), |
| | | Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | midFL.AddChidren(itemView); |
| | | var deviceView = new FrameLayout() |
| | | { |
| | | X = 2, |
| | | Y = 2, |
| | | Width = itemView.Width - 4, |
| | | Height = itemView.Height - Application.GetRealHeight(138), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | Tag = device |
| | | }; |
| | | itemView.AddChidren(deviceView); |
| | | bodyFrameLayout.AddChidren(itemView); |
| | | |
| | | collectionBtn = new Button() |
| | | { |
| | | X = deviceView.Width - Application.GetRealWidth(130), |
| | | Y = Application.GetRealHeight(20), |
| | | Width = Application.GetMinReal(110), |
| | | Height = Application.GetMinReal(110), |
| | | X = Application.GetRealWidth(850), |
| | | Y = Application.GetRealHeight(46), |
| | | Width = Application.GetMinReal(69), |
| | | Height = Application.GetMinReal(69), |
| | | UnSelectedImagePath = "Item/Collection.png", |
| | | SelectedImagePath = "Item/CollectionSelected.png" |
| | | }; |
| | | deviceView.AddChidren(collectionBtn); |
| | | itemView.AddChidren(collectionBtn); |
| | | |
| | | var deviceName = new Button() |
| | | var deviceNameBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(50), |
| | | Height = Application.GetRealHeight(80), |
| | | Y = Application.GetRealHeight(184), |
| | | Width = Application.GetRealWidth(500), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = device.CommonDevice.DeviceEpointName, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 15 |
| | | }; |
| | | itemView.AddChidren(deviceNameBtn); |
| | | |
| | | indoorTemperatureBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(256), |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text=device.CommonDevice.DeviceEpointName, |
| | | TextSize=15, |
| | | TextColor=ZigbeeColor.Current.GXCTextBlackColor |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} ℃" |
| | | }; |
| | | deviceView.AddChidren(deviceName); |
| | | itemView.AddChidren(indoorTemperatureBtn); |
| | | |
| | | indoorTemperatureBtn = new Button() |
| | | { |
| | | Y = deviceName.Bottom, |
| | | Height = Application.GetRealHeight(80), |
| | | Width = Application.GetRealWidth(300), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = $"{Language.StringByID(R.MyInternationalizationString.IndoorTemperature)} {ac.currentLocalTemperature}°C" , |
| | | TextSize = 12, |
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor |
| | | }; |
| | | deviceView.AddChidren(indoorTemperatureBtn); |
| | | |
| | | var controlBG = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(323), |
| | | Y = Application.GetRealHeight(412), |
| | | Height = Application.GetMinRealAverage(547), |
| | | Width = Application.GetMinRealAverage(671), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | BackgroundImagePath = "AC/Group.png" |
| | | }; |
| | | deviceView.AddChidren(controlBG); |
| | | itemView.AddChidren(controlBG); |
| | | |
| | | var controlBG2 = new Button() |
| | | { |
| | | Y=Application.GetRealHeight(783), |
| | | Height=Application.GetMinRealAverage(121), |
| | | Width=Application.GetMinRealAverage(351), |
| | | UnSelectedImagePath="AC/Path.png", |
| | | Gravity=Gravity.CenterHorizontal |
| | | Y = Application.GetRealHeight(873), |
| | | Height = Application.GetMinRealAverage(121), |
| | | Width = Application.GetMinRealAverage(351), |
| | | UnSelectedImagePath = "AC/Path.png", |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | deviceView.AddChidren(controlBG2); |
| | | itemView.AddChidren(controlBG2); |
| | | //当前模式 |
| | | currentModeBtn = new Button() |
| | | { |
| | |
| | | Height = Application.GetRealHeight(80), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | Gravity=Gravity.CenterHorizontal, |
| | | Text=ACControlBase.GetModeNameByModeId(ac.currentSystemMode) |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode) |
| | | }; |
| | | controlBG.AddChidren(currentModeBtn); |
| | | //降低温度 |
| | |
| | | Y = Application.GetRealHeight(248), |
| | | Width = Application.GetRealWidth(180), |
| | | Height = Application.GetRealHeight(100), |
| | | TextColor=ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize=15, |
| | | Text=$"{ACControlBase.GetCurrentModeTemperature(ac)} °C", |
| | | Gravity=Gravity.CenterHorizontal |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 15, |
| | | Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} °C", |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | controlBG.AddChidren(currentTemperatureBtn); |
| | | |
| | |
| | | }; |
| | | controlBG.AddChidren(addTemperatureBtn); |
| | | |
| | | //扫风 |
| | | FanSwingModeBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(156), |
| | | Y = Application.GetRealHeight(1086), |
| | | Width = Application.GetMinRealAverage(80), |
| | | Height = Application.GetMinRealAverage(80), |
| | | UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode), |
| | | SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode), |
| | | IsSelected = ACControlBase.IsOpen(ac) |
| | | }; |
| | | itemView.AddChidren(FanSwingModeBtn); |
| | | |
| | | //模式 |
| | | modeBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(207), |
| | | Y = Application.GetRealHeight(996), |
| | | X = Application.GetRealWidth(346), |
| | | Y = Application.GetRealHeight(1086), |
| | | Width = Application.GetMinRealAverage(80), |
| | | Height = Application.GetMinRealAverage(80), |
| | | UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode), |
| | | SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode), |
| | | IsSelected = ACControlBase.IsOpen(ac) |
| | | }; |
| | | deviceView.AddChidren(modeBtn); |
| | | itemView.AddChidren(modeBtn); |
| | | |
| | | //开关 |
| | | switchBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(446), |
| | | Y = Application.GetRealHeight(996), |
| | | X = Application.GetRealWidth(536), |
| | | Y = Application.GetRealHeight(1086), |
| | | Width = Application.GetMinRealAverage(80), |
| | | Height = Application.GetMinRealAverage(80), |
| | | UnSelectedImagePath = "AC/OpenOrClose.png", |
| | | SelectedImagePath = "AC/OpenOrCloseSelected.png", |
| | | IsSelected = ACControlBase.IsOpen(ac) |
| | | }; |
| | | deviceView.AddChidren(switchBtn); |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | | //风速 |
| | | fanModeBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(667), |
| | | Y = Application.GetRealHeight(996), |
| | | X = Application.GetRealWidth(729), |
| | | Y = Application.GetRealHeight(1086), |
| | | Width = Application.GetMinRealAverage(80), |
| | | Height = Application.GetMinRealAverage(80), |
| | | UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode), |
| | | SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode), |
| | | IsSelected = ACControlBase.IsOpen(ac) |
| | | }; |
| | | deviceView.AddChidren(fanModeBtn); |
| | | itemView.AddChidren(fanModeBtn); |
| | | |
| | | var roomBtn = new Button() |
| | | var roomBG = new Button |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | Y = Application.GetRealHeight(25) + deviceView.Bottom, |
| | | Y = Application.GetRealHeight(1322 - 50), |
| | | Height = Application.GetRealHeight(138 + 50), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor, |
| | | Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius) |
| | | }; |
| | | itemView.AddChidren(roomBG); |
| | | |
| | | var roomBG2 = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1322 - 50), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | }; |
| | | itemView.AddChidren(roomBG2); |
| | | |
| | | roomBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Y = Application.GetRealHeight(1351), |
| | | Width = Application.GetMinReal(80), |
| | | Height = Application.GetMinReal(80), |
| | | UnSelectedImagePath = "Item/Room.png", |
| | | SelectedImagePath = "Item/RoomSelected.png" |
| | | UnSelectedImagePath = "Item/Room.png" |
| | | }; |
| | | itemView.AddChidren(roomBtn); |
| | | |
| | | var roomName = new Button() |
| | | roomName = new Button() |
| | | { |
| | | X = roomBtn.Right + Application.GetRealWidth(20), |
| | | Y = roomBtn.Y, |
| | | X = Application.GetRealWidth(150), |
| | | Y = Application.GetRealHeight(1368), |
| | | Width = Application.GetRealWidth(400), |
| | | Height = Application.GetRealHeight(80), |
| | | Height = Application.GetRealHeight(50), |
| | | Text = room.Name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | itemView.AddChidren(roomName); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 绑定事件________________________ |
| | | |
| | | /// <summary> |
| | | /// 绑定按钮的事件 |
| | | /// </summary> |
| | | private void BindEvent() |
| | | { |
| | | switchBtn.MouseUpEventHandler += Switch_MouseUpEvent; |
| | | collectionBtn.MouseUpEventHandler += Collection; |
| | | fanModeBtn.MouseUpEventHandler += ShowChangeFan_MouseUpEvent; |
| | | modeBtn.MouseUpEventHandler += ShowChangeMode_MouseUpEvent; |
| | | FanSwingModeBtn.MouseUpEventHandler += ShowChangeFanSwing_MouseUpEvent; |
| | | reduceTemperatureBtn.MouseUpEventHandler += Reduce_MouseUpEvent; |
| | | addTemperatureBtn.MouseUpEventHandler += Add_MouseUpEvent; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 开关__________________________ |
| | | |
| | | /// <summary> |
| | | /// 开关 |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void Switch_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | ac.Open(); |
| | | modeBtn.IsSelected = true; |
| | | fanModeBtn.IsSelected = true; |
| | | FanSwingModeBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | ac.Close(); |
| | | modeBtn.IsSelected = false; |
| | | fanModeBtn.IsSelected = false; |
| | | FanSwingModeBtn.IsSelected = false; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | var changeFanModeBG = new Button() |
| | | { |
| | | X = Application.GetRealWidth(553), |
| | | Y = Application.GetRealHeight(655), |
| | | X = Application.GetRealWidth(600), |
| | | Y = Application.GetRealHeight(750), |
| | | Height = Application.GetRealHeight(625), |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | UnSelectedImagePath = "AC/SelectedFanModeBG.png" |
| | |
| | | |
| | | var changeFanModeFL = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(553), |
| | | Y = Application.GetRealHeight(655), |
| | | X = Application.GetRealWidth(600), |
| | | Y = Application.GetRealHeight(750), |
| | | Height = Application.GetRealHeight(600), |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Radius = CommonPage.BigFormRadius, |
| | |
| | | { |
| | | fan_Middle.SetSelectedStatu(); |
| | | } |
| | | else if (ac.currentFanMode == 3) |
| | | else |
| | | { |
| | | fan_Height.SetSelectedStatu(); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void ChangeFan_MouseUpEvent(object sender,MouseEventArgs mouseEventArgs) |
| | | private void ChangeFan_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | var tag = (sender as Button).Tag.ToString(); |
| | | ZigBee.Device.AC.FanMode mode= ZigBee.Device.AC.FanMode.Low; |
| | | ZigBee.Device.AC.FanMode mode = ZigBee.Device.AC.FanMode.Low; |
| | | if (tag == "Low") |
| | | { |
| | | mode = ZigBee.Device.AC.FanMode.Low; |
| | |
| | | fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanMode(fanMode); |
| | | ac.currentFanMode = (int)(fanMode); |
| | | |
| | | (device.CommonDevice as ZigBee.Device.AC).SetFanModeAsync(fanMode); |
| | | ac.SetFanModeAsync(fanMode); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | var changeModeBG = new Button() |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Y = Application.GetRealHeight(360), |
| | | X = Application.GetRealWidth(230), |
| | | Y = Application.GetRealHeight(450), |
| | | Height = Application.GetRealHeight(933), |
| | | Width = Application.GetRealWidth(modeItem_Width), |
| | | UnSelectedImagePath = "AC/SelectedModeBG.png" |
| | |
| | | |
| | | var changeModeFL = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Y = Application.GetRealHeight(360), |
| | | X = Application.GetRealWidth(230), |
| | | Y = Application.GetRealHeight(450), |
| | | Height = Application.GetRealHeight(900), |
| | | Width = Application.GetRealWidth(modeItem_Width), |
| | | Radius = CommonPage.BigFormRadius, |
| | |
| | | { |
| | | mode = ZigBee.Device.AC.AcMode.Heat; |
| | | } |
| | | else if(tag =="Dry") |
| | | else if (tag == "Dry") |
| | | { |
| | | mode = ZigBee.Device.AC.AcMode.Dry; |
| | | } |
| | | else if(tag == "FanOnly") |
| | | else if (tag == "FanOnly") |
| | | { |
| | | mode = ZigBee.Device.AC.AcMode.FanOnly; |
| | | } |
| | |
| | | currentModeBtn.Text = ACControlBase.GetModeNameByMode(acMode); |
| | | ac.currentSystemMode = (int)acMode; |
| | | currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} °C"; |
| | | (device.CommonDevice as ZigBee.Device.AC).SetSystemModeAsync(acMode); |
| | | ac.SetSystemModeAsync(acMode); |
| | | |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 开关__________________________ |
| | | #region ◆ 切换扫风___________________________ |
| | | |
| | | |
| | | /// <summary> |
| | | /// 开关 |
| | | /// 切换扫风 |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void Switch_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | private void ShowChangeFanSwing_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | if (switchBtn.IsSelected == true) |
| | | int fanItem_X = 80; |
| | | int fanItem_Height = 150; |
| | | int fanItem_Width = 449; |
| | | |
| | | fanModeDialog = new Dialog(); |
| | | fanModeDialog.Show(); |
| | | var closeBGview = new FrameLayout(); |
| | | fanModeDialog.AddChidren(closeBGview); |
| | | closeBGview.MouseUpEventHandler += (send1, e1) => |
| | | { |
| | | ac.Open(); |
| | | modeBtn.IsSelected = true; |
| | | fanModeBtn.IsSelected = true; |
| | | } |
| | | else |
| | | fanModeDialog.Close(); |
| | | }; |
| | | |
| | | var changeFanModeBG = new Button() |
| | | { |
| | | ac.Close(); |
| | | modeBtn.IsSelected = false; |
| | | fanModeBtn.IsSelected = false; |
| | | X = Application.GetRealWidth(35), |
| | | Y = Application.GetRealHeight(297), |
| | | Height = Application.GetRealHeight(1089), |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | UnSelectedImagePath = "AC/SwingBackground.png" |
| | | }; |
| | | closeBGview.AddChidren(changeFanModeBG); |
| | | |
| | | var changeFanModeFL = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = Application.GetRealHeight(297), |
| | | Height = Application.GetRealHeight(1050), |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Radius = CommonPage.BigFormRadius, |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | }; |
| | | closeBGview.AddChidren(changeFanModeFL); |
| | | |
| | | var changeFanBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(fanItem_X), |
| | | Width = Application.GetRealWidth(fanItem_Width - fanItem_X), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextID = R.MyInternationalizationString.SelectSwing, |
| | | TextAlignment = TextAlignment.CenterLeft |
| | | }; |
| | | changeFanModeFL.AddChidren(changeFanBtn); |
| | | |
| | | var swing_First = new CommonForm.ACLeftIconButtonRowLayout() |
| | | { |
| | | Y = changeFanBtn.Bottom, |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | Tag = ZigBee.Device.AC.FanSwingMode.First |
| | | }; |
| | | changeFanModeFL.AddChidren(swing_First); |
| | | swing_First.Init("AC/Swing_1.png", "AC/Swing_1Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_First)); |
| | | |
| | | var swing_Second = new CommonForm.ACLeftIconButtonRowLayout() |
| | | { |
| | | Y = swing_First.Bottom, |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | Tag = ZigBee.Device.AC.FanSwingMode.Second |
| | | }; |
| | | changeFanModeFL.AddChidren(swing_Second); |
| | | swing_Second.Init("AC/Swing_2.png", "AC/Swing_2Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Second)); |
| | | |
| | | var swing_Thrid = new CommonForm.ACLeftIconButtonRowLayout() |
| | | { |
| | | Y = swing_Second.Bottom, |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | Tag = ZigBee.Device.AC.FanSwingMode.Thrid |
| | | }; |
| | | changeFanModeFL.AddChidren(swing_Thrid); |
| | | swing_Thrid.Init("AC/Swing_3.png", "AC/Swing_3Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Thrid)); |
| | | |
| | | var swing_Fourth = new CommonForm.ACLeftIconButtonRowLayout() |
| | | { |
| | | Y = swing_Thrid.Bottom, |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | Tag = ZigBee.Device.AC.FanSwingMode.Fourth |
| | | }; |
| | | changeFanModeFL.AddChidren(swing_Fourth); |
| | | swing_Fourth.Init("AC/Swing_4.png", "AC/Swing_4Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Fourth)); |
| | | |
| | | var swing_Fifth = new CommonForm.ACLeftIconButtonRowLayout() |
| | | { |
| | | Y = swing_Fourth.Bottom, |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | Tag = ZigBee.Device.AC.FanSwingMode.Fifth |
| | | }; |
| | | changeFanModeFL.AddChidren(swing_Fifth); |
| | | swing_Fifth.Init("AC/Swing_5.png", "AC/Swing_5Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Fifth)); |
| | | |
| | | var swing_Auto = new CommonForm.ACLeftIconButtonRowLayout() |
| | | { |
| | | Y = swing_Fifth.Bottom, |
| | | Width = Application.GetRealWidth(fanItem_Width), |
| | | Height = Application.GetRealHeight(fanItem_Height), |
| | | Tag = ZigBee.Device.AC.FanSwingMode.Auto |
| | | }; |
| | | changeFanModeFL.AddChidren(swing_Auto); |
| | | swing_Auto.Init("AC/Swing_Auto.png", "AC/Swing_AutoSelected.png", Language.StringByID(R.MyInternationalizationString.Swing_Auto),false); |
| | | |
| | | |
| | | swing_First.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | swing_First.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | |
| | | swing_Second.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | swing_Second.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | |
| | | swing_Thrid.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | swing_Thrid.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | |
| | | swing_Fourth.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | swing_Fourth.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | |
| | | swing_Fifth.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | swing_Fifth.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | |
| | | swing_Auto.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | swing_Auto.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent; |
| | | |
| | | if (ACControlBase.IsOpen(ac)) |
| | | { |
| | | if (ac.currentFanSwingMode == 0) |
| | | { |
| | | swing_First.SetSelectedStatu(); |
| | | } |
| | | else if (ac.currentFanSwingMode == 1) |
| | | { |
| | | swing_Second.SetSelectedStatu(); |
| | | } |
| | | else if (ac.currentFanSwingMode == 2) |
| | | { |
| | | swing_Thrid.SetSelectedStatu(); |
| | | } |
| | | else if (ac.currentFanSwingMode == 3) |
| | | { |
| | | swing_Fourth.SetSelectedStatu(); |
| | | } |
| | | else if (ac.currentFanSwingMode == 4) |
| | | { |
| | | swing_Fifth.SetSelectedStatu(); |
| | | } |
| | | else if (ac.currentFanSwingMode == 7) |
| | | { |
| | | swing_Auto.SetSelectedStatu(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 切换扫风 |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void ChangeFanSwing_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | var tag = (sender as Button).Tag.ToString(); |
| | | ZigBee.Device.AC.FanSwingMode mode = ZigBee.Device.AC.FanSwingMode.Auto; |
| | | if (tag == "First") |
| | | { |
| | | mode = ZigBee.Device.AC.FanSwingMode.First; |
| | | } |
| | | else if (tag == "Second") |
| | | { |
| | | mode = ZigBee.Device.AC.FanSwingMode.Second; |
| | | } |
| | | else if (tag == "Thrid") |
| | | { |
| | | mode = ZigBee.Device.AC.FanSwingMode.Thrid; |
| | | } |
| | | else if(tag=="Fourth") |
| | | { |
| | | mode = ZigBee.Device.AC.FanSwingMode.Fourth; |
| | | } |
| | | else if (tag == "Fifth") |
| | | { |
| | | mode = ZigBee.Device.AC.FanSwingMode.Fifth; |
| | | } |
| | | |
| | | |
| | | ChangeFanSwing(mode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 切换扫风 |
| | | /// </summary> |
| | | /// <param name="fanSwingMode">Fan mode.</param> |
| | | private void ChangeFanSwing(ZigBee.Device.AC.FanSwingMode fanSwingMode) |
| | | { |
| | | fanModeDialog.Close(); |
| | | if (ACControlBase.IsOpen(ac) == false) |
| | | { |
| | | ACControlBase.ShowACIsCloseTip(); |
| | | return; |
| | | } |
| | | FanSwingModeBtn.IsSelected = true; |
| | | FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode); |
| | | FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode); |
| | | ac.currentFanSwingMode = (int)fanSwingMode; |
| | | |
| | | ac.SetFanSwingAsyncMode(fanSwingMode); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | return; |
| | | } |
| | | //cool //dry |
| | | if (ac.currentSystemMode == 3 || ac.currentSystemMode==8) |
| | | if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) |
| | | { |
| | | if(ac.currentCoolingSetpoint>=ACControlBase.Temperature_High) |
| | | if (ac.currentCoolingSetpoint >= ACControlBase.Temperature_High) |
| | | { |
| | | return; |
| | | } |
| | | ac.currentCoolingSetpoint += 1; |
| | | ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint*100); |
| | | ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100); |
| | | currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C"; |
| | | } |
| | | //heat |
| | | else if (ac.currentSystemMode == 4) |
| | | { |
| | | if(ac.currentHeatingSetpoint>=ACControlBase.Temperature_High) |
| | | if (ac.currentHeatingSetpoint >= ACControlBase.Temperature_High) |
| | | { |
| | | return; |
| | | } |
| | | ac.currentHeatingSetpoint += 1; |
| | | ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint*100); |
| | | ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100); |
| | | currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C"; |
| | | } |
| | | //auto |
| | |
| | | return; |
| | | } |
| | | ac.currentAutoSetpoint += 1; |
| | | ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint*100); |
| | | ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); |
| | | currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C"; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | ac.currentCoolingSetpoint -= 1; |
| | | ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint*100); |
| | | ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100); |
| | | |
| | | currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C"; |
| | | } |
| | |
| | | return; |
| | | } |
| | | ac.currentHeatingSetpoint -= 1; |
| | | ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint*100); |
| | | ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100); |
| | | |
| | | currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C"; |
| | | } |
| | |
| | | return; |
| | | } |
| | | ac.currentAutoSetpoint -= 1; |
| | | ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint*100); |
| | | ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); |
| | | |
| | | currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C"; |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 收藏__________________________ |
| | | |
| | | |
| | | #region ◆ 控制反馈_________________________ |
| | | |
| | | /// <summary> |
| | | /// 显示设备控制状态 |
| | | /// </summary> |
| | | /// <param name="command">Command.</param> |
| | | /// <param name="objValue">Object value.</param> |
| | | private void UpdateDeviceControllStatu(string command, object objValue) |
| | | { |
| | | if (command != "DeviceDefaultAck" || objValue == null) |
| | | { |
| | | return; |
| | | } |
| | | var tempDevice = (CommonDevice)objValue; |
| | | if (tempDevice.DeviceEpoint != this.device.CommonDevice.DeviceEpoint || tempDevice.DeviceAddr != this.device.CommonDevice.DeviceAddr) |
| | | { |
| | | //不是当前设备的推送,则不处理 |
| | | return; |
| | | } |
| | | //标记已经发送控制命令到网关 |
| | | sendedControlCommand = true; |
| | | //成功不提示 |
| | | //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除更新控制设备的action |
| | | /// </summary> |
| | | private void RemoveUpdateControlDeviceStatuAction() |
| | | { |
| | | //移除action |
| | | if (zbGateway != null) |
| | | { |
| | | zbGateway.ReportAction -= UpdateDeviceControllStatu; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 更多设置________________________ |
| | | |
| | | /// <summary> |
| | | /// 更多设置 |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="e">E.</param> |
| | | private void More(object sender, MouseEventArgs e) |
| | | { |
| | | var detailInfo = new Device.CommonForm.DeviceDetailInfo { }; |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.action = () => |
| | | { |
| | | Show(device, room); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 收藏到主页_______________________ |
| | | |
| | | /// <summary> |
| | | /// 收藏到主页 |
| | | /// </summary> |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 绑定按钮_______________________ |
| | | #region ◆ 回到主页________________________ |
| | | |
| | | /// <summary> |
| | | /// 绑定按钮的事件 |
| | | /// 回到主页 |
| | | /// </summary> |
| | | private void BindEvent() |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void BackToRoomHandler(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | switchBtn.MouseUpEventHandler += Switch_MouseUpEvent; |
| | | reduceTemperatureBtn.MouseUpEventHandler += Reduce_MouseUpEvent; |
| | | addTemperatureBtn.MouseUpEventHandler += Add_MouseUpEvent; |
| | | collectionBtn.MouseUpEventHandler += Collection; |
| | | moreBtn.MouseUpEventHandler += MoreEvent; |
| | | fanModeBtn.MouseUpEventHandler += ShowChangeFan_MouseUpEvent; |
| | | modeBtn.MouseUpEventHandler += ShowChangeMode_MouseUpEvent; |
| | | //backToRoom |
| | | |
| | | } |
| | | |
| | | #endregion |