From 94e4e5b9fd3da964c44b7b14227d6fe2bbb426d7 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 13:56:39 +0800
Subject: [PATCH] 2020-04-02-2

---
 ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs |  480 +++++++++++++++++++++++++++---------------------------------
 1 files changed, 216 insertions(+), 264 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
index 0ba99c3..04908bc 100755
--- 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<CommonDevice, Common.Room> action;
 
         /// <summary>
         /// 鏀惰棌鎸夐挳
@@ -22,7 +22,7 @@
         /// <summary>
         /// 浼犺繃鏉ョ殑璁惧
         /// </summary>
-        private DeviceUI device;
+        private CommonDevice device;
         /// <summary>
         /// 浼犺繃鏉ョ殑鎴块棿
         /// </summary>
@@ -125,15 +125,7 @@
         #endregion
 
         #region 鈼� 鎺ュ彛___________________________
-        /// <summary>
-        /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange()
-        /// </summary>
-        /// <returns>The changed.</returns>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
 
-        }
         /// <summary>
         /// 璁惧鐘舵�佹洿鏂版帴鍙�
         /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para>
@@ -153,11 +145,11 @@
                     try
                     {
                         var deviceUI = device;
-                        if (deviceUI.CommonDevice == null)
+                        if (deviceUI == null)
                         {
                             return;
                         }
-                        if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
+                        if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr)
                         {
                             return;
                         }
@@ -169,20 +161,18 @@
                             {
                                 return;
                             }
-                            deviceUI.CommonDevice.DeviceStatusReport = common.DeviceStatusReport;
+                            deviceUI.DeviceStatusReport = common.DeviceStatusReport;
                             foreach(var attList in attriButeList)
                             {
-                                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.currentLocalTemperature = attList.AttriButeData / 100;
                                         ac.LastDateTime = DateTime.Now;
                                         indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} 鈩�";
-                                        //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} 鈩�";
                                         break;
                                     case 17:
-                                        ac.currentCoolingSetpoint = curTemp;
+                                        ac.currentCoolingSetpoint = attList.AttriButeData / 100;
                                         if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
                                         {
                                             mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
@@ -190,7 +180,7 @@
                                         ac.LastDateTime = DateTime.Now;
                                         break;
                                     case 18:
-                                        ac.currentHeatingSetpoint = curTemp;
+                                        ac.currentHeatingSetpoint = attList.AttriButeData / 100;
                                         if (ac.currentSystemMode == 4)
                                         {
                                             mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
@@ -198,7 +188,7 @@
                                         ac.LastDateTime = DateTime.Now;
                                         break;
                                     case 4096:
-                                        ac.currentAutoSetpoint = curTemp;
+                                        ac.currentAutoSetpoint = attList.AttriButeData / 100;
                                         if (ac.currentSystemMode == 1)
                                         {
                                             mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
@@ -217,6 +207,8 @@
                                             fanModeBtn.IsSelected = false;
                                             FanSwingModeBtn.IsSelected = false;
                                             mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
+                                            //濡傛灉鏄叧闂┖璋冪殑璇�,鐩存帴鍙樻殫鍗冲彲
+                                            return;
                                         }
                                         else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8)
                                         {
@@ -236,14 +228,6 @@
                                         //杩囪檻缃戞竻娲楁爣蹇�: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;
                                 }
                             }
@@ -299,16 +283,16 @@
                     {
                         var deviceUI = device;
                         //璁惧涓虹┖
-                        if (deviceUI.CommonDevice == null)
+                        if (deviceUI == null)
                         {
                             return;
                         }
                         //鏄惁涓哄綋鍓嶈澶�
-                        if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
+                        if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr)
                         {
                             return;
                         }
-                        if (deviceUI.CommonDevice.Type == DeviceType.Thermostat)
+                        if (deviceUI.Type == DeviceType.Thermostat)
                         {
                             ac.IsOnline = common.IsOnline;
                             ac.LastDateTime = DateTime.Now;
@@ -321,22 +305,7 @@
                 });
             }
         }
-        /// <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();
-        }
+
         #endregion
 
         #region 鈼� 鏋勯�犳柟娉昣_______________________
@@ -362,8 +331,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)
@@ -382,12 +351,12 @@
         /// </summary>
         /// <param name="dev">Device.</param>
         /// <param name="room">Room.</param>
