From 3dcbd186c42c598c0c08d1cd37034cf2baa09e54 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 15:47:51 +0800
Subject: [PATCH] 合并了代码

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |  274 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 187 insertions(+), 87 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 15b55a2..d2b1bfd 100755
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -195,7 +195,7 @@
                                         light.DeviceStatusReport = common.DeviceStatusReport;
                                         light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData;
                                         var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(light.OnOffStatus == 1);
+                                        row.IsSelected = light.OnOffStatus == 1;
                                         row.SetStatuText(deviceUI.GetDeviceStatu());
                                         light.LastDateTime = DateTime.Now;
                                     }
@@ -203,8 +203,6 @@
                                     {
                                         deviceUI.CommonDevice.IsOnline = 1;
                                         deviceUI.CommonDevice.LastDateTime = DateTime.Now;
-                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(true);
                                     }
                                     break;
 
@@ -216,7 +214,7 @@
                                         airSwitch.DeviceStatusReport = common.DeviceStatusReport;
                                         airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
                                         var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(airSwitch.OnOffStatus == 1);
+                                        row.IsSelected = airSwitch.OnOffStatus == 1;
                                         row.SetStatuText(deviceUI.GetDeviceStatu());
                                         airSwitch.LastDateTime = DateTime.Now;
                                     }
@@ -224,8 +222,6 @@
                                     {
                                         deviceUI.CommonDevice.IsOnline = 1;
                                         deviceUI.CommonDevice.LastDateTime = DateTime.Now;
-                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(true);
                                     }
                                     break;
                                 case DeviceType.WindowCoveringDevice:
@@ -248,6 +244,7 @@
                                             rollerShade.DeviceStatusReport = common.DeviceStatusReport;
                                             rollerShade.WcdCurrentPositionLiftPercentage = common.DeviceStatusReport.AttriBute[0].AttriButeData;
                                             row.SetStatuText($"{Language.StringByID(R.MyInternationalizationString.Current)} { deviceUI.GetDeviceStatu()}");
+                                            row.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0;
                                             rollerShade.LastDateTime = DateTime.Now;
                                         }
                                     }
@@ -255,8 +252,6 @@
                                     {
                                         deviceUI.CommonDevice.IsOnline = 1;
                                         deviceUI.CommonDevice.LastDateTime = DateTime.Now;
-                                        var row = rowLayout.GetChildren(0) as CategoryFunctionForWinRow;
-                                        row.SetStatu(true);
                                     }
                                     break;
 
@@ -307,7 +302,7 @@
                                             }
                                         }
                                         var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(ac.currentSystemMode != 0);
+                                        row.IsSelected = ac.currentSystemMode != 0;
                                         row.SetStatuText(deviceUI.GetDeviceStatu());
                                     }
 
@@ -331,7 +326,7 @@
                                             }
                                         }
                                         var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(ac.currentSystemMode != 0);
+                                        row.IsSelected = ac.currentSystemMode != 0;
                                         row.SetStatuText(deviceUI.GetDeviceStatu());
                                     }
 
@@ -340,8 +335,6 @@
                                         var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                         ac.IsOnline = 1;
                                         ac.LastDateTime = DateTime.Now;
-                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(true);
                                     }
                                     break;
                                 case DeviceType.DimmableLight:
@@ -352,7 +345,7 @@
                                         dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                         dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
                                         var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(dimmableLight.OnOffStatus == 1);
+                                        row.IsSelected = dimmableLight.OnOffStatus == 1;
                                         row.SetStatuText(deviceUI.GetDeviceStatu());
                                         dimmableLight.LastDateTime = DateTime.Now;
                                     }
@@ -362,7 +355,7 @@
                                         dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                         dimmableLight.Level = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
                                         var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(dimmableLight.OnOffStatus == 1);
+                                        row.IsSelected = dimmableLight.OnOffStatus == 1;
                                         row.SetStatuText(deviceUI.GetDeviceStatu());
                                         dimmableLight.LastDateTime = DateTime.Now;
                                     }
@@ -370,8 +363,6 @@
                                     {
                                         deviceUI.CommonDevice.IsOnline = 1;
                                         deviceUI.CommonDevice.LastDateTime = DateTime.Now;
-                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                        row.SetStatu(true);
                                     }
                                     break;
                             }
