From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28

---
 ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs |  111 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 79 insertions(+), 32 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
index 9eeb775..36efb69 100644
--- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
@@ -13,7 +13,7 @@
         /// <summary>
         /// The action.
         /// </summary>
-        public Action action;
+        public Action<DeviceUI, Common.Room> action;
 
         /// <summary>
         /// 鏀惰棌鎸夐挳
@@ -237,14 +237,6 @@
                                         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;
                                 }
                             }
                         }
@@ -362,8 +354,8 @@
         public override void RemoveFromParent()
         {
             ZigBee.Device.ZbGateway.StatusList.Remove(this);
-            //action();
-            //action = null;
+            action(device, room);
+            action = null;
             RemoveUpdateControlDeviceStatuAction();
             HomePage.Instance.ScrollEnabled = true;
             if (IsDrawerLockMode)
@@ -413,8 +405,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName)==false)
             {
                 collectionBtn.IsSelected = false;
             }
@@ -501,7 +492,7 @@
                 Width = Application.GetRealWidth(600),
                 Height = Application.GetRealHeight(60),
                 Gravity = Gravity.CenterHorizontal,
-                Text = device.CommonDevice.DeviceEpointName,
+                Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice),
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 TextSize = 15,
                 IsBold=true
@@ -520,18 +511,27 @@
             };
             itemView.AddChidren(indoorTemperatureBtn);
 
-            mArcScaleSeekBar = new ArcScaleSeekBar
+            var mArcScaleSeekBarFL = new FrameLayout
             {
                 Y = Application.GetRealHeight(412),
-                Width = Application.GetRealWidth(671),
-                Height = Application.GetRealHeight(671),
+                Width = Application.GetMinRealAverage(671),
+                Height = Application.GetMinRealAverage(671),
+                Gravity = Gravity.CenterHorizontal
+            };
+            itemView.AddChidren(mArcScaleSeekBarFL);
+
+            mArcScaleSeekBar = new ArcScaleSeekBar
+            {
+                Width = Application.GetMinRealAverage(671),
+                Height = Application.GetMinRealAverage(671),
                 Gravity = Gravity.CenterHorizontal,
                 MinValue = ACControlBase.Temperature_Low,
                 MaxValue = ACControlBase.Temperature_High,
                 Progress = ACControlBase.GetCurrentModeTemperature(ac),
-                IsClickable = ACControlBase.IsOpen(ac)
+                IsClickable = ACControlBase.IsOpen(ac),
+                ProgressBarUnitSring = string.Empty
             };
-            itemView.AddChidren(mArcScaleSeekBar);
+            mArcScaleSeekBarFL.AddChidren(mArcScaleSeekBar);
             if(ACControlBase.IsOpen(ac))
             {
                 mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor);
@@ -561,35 +561,47 @@
 
             currentModeBtn = new Button()
             {
-                Y = Application.GetRealHeight(565),
-                Height = Application.GetRealHeight(80),
+                Y = Application.GetMinRealAverage(187),
+                Height = Application.GetRealHeight(50),
                 Width = Application.GetRealWidth(200),
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 Gravity = Gravity.CenterHorizontal,
                 Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode),
-                TextSize=12
+                TextSize = 12
             };
-            itemView.AddChidren(currentModeBtn);
+            mArcScaleSeekBarFL.AddChidren(currentModeBtn);
 
             reduceTemperatureBtn = new Button()
             {
-                X = Application.GetRealWidth(268),
-                Y = Application.GetRealHeight(650),
+                X = Application.GetMinRealAverage(132),
+                Y = Application.GetMinRealAverage(268),
                 Width = Application.GetMinRealAverage(80),
                 Height = Application.GetMinRealAverage(80),
                 UnSelectedImagePath = "AC/Reduce.png"
             };
-            itemView.AddChidren(reduceTemperatureBtn);
+            mArcScaleSeekBarFL.AddChidren(reduceTemperatureBtn);
 
             addTemperatureBtn = new Button()
             {
-                X = Application.GetRealWidth(610),
-                Y = Application.GetRealHeight(650),
+                X = Application.GetMinRealAverage(452),
+                Y = Application.GetMinRealAverage(268),
                 Width = Application.GetMinRealAverage(80),
                 Height = Application.GetMinRealAverage(80),
                 UnSelectedImagePath = "AC/Add.png"
             };
-            itemView.AddChidren(addTemperatureBtn);
+            mArcScaleSeekBarFL.AddChidren(addTemperatureBtn);
+
+            var uintBtn = new Button
+            {
+                Y = Application.GetMinRealAverage(369),
+                Height = Application.GetRealHeight(60),
+                Width = Application.GetRealWidth(100),
+                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                Gravity = Gravity.CenterHorizontal,
+                Text = "鈩�",
+                TextSize = 18
+            };
+            mArcScaleSeekBarFL.AddChidren(uintBtn);
 
             FanSwingModeBtn = new Button()
             {
@@ -601,7 +613,6 @@
                 SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode),
                 IsSelected = ACControlBase.IsOpen(ac)
             };
-            itemView.AddChidren(FanSwingModeBtn);
 
             modeBtn = new Button()
             {
@@ -638,6 +649,18 @@
                 IsSelected = ACControlBase.IsOpen(ac)
             };
             itemView.AddChidren(fanModeBtn);
+
+            if (ac.UseSwingFunction)
+            {
+                itemView.AddChidren(FanSwingModeBtn);
+            }
+            else
+            {
+                modeBtn.X = Application.GetRealWidth(207);
+                switchBtn.X = Application.GetRealWidth(444);
+                fanModeBtn.X = Application.GetRealWidth(677);
+            }
+
 
             var roomBG = new Button
             {
@@ -881,6 +904,12 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void ShowChangeMode_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
         {
+            if (HadSupportModel() == false)
+            {
+                CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.AC_Model_None));
+                return;
+            }
+
             int modeItem_X = 80;
             int modeItem_Height = 150;
             int modeItem_Width = 449;
@@ -1058,6 +1087,24 @@
             ac.currentSystemMode = (int)acMode;
             mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
             ac.SetSystemModeAsync(acMode);
+        }
+
+        /// <summary>
+        /// 鏄惁閰嶇疆浜嗘ā寮�
+        /// </summary>
+        /// <returns></returns>
+        private bool HadSupportModel()
+        {
+            bool hadMode = false;
+            foreach (var m in ac.listSupportMode)
+            {
+                if (m == 1)
+                {
+                    hadMode = true;
+                    break;
+                }
+            }
+            return hadMode;
         }
 
         #endregion
@@ -1393,9 +1440,9 @@
             UserView.HomePage.Instance.AddChidren(detailInfo);
             UserView.HomePage.Instance.PageIndex += 1;
             detailInfo.Show(device, room);
-            detailInfo.action = () =>
+            detailInfo.EditAction += (curDev, curRoom) =>
             {
-                Show(device, room);
+                Show(curDev, curRoom);
             };
         }
 

--
Gitblit v1.8.0