-        public void Show(DeviceUI dev, Shared.Common.Room room)
+        public void Show(CommonDevice dev, Shared.Common.Room room)
         {
             device = dev;
-            zbGateway = this.device.CommonDevice.Gateway;
+            zbGateway = this.device.Gateway;
             this.room = room;
-            this.ac = device.CommonDevice as ZigBee.Device.AC;
+            this.ac = device as ZigBee.Device.AC;
             AddTop();
 
             AddBodyView(device);
@@ -401,7 +370,7 @@
                 //鍙戦�佽鍙栫姸鎬佸懡浠�
                 UserView.UserHomeView.ReadStatus(ac, () =>
                 {
-                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice);
+                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(device);
                 });
             }
             else
@@ -409,12 +378,11 @@
                 //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵��
                 if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                 {
-                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice);
+                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(device);
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if (UserCenter.HdlRoomLogic.Current.IsCollectInRoom(device)==false)
             {
                 collectionBtn.IsSelected = false;
             }
@@ -458,7 +426,7 @@
         /// <summary>
         /// AddBodyView
         /// </summary>
-        public void AddBodyView(DeviceUI device)
+        public void AddBodyView(CommonDevice device)
         {
             bodyFrameLayout = new FrameLayout()
             {
@@ -501,9 +469,10 @@
                 Width = Application.GetRealWidth(600),
                 Height = Application.GetRealHeight(60),
                 Gravity = Gravity.CenterHorizontal,
-                Text = device.CommonDevice.DeviceEpointName,
+                Text = Common.LocalDevice.Current.GetDeviceEpointName(device),
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
-                TextSize = 15
+                TextSize = 15,
+                IsBold=true
             };
             itemView.AddChidren(deviceNameBtn);
 
@@ -514,22 +483,32 @@
                 Height = Application.GetRealHeight(60),
                 Gravity = Gravity.CenterHorizontal,
                 TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} 鈩�"
+                Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} 鈩�",
+                TextSize=10
             };
             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);
@@ -559,34 +538,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)
+                Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode),
+                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()
             {
@@ -598,7 +590,6 @@
                 SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode),
                 IsSelected = ACControlBase.IsOpen(ac)
             };
-            itemView.AddChidren(FanSwingModeBtn);
 
             modeBtn = new Button()
             {
@@ -636,6 +627,18 @@
             };
             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
             {
                 Y = Application.GetRealHeight(1322 - 50),
@@ -671,7 +674,8 @@
                 Height = Application.GetRealHeight(50),
                 Text = room.Name,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.GXCTextWhiteColor
+                TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
+                TextSize=12
             };
             itemView.AddChidren(roomName);
         }
@@ -759,14 +763,14 @@
             };
             closeBGview.AddChidren(changeFanModeBG);
 
-            var changeFanModeFL = new FrameLayout()
+            var changeFanModeFL = new VerticalScrolViewLayout()
             {
                 X = Application.GetRealWidth(600),
                 Y = Application.GetRealHeight(750),
                 Height = Application.GetRealHeight(600),
                 Width = Application.GetRealWidth(fanItem_Width),
-                Radius = CommonPage.BigFormRadius,
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+                ScrollEnabled=false,
+                VerticalScrollBarEnabled=false
             };
             closeBGview.AddChidren(changeFanModeFL);
 
@@ -777,62 +781,47 @@
                 Height = Application.GetRealHeight(fanItem_Height),
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 TextID = R.MyInternationalizationString.SelectFanMode,
-                TextAlignment = TextAlignment.CenterLeft
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize=14,
+                IsBold=true
             };
             changeFanModeFL.AddChidren(changeFanBtn);
 
-            var fan_Low = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = changeFanBtn.Bottom,
-                Width = Application.GetRealWidth(fanItem_Width),
-                Height = Application.GetRealHeight(fanItem_Height),
-                Tag = ZigBee.Device.AC.FanMode.Low
-            };
-            changeFanModeFL.AddChidren(fan_Low);
+            var fan_Low = new LeftIconButtonRow();
+            fan_Low.Tag = ZigBee.Device.AC.FanMode.Low;
             fan_Low.Init("AC/Fan_Low.png", "AC/Fan_LowSelected.png", Language.StringByID(R.MyInternationalizationString.Fan_Low));
