From 8b9ce384b26c414db32f98e94e088f5334869c2d Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 13 十一月 2019 15:36:28 +0800 Subject: [PATCH] 全部合并了代码,安卓和 IOS 都测试通过了 --- ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs | 1003 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 664 insertions(+), 339 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs index 586446e..63e9498 100755 --- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs @@ -1,6 +1,8 @@ 锘縰sing System; using Shared.Common; using ZigBee.Device; +using Shared.Phone.Device.CommonForm; +using Shared.Phone.UserView; namespace Shared.Phone.Device.AC { @@ -11,38 +13,60 @@ /// 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> @@ -72,6 +96,10 @@ /// </summary> private Button fanModeBtn; /// <summary> + /// 鎵妯″紡 + /// </summary> + private Button FanSwingModeBtn; + /// <summary> /// 椋庨�熼�夋嫨瑙嗗浘 /// </summary> private Dialog fanModeDialog; @@ -80,10 +108,13 @@ /// </summary> private Dialog acModeDialog; - + /// <summary> + /// 浼犺繃鏉ョ殑ac + /// </summary> + private ZigBee.Device.AC ac; #endregion - #region 鈼� 鎺ュ彛__________________________ + #region 鈼� 鎺ュ彛___________________________ /// <summary> /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange() /// </summary> @@ -92,22 +123,6 @@ 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> /// 璁惧鐘舵�佹洿鏂版帴鍙� @@ -128,84 +143,94 @@ 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锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 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: - //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鍐锋俯搴︼紝瀹為檯娓╁害涓衡�淐oolingSetpoint / 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: - //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 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: - //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勮嚜鍔ㄦ俯搴︼紝瀹為檯娓╁害涓衡�淎utoSetpoint / 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; @@ -224,18 +249,25 @@ 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}"); @@ -261,8 +293,7 @@ } 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; } } @@ -273,57 +304,74 @@ }); } } - - - #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) { //鍙戦�佽鍙栫姸鎬佸懡浠� @@ -336,6 +384,7 @@ ac.ReadAutoSetpoint(); ac.ReadFanMode(); ac.ReadSystemMode(); + ac.ReadSystemFansSwingMode(); }); } else @@ -350,18 +399,12 @@ 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; } @@ -369,32 +412,22 @@ { 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) => @@ -402,146 +435,107 @@ 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() { @@ -549,8 +543,8 @@ 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); //闄嶄綆娓╁害 @@ -571,10 +565,10 @@ 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); @@ -589,68 +583,142 @@ }; 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 @@ -679,8 +747,8 @@ 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" @@ -689,8 +757,8 @@ 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, @@ -758,7 +826,7 @@ { fan_Middle.SetSelectedStatu(); } - else if (ac.currentFanMode == 3) + else { fan_Height.SetSelectedStatu(); } @@ -770,10 +838,10 @@ /// </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; @@ -807,7 +875,7 @@ fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanMode(fanMode); ac.currentFanMode = (int)(fanMode); - (device.CommonDevice as ZigBee.Device.AC).SetFanModeAsync(fanMode); + ac.SetFanModeAsync(fanMode); } #endregion @@ -835,8 +903,8 @@ 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" @@ -845,8 +913,8 @@ 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, @@ -978,11 +1046,11 @@ { 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; } @@ -1008,34 +1076,230 @@ 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 @@ -1053,25 +1317,25 @@ 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 @@ -1082,7 +1346,7 @@ return; } ac.currentAutoSetpoint += 1; - ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint*100); + ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 掳C"; } @@ -1113,7 +1377,7 @@ return; } ac.currentCoolingSetpoint -= 1; - ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint*100); + ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100); currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} 掳C"; } @@ -1125,7 +1389,7 @@ return; } ac.currentHeatingSetpoint -= 1; - ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint*100); + ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100); currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} 掳C"; } @@ -1137,7 +1401,7 @@ return; } ac.currentAutoSetpoint -= 1; - ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint*100); + ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 掳C"; } @@ -1146,7 +1410,70 @@ #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> + /// 绉婚櫎鏇存柊鎺у埗璁惧鐨刟ction + /// </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> @@ -1169,19 +1496,17 @@ #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 -- Gitblit v1.8.0