@@ -405,37 +396,66 @@
                             {
                                 case DeviceType.OnOffOutput:
                                     deviceUI.CommonDevice.IsOnline = common.IsOnline;
-                                    var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                    row.SetStatu(deviceUI.CommonDevice.IsOnline == 1);
                                     deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                     break;
 
                                 case DeviceType.AirSwitch:
                                     deviceUI.CommonDevice.IsOnline = common.IsOnline;
-                                    var row1 = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                    row1.SetStatu(deviceUI.CommonDevice.IsOnline == 1);
                                     deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                     break;
 
                                 case DeviceType.WindowCoveringDevice:
                                     deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                     deviceUI.CommonDevice.IsOnline = common.IsOnline;
-                                    var row2 = rowLayout.GetChildren(0) as CategoryFunctionForWinRow;
-                                    row2.SetStatu(deviceUI.CommonDevice.IsOnline == 1);
                                     break;
 
                                 case DeviceType.DimmableLight:
                                     deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                     deviceUI.CommonDevice.IsOnline = common.IsOnline;
-                                    var row3 = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                    row3.SetStatu(deviceUI.CommonDevice.IsOnline == 1);
                                     break;
 
                                 case DeviceType.Thermostat:
                                     deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                     deviceUI.CommonDevice.IsOnline = common.IsOnline;
-                                    var row5 = rowLayout.GetChildren(0) as CategoryFunctionRow;
-                                    row5.SetStatu(deviceUI.CommonDevice.IsOnline == 1);
+                                    break;
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        System.Console.WriteLine($"鍒嗙被璁惧鐘舵��-Error:{ex.Message}");
+                    }
+                });
+            }
+            else if (typeTag == "IASInfoReport")
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    try
+                    {
+                        for (int i = 0; deviceListScrolView != null && i < deviceListScrolView.ChildrenCount; i++)
+                        {
+                            var rowLayout = deviceListScrolView.GetChildren(i) as RowLayout;
+                            var deviceUI = rowLayout.Tag as DeviceUI;
+                            if (deviceUI == null || deviceUI.CommonDevice == null)
+                            {
+                                continue;
+                            }
+                            if (deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr || deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint)
+                            {
+                                continue;
+                            }
+                            switch (deviceUI.CommonDevice.Type)
+                            {
+                                case DeviceType.IASZone:
+                                    //寮�鍏冲姛鑳�
+                                    var ias = common as IASZone;
+                                    var iAS = deviceUI.CommonDevice as ZigBee.Device.IASZone;
+                                    iAS.iASInfo = ias.iASInfo;
+                                    var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
+                                    row.IsSelected = iAS.iASInfo?.Alarm1 == 1;
+                                    row.SetStatuText(deviceUI.GetDeviceStatu());
+                                    iAS.LastDateTime = DateTime.Now;
                                     break;
                             }
                         }
@@ -803,7 +823,7 @@
             typeIdDic.Clear();
             foreach (var device in devList)
             {
-                var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice });
+                var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice);
                 if (info.BeloneType == DeviceBeloneType.A骞叉帴鐐� || info.BeloneType == DeviceBeloneType.A涓户鍣�)
                 {
                     continue;
@@ -911,9 +931,9 @@
                 deviceListScrolView = new VerticalScrolViewLayout
                 {
                     X = Application.GetRealWidth(CommonFormResouce.X_Left),
-                    Y = Application.GetRealHeight(35+275),
+                    Y = Application.GetRealHeight(35+279),
                     Width = Application.GetRealWidth(1028),
-                    Height = Application.GetRealHeight(939),
+                    Height = Application.GetRealHeight(942),
                     BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
                 };
                 functionSceneBodyView.AddChidren(deviceListScrolView);
@@ -936,7 +956,7 @@
                     };
                     string imgPath = string.Empty;
                     string imgSeletedPath = string.Empty;
-                    Common.LocalDevice.Current.GetDeviceBeloneIcon(deviceType.Value, ref imgPath, ref imgSeletedPath);
+                    Common.LocalDevice.Current.GetDeviceObjectIcon(deviceType.Value, ref imgPath, ref imgSeletedPath);
                     functionTypeIMG.Init(imgPath, imgSeletedPath);
                     functionTypeIMG.SetTitle(deviceType.Key);
                     typeRowLayout.AddChidren(functionTypeIMG);
@@ -986,13 +1006,22 @@
                                 {
                                     if (e2)
                                     {
-                                        Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.CommonDevice);
-                                        deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
-                                        sameTypeList.Remove(deviceUI);
-                                        if (sameTypeList.Count == 0)
+                                        if(curRoom.IsLove)
                                         {
-                                            RefreshBodyView();
+                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
+                                            deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
+                                            sameTypeList.Remove(deviceUI);
                                         }
+                                        else
+                                        {
+                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.CommonDevice);
+                                            deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
+                                            sameTypeList.Remove(deviceUI);
+                                        }
+                                        //if (sameTypeList.Count == 0)
+                                        //{
+                                        //    RefreshBodyView();
+                                        //}
                                     }
                                 };
                             };