+            fan_Low.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_FanModel);
+            changeFanModeFL.AddChidren(fan_Low);
 
-            var fan_Middle = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = fan_Low.Bottom,
-                Width = Application.GetRealWidth(fanItem_Width),
-                Height = Application.GetRealHeight(fanItem_Height),
-                Tag = ZigBee.Device.AC.FanMode.Medium
-            };
-            changeFanModeFL.AddChidren(fan_Middle);
+            var fan_Middle = new LeftIconButtonRow();
+            fan_Middle.Tag = ZigBee.Device.AC.FanMode.Medium;
             fan_Middle.Init("AC/Fan_Middle.png", "AC/Fan_MiddleSelected.png", Language.StringByID(R.MyInternationalizationString.Fan_Middle));
+            fan_Middle.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_FanModel);
+            changeFanModeFL.AddChidren(fan_Middle);
 
-            var fan_Height = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = fan_Middle.Bottom,
-                Width = Application.GetRealWidth(fanItem_Width),
-                Height = Application.GetRealHeight(fanItem_Height),
-                Tag = ZigBee.Device.AC.FanMode.High
-            };
-            changeFanModeFL.AddChidren(fan_Height);
+            var fan_Height = new LeftIconButtonRow();
+            fan_Height.Tag = ZigBee.Device.AC.FanMode.High;
             fan_Height.Init("AC/Fan_Height.png", "AC/Fan_HeightSelected.png", Language.StringByID(R.MyInternationalizationString.Fan_Height), false);
+            fan_Height.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_FanModel);
+            changeFanModeFL.AddChidren(fan_Height);
 
-            fan_Low.TitleButton.MouseUpEventHandler += ChangeFan_MouseUpEvent;
-            fan_Low.IconButton.MouseUpEventHandler += ChangeFan_MouseUpEvent;
-
-            fan_Middle.TitleButton.MouseUpEventHandler += ChangeFan_MouseUpEvent;
-            fan_Middle.IconButton.MouseUpEventHandler += ChangeFan_MouseUpEvent;
-
-            fan_Height.TitleButton.MouseUpEventHandler += ChangeFan_MouseUpEvent;
-            fan_Height.IconButton.MouseUpEventHandler += ChangeFan_MouseUpEvent;
+            fan_Low.ButtonClickEvent += ChangeFan_MouseUpEvent;
+            fan_Middle.ButtonClickEvent += ChangeFan_MouseUpEvent;
+            fan_Height.ButtonClickEvent += ChangeFan_MouseUpEvent;
 
             if (ACControlBase.IsOpen(ac))
             {
                 if (ac.currentFanMode == 1)
                 {
-                    fan_Low.SetSelectedStatu();
+                    fan_Low.IsSelected=true;
                 }
                 else if (ac.currentFanMode == 2)
                 {
-                    fan_Middle.SetSelectedStatu();
+                    fan_Middle.IsSelected=true;
                 }
                 else
                 {
-                    fan_Height.SetSelectedStatu();
+                    fan_Height.IsSelected=true;
                 }
             }
         }
@@ -844,7 +833,7 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void ChangeFan_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
         {
-            var tag = (sender as Button).Tag.ToString();
+            var tag = (sender as LeftIconButtonRow).Tag.ToString();
             ZigBee.Device.AC.FanMode mode = ZigBee.Device.AC.FanMode.Low;
             if (tag == "Low")
             {
@@ -892,6 +881,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;
@@ -921,9 +916,8 @@
                 Y = Application.GetRealHeight(450),
                 Height = Application.GetRealHeight(900),
                 Width = Application.GetRealWidth(modeItem_Width),
-                Radius = CommonFormResouce.BigFormRadius,
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
-                //BackgroundIagePath="AC/SelectedModeBG.png"
+                ScrollEnabled = false,
+                VerticalScrollBarEnabled = false
             };
             closeBGview.AddChidren(changeModeFL);
 
@@ -934,112 +928,85 @@
                 Height = Application.GetRealHeight(modeItem_Height),
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 TextID = R.MyInternationalizationString.SelectMode,
-                TextAlignment = TextAlignment.CenterLeft
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = 14,
+                IsBold = true
             };
             changeModeFL.AddChidren(changeModeBtn);
 
