From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 25 十二月 2019 11:21:06 +0800 Subject: [PATCH] 2019.12.25 --- ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs | 258 +++++++++++++++++++++++++-------------------------- 1 files changed, 125 insertions(+), 133 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs index a2299cc..0ba99c3 100644 --- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs @@ -3,6 +3,7 @@ using ZigBee.Device; using Shared.Phone.Device.CommonForm; using Shared.Phone.UserView; +using Shared.Phone.Device.DeviceLogic; namespace Shared.Phone.Device.AC { @@ -117,6 +118,10 @@ /// </summary> private LeftIconButtonRow cleanStatu; + /// <summary> + /// IsDrawerLockMode + /// </summary> + public bool IsDrawerLockMode; #endregion #region 鈼� 鎺ュ彛___________________________ @@ -165,120 +170,110 @@ 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) + foreach(var attList in attriButeList) { - 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: - ac.currentCoolingSetpoint = curTemp; - if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) - { - mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint; - } - - ac.LastDateTime = DateTime.Now; - break; - - case 18: - ac.currentHeatingSetpoint = curTemp; - if (ac.currentSystemMode == 4) - { - mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint; - } - ac.LastDateTime = DateTime.Now; - break; - - case 4096: - ac.currentAutoSetpoint = curTemp; - if (ac.currentSystemMode == 1) - { - mArcScaleSeekBar.Progress = ac.currentAutoSetpoint; - } - 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; + var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High && attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default; + switch (attList.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: + ac.currentCoolingSetpoint = curTemp; + if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) + { + mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint; + } + ac.LastDateTime = DateTime.Now; + break; + case 18: + ac.currentHeatingSetpoint = curTemp; + if (ac.currentSystemMode == 4) + { + mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint; + } + ac.LastDateTime = DateTime.Now; + break; + case 4096: + ac.currentAutoSetpoint = curTemp; + if (ac.currentSystemMode == 1) + { + mArcScaleSeekBar.Progress = ac.currentAutoSetpoint; + } + ac.LastDateTime = DateTime.Now; + break; + case 28: + //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡 + //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8 + ac.currentSystemMode = attList.AttriButeData; + ac.LastDateTime = DateTime.Now; + if (ac.currentSystemMode == 0) + { + switchBtn.IsSelected = false; + modeBtn.IsSelected = false; + fanModeBtn.IsSelected = false; + FanSwingModeBtn.IsSelected = false; + mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); + } + else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8) + { + switchBtn.IsSelected = true; + modeBtn.IsSelected = true; + fanModeBtn.IsSelected = true; + FanSwingModeBtn.IsSelected = true; + mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor); + } modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); - mArcScaleSeekBar.Progress = 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); - - mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac); - fanModeBtn.IsSelected = true; - FanSwingModeBtn.IsSelected = true; - } - break; - - case 4097: - //杩囪檻缃戞竻娲楁爣蹇�:42 - ac.CleanStatu = attriButeList[0].AttriButeData == 42; - cleanStatu.Visible = ac.CleanStatu; - break; - - case 4099: - var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0'); - var modeStr = value.Substring(value.Length - 5, 5); - for (int j = 0; j < modeStr.Length; j++) - { - ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0; - } - break; - + mArcScaleSeekBar.IsClickable = ACControlBase.IsOpen(ac); + break; + case 4097: + //杩囪檻缃戞竻娲楁爣蹇�:42 + ac.CleanStatu = attList.AttriButeData == 42; + cleanStatu.Visible = ac.CleanStatu; + break; + case 4099: + var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0'); + var modeStr = value.Substring(value.Length - 5, 5); + for (int j = 0; j < modeStr.Length; j++) + { + ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0; + } + break; + } } } if (common.DeviceStatusReport.CluterID == 514) { var attriButeList = common.DeviceStatusReport.AttriBute; - if (attriButeList == null || attriButeList.Count == 0) - { - return; - } ac.DeviceStatusReport = common.DeviceStatusReport; - switch (attriButeList[0].AttributeId) + foreach(var attList in attriButeList) { - case 0: - //椋庢墖褰撳墠鐨勫伐浣滄ā寮� 1=Low 2=Medium 3=High - ac.currentFanMode = attriButeList[0].AttriButeData; - ac.LastDateTime = DateTime.Now; - fanModeBtn.IsSelected = true; - 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; + switch (attList.AttributeId) + { + case 0: + //椋庢墖褰撳墠鐨勫伐浣滄ā寮� 1=Low 2=Medium 3=High + ac.currentFanMode = attList.AttriButeData; + ac.LastDateTime = DateTime.Now; + fanModeBtn.IsSelected = true; + fanModeBtn.SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode); + fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode); + break; + case 4096: + //椋庢墖褰撳墠鐨勬壂椋庢ā寮� + ac.currentFanSwingMode = attList.AttriButeData; + ac.LastDateTime = DateTime.Now; + FanSwingModeBtn.IsSelected = true; + FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode); + FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode); + break; + } } } //***鏂版敼 * **璁惧鐘舵�佷笂鎶ヤ腑锛屽綋CluterID = 3,璇佹槑璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� @@ -354,6 +349,7 @@ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; ZigBee.Device.ZbGateway.StatusList.Add(this); HomePage.Instance.ScrollEnabled = false; + } #endregion @@ -370,6 +366,10 @@ //action = null; RemoveUpdateControlDeviceStatuAction(); HomePage.Instance.ScrollEnabled = true; + if (IsDrawerLockMode) + { + CommonPage.Instance.IsDrawerLockMode = false; + } base.RemoveFromParent(); } @@ -401,16 +401,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� UserView.UserHomeView.ReadStatus(ac, () => { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); - ac.ReadModeSupport(); - ac.ReadCleanStatu(); + ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); }); } else @@ -418,16 +409,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); - ac.ReadModeSupport(); - ac.ReadCleanStatu(); + ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); } } @@ -516,7 +498,7 @@ var deviceNameBtn = new Button() { Y = Application.GetRealHeight(184), - Width = Application.GetRealWidth(500), + Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, Text = device.CommonDevice.DeviceEpointName, @@ -542,11 +524,20 @@ Width = Application.GetRealWidth(671), Height = Application.GetRealHeight(671), Gravity = Gravity.CenterHorizontal, - MinValue=ACControlBase.Temperature_Low, - MaxValue=ACControlBase.Temperature_High, - Progress=ACControlBase.GetCurrentModeTemperature(ac) + MinValue = ACControlBase.Temperature_Low, + MaxValue = ACControlBase.Temperature_High, + Progress = ACControlBase.GetCurrentModeTemperature(ac), + IsClickable = ACControlBase.IsOpen(ac) }; itemView.AddChidren(mArcScaleSeekBar); + if(ACControlBase.IsOpen(ac)) + { + mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor); + } + else + { + mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); + } mArcScaleSeekBar.OnStopTrackingTouchEvent += (sender, e) => { if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) @@ -568,7 +559,7 @@ currentModeBtn = new Button() { - Y = Application.GetRealHeight(599), + Y = Application.GetRealHeight(565), Height = Application.GetRealHeight(80), Width = Application.GetRealWidth(200), TextColor = ZigbeeColor.Current.GXCTextBlackColor, @@ -576,11 +567,11 @@ Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode) }; itemView.AddChidren(currentModeBtn); - + reduceTemperatureBtn = new Button() { X = Application.GetRealWidth(268), - Y = Application.GetRealHeight(680), + Y = Application.GetRealHeight(650), Width = Application.GetMinRealAverage(80), Height = Application.GetMinRealAverage(80), UnSelectedImagePath = "AC/Reduce.png" @@ -589,8 +580,8 @@ addTemperatureBtn = new Button() { - X = Application.GetRealWidth(628), - Y = Application.GetRealHeight(680), + X = Application.GetRealWidth(610), + Y = Application.GetRealHeight(650), Width = Application.GetMinRealAverage(80), Height = Application.GetMinRealAverage(80), UnSelectedImagePath = "AC/Add.png" @@ -715,12 +706,14 @@ private void Switch_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) { switchBtn.IsSelected = !switchBtn.IsSelected; + mArcScaleSeekBar.IsClickable = switchBtn.IsSelected; if (switchBtn.IsSelected == true) { ac.Open(); modeBtn.IsSelected = true; fanModeBtn.IsSelected = true; FanSwingModeBtn.IsSelected = true; + mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor); } else { @@ -728,6 +721,7 @@ modeBtn.IsSelected = false; fanModeBtn.IsSelected = false; FanSwingModeBtn.IsSelected = false; + mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); } } @@ -939,7 +933,7 @@ Width = Application.GetRealWidth(modeItem_Width - modeItem_X), Height = Application.GetRealHeight(modeItem_Height), TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextID = R.MyInternationalizationString.SelectFanMode, + TextID = R.MyInternationalizationString.SelectMode, TextAlignment = TextAlignment.CenterLeft }; changeModeFL.AddChidren(changeModeBtn); @@ -1420,8 +1414,6 @@ } #endregion - - #region 鈼� 鎺у埗鍙嶉_________________________ -- Gitblit v1.8.0