@@ -1043,9 +1072,9 @@
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                     deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                    deviceRow.SetOnLineStatu(light.IsOnline == 1);
+                                    //deviceRow.SetOnLineStatu(light.IsOnline == 1);
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
-                                    deviceRow.SetStatu(light.OnOffStatus == 1);
+                                    deviceRow.IsSelected = light.OnOffStatus == 1;
                                     deviceTypeRowLayout.AddChidren(deviceRow);
 
                                     deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
@@ -1164,8 +1193,8 @@
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                     deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                    deviceRow.SetOnLineStatu(airSwitch.IsOnline == 1);
-                                    deviceRow.SetStatu(airSwitch.OnOffStatus == 1);
+                                    //deviceRow.SetOnLineStatu(airSwitch.IsOnline == 1);
+                                    deviceRow.IsSelected = airSwitch.OnOffStatus == 1;
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceTypeRowLayout.AddChidren(deviceRow);
 
@@ -1175,8 +1204,8 @@
                                         sendedControlCommand = false;
                                         zbGateway.ReportAction += UpdateDeviceControllStatu;
                                         AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
-
                                         (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
+                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
                                         if ((send2 as Button).IsSelected)
                                         {
                                             airSwitch.SwitchControl(1);
@@ -1267,9 +1296,9 @@
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                     deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                    deviceRow.SetOnLineStatu(dimmableLight.IsOnline == 1);
+                                    //deviceRow.SetOnLineStatu(dimmableLight.IsOnline == 1);
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
-                                    deviceRow.SetStatu(dimmableLight.OnOffStatus == 1);
+                                    deviceRow.IsSelected = dimmableLight.OnOffStatus == 1;
                                     deviceTypeRowLayout.AddChidren(deviceRow);
 
                                     deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
@@ -1278,8 +1307,8 @@
                                         sendedControlCommand = false;
                                         zbGateway.ReportAction += UpdateDeviceControllStatu;
                                         AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
-
                                         (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
+                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
                                         if ((send2 as Button).IsSelected)
                                         {
                                             dimmableLight.SwitchControl(1);
@@ -1372,9 +1401,9 @@
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                     deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                    deviceRow.SetOnLineStatu(ac.IsOnline == 1);
+                                    //deviceRow.SetOnLineStatu(ac.IsOnline == 1);
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
-                                    deviceRow.SetStatu(ac.currentSystemMode != 1);
+                                    deviceRow.IsSelected = ac.currentSystemMode != 1;
                                     deviceTypeRowLayout.AddChidren(deviceRow);
 
                                     deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
@@ -1385,6 +1414,7 @@
                                         AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
 
                                         (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
+                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
                                         if ((send2 as Button).IsSelected)
                                         {
                                             ac.Open();
@@ -1476,9 +1506,9 @@
                                     var deviceRow = new CategoryFunctionForWinRow(0, 35);
                                     deviceRow.Init(deviceUI);
                                     deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                    deviceRow.SetOnLineStatu(rollerShade.IsOnline == 1);
+                                    //deviceRow.SetOnLineStatu(rollerShade.IsOnline == 1);
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
-                                    deviceRow.SetStatu(rollerShade.WcdCurrentPositionLiftPercentage != 0);
+                                    deviceRow.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0;
                                     deviceRow.SetRollerShadeIcon(rollerShade.WcdType);
                                     deviceTypeRowLayout.AddChidren(deviceRow);
 
@@ -1541,7 +1571,7 @@
                                 var deviceRow = new CategoryFunctionRow(0, 35);
                                 deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                 deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
+                                //deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
                                 deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                 deviceRow.HideSwitchBtn(true);
                                 deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1553,6 +1583,40 @@
                                     HomePage.Instance.PageIndex += 1;
                                     userDoorLockPage.Show();
                                 };
+
+                                var editBtn = new CommonForm.RowLayoutEditButton()
+                                {
+                                    Tag = deviceUI
+                                };
+                                var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
+                                {
+                                    Tag = deviceUI
+                                };
+                                if (curRoom.IsSharedRoom == false)
+                                {
+                                    deviceTypeRowLayout.AddRightView(editBtn);
+                                    editBtn.MouseUpEventHandler += deviceDetailHandler;
+                                    deviceTypeRowLayout.AddRightView(delBtn);
+                                    delBtn.MouseUpEventHandler += delEvent;
+                                }
+                            }
+                            else if (deviceUI.CommonDevice.Type == DeviceType.IASZone)
+                            {
+                                var deviceTypeRowLayout = new RowLayout()
+                                {
+                                    Height = Application.GetRealHeight(129 + 35),
+                                    LineColor = ZigbeeColor.Current.GXCBackgroundColor,
+                                    Tag = deviceUI
+                                };
+                                deviceListScrolView.AddChidren(deviceTypeRowLayout);
+
+                                var deviceRow = new CategoryFunctionRow(0, 35);
+                                deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
+                                deviceRow.IsSelected = (deviceUI.CommonDevice as IASZone).iASInfo?.Alarm1 == 1;
+                                deviceRow.HideSwitchBtn(true);
+                                deviceTypeRowLayout.AddChidren(deviceRow);
 
                                 var editBtn = new CommonForm.RowLayoutEditButton()
                                 {
@@ -1583,7 +1647,7 @@
                                 var deviceRow = new CategoryFunctionRow(0, 35);
                                 deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                 deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
+                                //deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
                                 deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                 deviceRow.HideSwitchBtn(true);
                                 deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1638,39 +1702,27 @@
             };
             functionSceneAutoBodyView.AddChidren(functionSceneBodyView);
 
-            Button curBtn = new Button();
+            RoomButton curBtn = new RoomButton(0,0);
             foreach (var room in Common.Room.CurrentRoom.GetRoomsByCurrentFloorIdAppendLoveRoom())
             {
                 var row = new FrameLayout()
                 {
-                    Width = Application.GetRealWidth(187 + 50),
+                    Width = Application.GetRealWidth(255),
                     Height = Application.GetRealHeight(167)
                 };
                 roomFL.AddChidren(row);
 
-                var roomBtn = new Button()
-                {
-                    Width = Application.GetRealWidth(187),
-                    Height = Application.GetRealHeight(78),
-                    Radius = (uint)Application.GetRealHeight(78 / 2),
-                    Gravity = Gravity.Center,
-                    Text = room.Name,
-                    TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                    SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                    BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor3,
-                    SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor,
-                    BorderColor = ZigbeeColor.Current.GXCBorderUnSelectedColor,
-                    BorderWidth = 1
-                };
+                RoomButton roomBtn = new RoomButton(0, 0);
+                roomBtn.Gravity = Gravity.Center;
+                roomBtn.Init();
+                roomBtn.SetTitle(room.Name);
                 row.AddChidren(roomBtn);
-                roomBtn.SetViewShadow(true,5);
 
                 if (room.IsLove)
                 {
                     roomBtn.IsSelected = true;
                     this.curRoom = room;
                     curBtn = roomBtn;
-
                     if(sceneBtn.IsSelected)
                     {
                         RefreshScene(room);
@@ -1679,17 +1731,16 @@
                     {
                         RefreshFunction(room);
                     }
-
                 }
-                roomBtn.MouseUpEventHandler += (sender, e) =>
+                roomBtn.ButtonClickEvent += (sender, e) =>
                 {
-                    if ((sender as Button) == curBtn)
+                    if (sender  == curBtn)
                     {
                         return;
                     }
-                    (sender as Button).IsSelected = true;
+                    sender.IsSelected = true;
                     curBtn.IsSelected = false;
-                    curBtn = sender as Button;
+                    curBtn = sender;
                     this.curRoom = room;
                     if (sceneBtn.IsSelected)
                     {
@@ -1720,8 +1771,8 @@
         /// <param name="room"></param>
         public void RefreshScene(Common.Room room)
         {
+            RefreshData(room);
             functionSceneBodyView.RemoveAll();
-            var sceneList = room.SceneUIList;
             if (sceneList.Count == 0)
             {
                 ShowNoSceneTip();
@@ -1844,8 +1895,7 @@
         /// </summary>
         private  void ShowAutotion()
         {
-
-            functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            
             var bjFrameLayout = new FrameLayout
             {
@@ -1906,14 +1956,13 @@
             var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout
             {
                 Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                //BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,/
                 X = Application.GetRealWidth(58),
-                //Radius = (uint)Application.GetRealHeight(50),
                 Y = scenehorizontalScrol.Bottom,
             };
             functionSceneAutoBodyView.AddChidren(logicScrolView);
             logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
-
+            bool no = false;
             recommendswitchBtn.MouseUpEventHandler += (sender, e) =>
             {
                 int Yheight = 0;
@@ -1921,6 +1970,7 @@
                 scenehorizontalScrol.RemoveAll();
                 if (recommendswitchBtn.IsSelected)
                 {
+                    no = true;
                     scenehorizontalScrol.Height = Application.GetRealHeight(246);
                     Yheight = 20;
                     for (int i = 1; i < 4; i++)
@@ -1996,30 +2046,31 @@
                 }
                 else
                 {
+                    no = false;
                     scenehorizontalScrol.Height = Application.GetRealHeight(0);
                     Yheight = 0;
                 }
                 logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                 logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
-                Automationview(logicScrolView);
+                Automationview(logicScrolView,no);
             };
             logicScrolView.BeginHeaderRefreshingAction += () =>
             {
                 //閲嶆柊鍒锋柊logic鍒楄〃
                 Common.Logic.LogicList.Clear();
-                Read(logicScrolView);
+                Read(logicScrolView,no);
                 //鍏抽棴鍒锋柊View锛�
                 logicScrolView.EndHeaderRefreshing();
             };
            
-            Read(logicScrolView);
+            Read(logicScrolView,no);
 
         }
         /// <summary>
         /// 璇诲彇鑷姩鍖栧垪琛ㄦ暟鎹紱
         /// </summary>
         /// <param name="logicScrolView"></param>
-        private async void Read(VerticalRefreshLayout logicScrolView)
+        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
         {
             CommonPage.Loading.Start();
             if (Common.Logic.LogicList.Count == 0)
@@ -2041,17 +2092,66 @@
                 }
             }
             //鑷姩鍖�
-            Automationview(logicScrolView);
+            Automationview(logicScrolView,no);
             CommonPage.Loading.Hide();
-
         }
         /// <summary>
         /// 鍔犺浇鑷姩鍖栧垪琛ㄧ晫闈�
         /// </summary>
         /// <param name="refresview">Refresview.</param>
-        private async void Automationview(VerticalRefreshLayout refresview)
+        private async void Automationview(VerticalRefreshLayout refresview,bool no)
         {
             refresview.RemoveAll();
+            if (Common.Logic.LogicList.Count == 0&&no==false)
+            {
+                //灏辨槸涓轰簡鏄剧ず寮曞娣诲姞鍥炬爣;
+                refresview.BackgroundColor = 0x00000000;
+                var noFrameLayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(434+ 200+32+160),
+                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                };
+                refresview.AddChidren(noFrameLayout);
+
+
+                var noIconBtn = new Button
+                {
+                    Y=Application.GetRealHeight(160),
+                    Width = Application.GetMinRealAverage(756),
+                    Height = Application.GetMinRealAverage(434),
+                    UnSelectedImagePath = "Item/NoFunction.png",
+                    X = Application.GetRealWidth(104),
+                };
+                noFrameLayout.AddChidren(noIconBtn);
+
+                var noTextBtn = new Button()
+                {
+                    Y = noIconBtn.Bottom,
+                    Height = Application.GetRealHeight(200)+Application.GetRealHeight(32),
+                    Width = Application.GetRealWidth(700),
+                    //Gravity = Gravity.CenterHorizontal,
+                    Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"),
+                    TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
+                    TextAlignment = TextAlignment.Center,
+                    IsMoreLines = true,
+                    X = Application.GetRealWidth(190-58),
+                };
+                noFrameLayout.AddChidren(noTextBtn);
+
+            }
+            else
+            {
+
+                if (Common.Logic.LogicList.Count == 0 && no == true)
+                {
+                    ///鏀瑰彉婊戝姩view鐨勯鑹诧紱
+                    refresview.BackgroundColor = 0x00000000;
+                }
+                else
+                {
+                    refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+                }
+            }
             foreach (var logic in Common.Logic.LogicList)
             {
 
@@ -2136,7 +2236,7 @@
                     var logicCommunalPage = new Logic.LogicCommunalPage();
                     HomePage.Instance.AddChidren(logicCommunalPage);
                     HomePage.Instance.PageIndex += 1;
-                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview); });
+                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); });
 
                 };
 
@@ -2158,7 +2258,7 @@
                         if (e1)
                         {
                             Common.Logic.LogicList.Remove(logic);
-                            Automationview(refresview);
+                            Automationview(refresview,no);
                             Logic.Send.DelLogic(logic.LogicId);
                         }
                     };

--
Gitblit v1.8.0