-            var mode_Auto = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = changeModeBtn.Bottom,
-                Width = Application.GetRealWidth(modeItem_Width),
-                Height = Application.GetRealHeight(modeItem_Height),
-                Tag = ZigBee.Device.AC.AcMode.Auto
-            };
+            var mode_Auto = new LeftIconButtonRow();
+            mode_Auto.Tag = ZigBee.Device.AC.AcMode.Auto;
+            mode_Auto.Init("AC/Mode_Auto.png", "AC/Mode_AutoSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Auto));
+            mode_Auto.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCTextBlackColor);
             if (ac.listSupportMode[4] == 1)
             {
                 changeModeFL.AddChidren(mode_Auto);
             }
-            mode_Auto.Init("AC/Mode_Auto.png", "AC/Mode_AutoSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Auto));
 
-            var mode_Cool = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = mode_Auto.Bottom,
-                Width = Application.GetRealWidth(modeItem_Width),
-                Height = Application.GetRealHeight(modeItem_Height),
-                Tag = ZigBee.Device.AC.AcMode.Cool
-            };
+            var mode_Cool = new LeftIconButtonRow();
+            mode_Cool.Tag = ZigBee.Device.AC.AcMode.Cool;
+            mode_Cool.Init("AC/Mode_Cool.png", "AC/Mode_CoolSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Cool));
+            mode_Cool.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_Cool);
             if (ac.listSupportMode[0] == 1)
             {
                 changeModeFL.AddChidren(mode_Cool);
             }
-            mode_Cool.Init("AC/Mode_Cool.png", "AC/Mode_CoolSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Cool));
 
-            var mode_Heat = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = mode_Cool.Bottom,
-                Width = Application.GetRealWidth(modeItem_Width),
-                Height = Application.GetRealHeight(modeItem_Height),
-                Tag = ZigBee.Device.AC.AcMode.Heat
-            };
+            var mode_Heat = new LeftIconButtonRow();
+            mode_Heat.Tag = ZigBee.Device.AC.AcMode.Heat;
+            mode_Heat.Init("AC/Mode_Heat.png", "AC/Mode_HeatSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Heat));
+            mode_Heat.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_Heat);
             if (ac.listSupportMode[1] == 1)
             {
                 changeModeFL.AddChidren(mode_Heat);
             }
-            mode_Heat.Init("AC/Mode_Heat.png", "AC/Mode_HeatSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Heat));
 
-            var mode_Dry = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = mode_Heat.Bottom,
-                Width = Application.GetRealWidth(modeItem_Width),
-                Height = Application.GetRealHeight(modeItem_Height),
-                Tag = ZigBee.Device.AC.AcMode.Dry
-            };
+            var mode_Dry = new LeftIconButtonRow();
+            mode_Dry.Tag = ZigBee.Device.AC.AcMode.Dry;
+            mode_Dry.Init("AC/Mode_Dry.png", "AC/Mode_DrySelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Dry));
+            mode_Dry.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_Dry);
             if (ac.listSupportMode[3] == 1)
             {
                 changeModeFL.AddChidren(mode_Dry);
             }
-            mode_Dry.Init("AC/Mode_Dry.png", "AC/Mode_DrySelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Dry));
 
-            var mode_Fan = new CommonForm.ACLeftIconButtonRowLayout()
-            {
-                Y = mode_Dry.Bottom,
-                Width = Application.GetRealWidth(modeItem_Width),
-                Height = Application.GetRealHeight(modeItem_Height),
-                Tag = ZigBee.Device.AC.AcMode.FanOnly
-            };
+            var mode_Fan = new LeftIconButtonRow();
+            mode_Fan.Tag = ZigBee.Device.AC.AcMode.FanOnly;
+            mode_Fan.Init("AC/Mode_Fan.png", "AC/Mode_FanSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_FanOnly), false);
+            mode_Fan.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor_Fan);
             if (ac.listSupportMode[2] == 1)
             {
                 changeModeFL.AddChidren(mode_Fan);
             }
-            mode_Fan.Init("AC/Mode_Fan.png", "AC/Mode_FanSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_FanOnly), false);
 
 
-            mode_Auto.TitleButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-            mode_Auto.IconButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-
-            mode_Cool.TitleButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-            mode_Cool.IconButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-
-            mode_Heat.TitleButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-            mode_Heat.IconButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-
-            mode_Dry.TitleButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-            mode_Dry.IconButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-
-            mode_Fan.TitleButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
-            mode_Fan.IconButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
+            mode_Auto.ButtonClickEvent += ChangeMode_MouseUpEvent;
+            mode_Cool.ButtonClickEvent += ChangeMode_MouseUpEvent;
+            mode_Heat.ButtonClickEvent += ChangeMode_MouseUpEvent;
+            mode_Dry.ButtonClickEvent += ChangeMode_MouseUpEvent;
+            mode_Fan.ButtonClickEvent += ChangeMode_MouseUpEvent;
 
             if (ACControlBase.IsOpen(ac))
             {
                 if (ac.currentSystemMode == 1)
                 {
-                    mode_Auto.SetSelectedStatu();
+                    mode_Auto.IsSelected = true;
                 }
                 else if (ac.currentSystemMode == 3)
                 {
-                    mode_Cool.SetSelectedStatu();
+                    mode_Cool.IsSelected = true;
                 }
                 else if (ac.currentSystemMode == 4)
                 {
-                    mode_Heat.SetSelectedStatu();
+                    mode_Heat.IsSelected = true;
                 }
                 else if (ac.currentSystemMode == 8)
                 {
-                    mode_Dry.SetSelectedStatu();
+                    mode_Dry.IsSelected = true;
                 }
                 else if (ac.currentSystemMode == 7)
                 {
-                    mode_Fan.SetSelectedStatu();
+                    mode_Fan.IsSelected = true;
                 }
             }
         }
@@ -1051,7 +1018,7 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void ChangeMode_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
         {
-            var tag = (sender as Button).Tag.ToString();
+            var tag = (sender as LeftIconButtonRow).Tag.ToString();
             ZigBee.Device.AC.AcMode mode = ZigBee.Device.AC.AcMode.Cool;
 
             if (tag == "Auto")
@@ -1090,13 +1057,32 @@
                 ACControlBase.ShowACIsCloseTip();
                 return;
             }
-            modeBtn.IsSelected = true;
+
             modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByMode(acMode);
-            modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode);
+            modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode);
+            modeBtn.IsSelected = true;
             currentModeBtn.Text = ACControlBase.GetModeNameByMode(acMode);
             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
@@ -1134,14 +1120,14 @@
             };
             closeBGview.AddChidren(changeFanModeBG);
 
-            var changeFanModeFL = new FrameLayout()
+            var changeFanModeFL = new VerticalScrolViewLayout()
             {
                 X = Application.GetRealWidth(35),
                 Y = Application.GetRealHeight(297),
                 Height = Application.GetRealHeight(1050),
                 Width = Application.GetRealWidth(fanItem_Width),
-                Radius = CommonPage.BigFormRadius,
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+                VerticalScrollBarEnabled = false,
+                ScrollEnabled = false
             };
             closeBGview.AddChidren(changeFanModeFL);
 
@@ -1152,114 +1138,80 @@
                 Height = Application.GetRealHeight(fanItem_Height),
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 TextID = R.MyInternationalizationString.SelectSwing,
-                TextAlignment = TextAlignment.CenterLeft
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = 14,
+                IsBold = true
             };
             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);
+            var swing_First = new LeftIconButtonRow { };
+            swing_First.Tag = ZigBee.Device.AC.FanSwingMode.First;
             swing_First.Init("AC/Swing_1.png", "AC/Swing_1Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_First));
+            swing_First.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor2);
+            changeFanModeFL.AddChidren(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);
+            var swing_Second = new LeftIconButtonRow();
+            swing_Second.Tag = ZigBee.Device.AC.FanSwingMode.Second;
             swing_Second.Init("AC/Swing_2.png", "AC/Swing_2Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Second));
+            swing_Second.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor2);
+            changeFanModeFL.AddChidren(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);
+            var swing_Thrid = new LeftIconButtonRow();
+            swing_Thrid.Tag = ZigBee.Device.AC.FanSwingMode.Thrid;
             swing_Thrid.Init("AC/Swing_3.png", "AC/Swing_3Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Thrid));
+            swing_Thrid.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor2);
+            changeFanModeFL.AddChidren(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);
+            var swing_Fourth = new LeftIconButtonRow();
+            swing_Fourth.Tag = ZigBee.Device.AC.FanSwingMode.Fourth;
             swing_Fourth.Init("AC/Swing_4.png", "AC/Swing_4Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Fourth));
+            swing_Fourth.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor2);
+            changeFanModeFL.AddChidren(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);
+            var swing_Fifth = new LeftIconButtonRow();
+            swing_Fifth.Tag = ZigBee.Device.AC.FanSwingMode.Fifth;
             swing_Fifth.Init("AC/Swing_5.png", "AC/Swing_5Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Fifth));
+            swing_Fifth.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor2);
+            changeFanModeFL.AddChidren(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
-            };
+            var swing_Auto = new LeftIconButtonRow();
+            swing_Auto.Tag = ZigBee.Device.AC.FanSwingMode.Auto;
+            swing_Auto.Init("AC/Swing_Auto.png", "AC/Swing_AutoSelected.png", Language.StringByID(R.MyInternationalizationString.Swing_Auto), false);
+            swing_Auto.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor, ZigbeeColor.Current.GXCACSelectedTextColor2);
             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;
+            swing_First.ButtonClickEvent += ChangeFanSwing_MouseUpEvent;
+            swing_Second.ButtonClickEvent += ChangeFanSwing_MouseUpEvent;
+            swing_Thrid.ButtonClickEvent += ChangeFanSwing_MouseUpEvent;
+            swing_Fourth.ButtonClickEvent += ChangeFanSwing_MouseUpEvent;
+            swing_Fifth.ButtonClickEvent += ChangeFanSwing_MouseUpEvent;
+            swing_Auto.ButtonClickEvent += ChangeFanSwing_MouseUpEvent;
 
             if (ACControlBase.IsOpen(ac))
             {
                 if (ac.currentFanSwingMode == 0)
                 {
-                    swing_First.SetSelectedStatu();
+                    swing_First.IsSelected = true;
                 }
                 else if (ac.currentFanSwingMode == 1)
                 {
-                    swing_Second.SetSelectedStatu();
+                    swing_Second.IsSelected = true;
                 }
                 else if (ac.currentFanSwingMode == 2)
                 {
-                    swing_Thrid.SetSelectedStatu();
+                    swing_Thrid.IsSelected = true;
                 }
                 else if (ac.currentFanSwingMode == 3)
                 {
-                    swing_Fourth.SetSelectedStatu();
+                    swing_Fourth.IsSelected = true;
                 }
                 else if (ac.currentFanSwingMode == 4)
                 {
-                    swing_Fifth.SetSelectedStatu();
+                    swing_Fifth.IsSelected = true;
                 }
                 else if (ac.currentFanSwingMode == 7)
                 {
-                    swing_Auto.SetSelectedStatu();
+                    swing_Auto.IsSelected = true;
                 }
             }
         }
@@ -1271,7 +1223,7 @@
         /// <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();
+            var tag = (sender as LeftIconButtonRow).Tag.ToString();
             ZigBee.Device.AC.FanSwingMode mode = ZigBee.Device.AC.FanSwingMode.Auto;
             if (tag == "First")
             {
@@ -1429,7 +1381,7 @@
                 return;
             }
             var tempDevice = (CommonDevice)objValue;
-            if (tempDevice.DeviceEpoint != this.device.CommonDevice.DeviceEpoint || tempDevice.DeviceAddr != this.device.CommonDevice.DeviceAddr)
+            if (tempDevice.DeviceEpoint != this.device.DeviceEpoint || tempDevice.DeviceAddr != this.device.DeviceAddr)
             {
                 //涓嶆槸褰撳墠璁惧鐨勬帹閫侊紝鍒欎笉澶勭悊
                 return;
@@ -1466,9 +1418,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);
             };
         }
 
@@ -1485,12 +1437,12 @@
         {
             if (collectionBtn.IsSelected)
             {
-                Shared.Common.Room.Lists[0].DeleteDevice(device.FileName);
+                UserCenter.HdlRoomLogic.Current.DeleteLoveDevice(device);
                 collectionBtn.IsSelected = false;
             }
             else
             {
-                Shared.Common.Room.Lists[0].AddDevice(device.FileName);
+                UserCenter.HdlRoomLogic.Current.AddLoveDevice(device);
                 collectionBtn.IsSelected = true;
             }
         }

--
Gitblit v1.8.0