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/Category/CategoryAddScene.cs | 1379 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 1,158 insertions(+), 221 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs
index a4366b0..0fdeede 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs
@@ -4,6 +4,7 @@
 using Shared.Common;
 using Shared.Phone.Device.CommonForm;
 using Shared.Phone.Device.Room;
+using Shared.Phone.UserCenter;
 using static ZigBee.Device.Scene;
 
 namespace Shared.Phone.Device.Category
@@ -36,7 +37,7 @@
         /// </summary>
         private string ImagePath="SceneIcon/1.png";
         /// <summary>
-        /// 鍥剧墖鏉ユ簮 0--鏈湴鍥惧簱 1--鎷嶇収 2--绯荤粺鍥惧簱 
+        /// 鍥剧墖鏉ユ簮 0--鏈湴鍥惧簱 1--鎷嶇収 2--绯荤粺鍥惧簱
         /// </summary>
         public int IconPathType = 0;
         /// <summary>
@@ -50,11 +51,16 @@
         /// <summary>
         /// 娣诲姞鐩爣鍚庣殑灞曠ず鍒楄〃
         /// </summary>
-        public VerticalScrolViewLayout TargetListScrolView;
+        public FrameLayout TargetListScrolView;
         /// <summary>
         /// The confirm button.
         /// </summary>
         private CommonForm.CompleteButton confirmBtn;
+
+        /// <summary>
+        /// backGround
+        /// </summary>
+        private ImageView backGround;
 
         /// <summary>
         /// 鏄惁淇敼
@@ -73,6 +79,27 @@
         /// </summary>
         public Common.Room modifyRoom;
 
+        /// <summary>
+        /// OldBackgroundImagePath
+        /// </summary>
+        private string OldBackgroundImagePath;
+        /// <summary>
+        /// OldIconPathType
+        /// </summary>
+        public int OldIconPathType;
+
+        /// <summary>
+        /// selectedTimeAction
+        /// </summary>
+        private Action<SceneTargetDeviceUI> selectedAction;
+        /// <summary>
+        /// 淇敼鍦烘櫙action
+        /// </summary>
+        public Action<SceneUI, Common.Room> EditorAction;
+        /// <summary>
+        /// 娣诲姞鍦烘櫙action
+        /// </summary>
+        public Action AddAction;
 
         #endregion
 
@@ -88,7 +115,7 @@
         /// </summary>
         public override void RemoveFromParent()
         {
-            Category.instance?.RefreshBodyView();
+            UserView.HomePage.Instance.ScrollEnabled = true;
             base.RemoveFromParent();
         }
         /// <summary>
@@ -96,17 +123,34 @@
         /// </summary>
         public void RefreshTargetListView()
         {
+            UserView.HomePage.Instance.ScrollEnabled = false;
             TargetListScrolView.RemoveAll();
+            TargetListScrolView.Height = Application.GetRealHeight(173);
+            var TargetListScrolBackView = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(173),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            TargetListScrolView.AddChidren(TargetListScrolBackView);
 
             if (sceneTargetDevicesList.Count > 0)
             {
-                foreach (var targetDevice in sceneTargetDevicesList)
+                if (sceneTargetDevicesList.Count > 1)
                 {
+                    TargetListScrolView.Height = Application.GetRealHeight(140 * sceneTargetDevicesList.Count) + Application.GetRealHeight(200);
+                    TargetListScrolBackView.Height = Application.GetRealHeight(140 * sceneTargetDevicesList.Count + 13);
+                }
+
+                for (int i = 0; i < sceneTargetDevicesList.Count; i++)
+                {
+                    var targetDevice = sceneTargetDevicesList[i];
                     var targetRowLayout = new RowLayout()
                     {
-                        Height = Application.GetRealHeight(160),
-                        LineColor = ZigbeeColor.Current.GXCBackgroundColor,
-                        BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+                        Y = Application.GetRealHeight(i * 140),
+                        Height = Application.GetRealHeight(140),
+                        LineColor = ZigbeeColor.Current.GXCClearColor,
+                        BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+                        SubViewWidth = Application.GetRealWidth(184)
                     };
                     TargetListScrolView.AddChidren(targetRowLayout);
                     string devImgPath = string.Empty;
@@ -115,61 +159,55 @@
                     {
                         if (targetDevice.DeviceUI == null || targetDevice.DeviceUI.CommonDevice == null) continue;
                         devImgPath = targetDevice.DeviceUI.IconPath;
-                        devNameText = targetDevice.DeviceUI.CommonDevice.DeviceEpointName;
+                        devNameText = Common.LocalDevice.Current.GetDeviceEpointName(targetDevice.DeviceUI.CommonDevice);
 
-                        var targetRow = new SceneTargetFunctionRow(23);
-                        targetRowLayout.AddChidren(targetRow);
+                        var targetRow = new SceneTargetFunctionRow(13);
                         targetRow.Init();
                         targetRow.SetIcon(devImgPath);
                         targetRow.SetNameText(devNameText);
                         targetRow.SetZoneText(targetDevice.DeviceUI.GetZone());
                         targetRow.SetStatuText(targetDevice.GetDeviceStatu());
+                        targetRowLayout.AddChidren(targetRow);
+                        if (i == sceneTargetDevicesList.Count - 1)
+                        {
+                            targetRow.HideLine(true);
+                        }
                     }
                     else if (targetDevice.Type == 2)
                     {
-                        if(targetDevice.DelayTime<60)
-                        {
-                            devNameText = $"{targetDevice.DelayTime} {Language.StringByID(R.MyInternationalizationString.Second)}";
-                        }
-                        else
-                        {
-                            devNameText = $"{targetDevice.DelayTime / 60} {Language.StringByID(R.MyInternationalizationString.Minute)} {targetDevice.DelayTime % 60} {Language.StringByID(R.MyInternationalizationString.Second)}";
-                        }
+                        devNameText = CommonFormResouce.GetTimeString(targetDevice.DelayTime);
                         devNameText += Language.StringByID(R.MyInternationalizationString.Later);
-                        var targetRow = new SceneTargetTimeRow(23);
-                        targetRowLayout.AddChidren(targetRow);
+                        var targetRow = new SceneTargetTimeRow(13);
                         targetRow.Init();
                         targetRow.SetTitle(devNameText);
+                        targetRowLayout.AddChidren(targetRow);
+                        if (i == sceneTargetDevicesList.Count - 1)
+                        {
+                            targetRow.HideLine(true);
+                        }
                     }
                     else if (targetDevice.Type == 1)
                     {
                         devImgPath = "Scene/SceneIcon.png";
                         devNameText = targetDevice.SceneName;
 
-                        var targetRow = new SceneTargetFunctionRow(23);
-                        targetRowLayout.AddChidren(targetRow);
+                        var targetRow = new SceneTargetFunctionRow(13);
                         targetRow.Init();
                         targetRow.SetIcon(devImgPath);
                         targetRow.SetNameText(devNameText);
                         targetRow.SetZoneText(targetDevice.SceneUI.GetZone());
+                        targetRowLayout.AddChidren(targetRow);
+                        if (i == sceneTargetDevicesList.Count - 1)
+                        {
+                            targetRow.HideLine(true);
+                        }
                     }
-                   
-                    
-                    var editBtn = new Button()
-                    {
-                        BackgroundColor = ZigbeeColor.Current.GXCEditBackGroundColor,
-                        TextID = R.MyInternationalizationString.Edit,
-                        TextColor = ZigbeeColor.Current.GXCTextWhiteColor
-                    };
+
+                    var editBtn = new RowLayoutEditButton();
                     targetRowLayout.AddRightView(editBtn);
                     //缂栬緫璁惧
                     editBtn.MouseUpEventHandler += detailMouseUpEventHandler;
-                    var delBtn = new Button()
-                    {
-                        BackgroundColor = ZigbeeColor.Current.GXCRedColor,
-                        TextID = R.MyInternationalizationString.Delete,
-                        TextColor = ZigbeeColor.Current.GXCTextWhiteColor
-                    };
+                    var delBtn = new RowLayoutDeleteButton();
                     targetRowLayout.AddRightView(delBtn);
                     //鍒犻櫎璁惧
                     delBtn.MouseUpEventHandler += (sender, e) =>
@@ -181,7 +219,6 @@
                     //璁惧璇︾粏璁剧疆鐣岄潰
                     void detailMouseUpEventHandler(object sender, MouseEventArgs e)
                     {
-                        //璁惧
                         if (targetDevice.Type == 0)
                         {
                             if (targetDevice.DeviceUI == null || targetDevice.DeviceUI.CommonDevice == null)
@@ -189,13 +226,8 @@
                                 return;
                             }
 
-                            var deviceView = new SelectDevice();
-                            UserView.HomePage.Instance.AddChidren(deviceView);
-                            UserView.HomePage.Instance.PageIndex += 1;
-                            deviceView.sceneTargetDevice = targetDevice;
-                            deviceView.deviceUI = targetDevice.DeviceUI;
-                            deviceView.Show();
-                            deviceView.selectedAction = (selectedDevice) =>
+                            ShowSelectAction(targetDevice.DeviceUI, targetDevice);
+                            selectedAction = (selectedDevice) =>
                             {
                                 var targetDeviceUI = sceneTargetDevicesList.Find((obj) => obj.SceneTargetDeviceUIID == selectedDevice.SceneTargetDeviceUIID);
                                 if (targetDeviceUI != null)
@@ -207,7 +239,6 @@
                             };
 
                         }
-                        //鏃堕棿闂撮殧
                         else if (targetDevice.Type == 2)
                         {
                             var delayTimeView = new SelectDelayTime();
@@ -226,7 +257,6 @@
                                 RefreshTargetListView();
                             };
                         }
-                        //鍦烘櫙
                         else if (targetDevice.Type == 1)
                         {
                             var sceneView = new SelectScene();
@@ -234,6 +264,7 @@
                             UserView.HomePage.Instance.PageIndex += 1;
                             sceneView.sceneTargetDevice = targetDevice;
                             sceneView.sceneUI = targetDevice.SceneUI;
+                            sceneView.currentSceneUI = modifySceneUI;
                             sceneView.Show();
                             sceneView.selectedAction = (selectedScene) =>
                             {
@@ -248,8 +279,6 @@
                             };
                         }
                     }
-
-                    
                 }
             }
         }
@@ -273,16 +302,7 @@
         /// </summary>
         private void Init()
         {
-            //foreach (var floor in Config.Instance.Home.FloorDics)
-            //{
-            //    floorIds.Add(floor.Key);
-            //    floorNames.Add(floor.Value);
-            //    if(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count>0)
-            //    {
-            //        roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key));
-            //        rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key));
-            //    }
-            //}
+
         }
 
         /// <summary>
@@ -312,13 +332,20 @@
         /// </summary>
         private void AddBodyView()
         {
-            bodyFrameLayout = new FrameLayout()
+            var bodyScrolView=new VerticalScrolViewLayout()
             {
                 Y = Application.GetRealHeight(184),
                 Height = Application.GetRealHeight(1737),
                 BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
             };
-            AddChidren(bodyFrameLayout);
+            AddChidren(bodyScrolView);
+
+            bodyFrameLayout = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(1086+127),
+                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
+            };
+            bodyScrolView.AddChidren(bodyFrameLayout);
 
             var imgFL = new FrameLayout
             {
@@ -327,21 +354,31 @@
             };
             bodyFrameLayout.AddChidren(imgFL);
 
-            var backGround = new Button()
+            var backGround1 = new ImageView()
             {
-                Width = Application.GetRealWidth(930),
-                Height = Application.GetRealHeight(464),
-                Gravity = Gravity.Center,
-                Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius),
-                //UnSelectedImagePath = ImagePath
-                UnSelectedImagePath = "SceneIcon/3.png"
+                Y = Application.GetRealHeight(46),
+                Width = Application.GetMinRealAverage(916),
+                Height = Application.GetMinRealAverage(487),
+                Gravity = Gravity.CenterHorizontal,
+                ImagePath = "Room/Room_Rectangle.png"
+            };
+            imgFL.AddChidren(backGround1);
+
+            backGround = new ImageView()
+            {
+                Y = Application.GetRealHeight(46),
+                Width = Application.GetMinRealAverage(887),
+                Height = Application.GetMinRealAverage(444),
+                Gravity = Gravity.CenterHorizontal,
+                Radius = (uint)Application.GetMinRealAverage(CommonFormResouce.BigFormRadius),
+                ImagePath = "SceneIcon/3.jpg"
             };
             imgFL.AddChidren(backGround);
 
             var infoFL = new FrameLayout
             {
-                Y = imgFL.Bottom + Application.GetRealHeight(23),
-                Height = Application.GetRealHeight(418),
+                Y = Application.GetRealHeight(588),
+                Height = Application.GetRealHeight(429),
                 BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
             };
             bodyFrameLayout.AddChidren(infoFL);
@@ -354,7 +391,8 @@
                 TextID = R.MyInternationalizationString.EditInfo,
                 TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextSize = 14
+                TextSize = 15,
+                //IsBold=true
             };
             infoFL.AddChidren(infoEdit);
 
@@ -374,8 +412,8 @@
 
             var targetFL = new FrameLayout()
             {
-                Y = infoFL.Bottom + Application.GetRealHeight(23),
-                Height = Application.GetRealHeight(730)
+                Y = Application.GetRealHeight(1040),
+                Height = Application.GetRealHeight(346)
             };
             bodyFrameLayout.AddChidren(targetFL);
 
@@ -401,7 +439,8 @@
                 TextAlignment = TextAlignment.CenterLeft,
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 TextID = R.MyInternationalizationString.AddScentTargetAction,
-                Gravity = Gravity.CenterVertical
+                Gravity = Gravity.CenterVertical,
+                TextSize=15
             };
             addTargetFL.AddChidren(target);
 
@@ -423,24 +462,43 @@
             };
             addTargetFL.AddChidren(targetLine);
 
-            //娣诲姞鐩爣鍚庣殑灞曠ず鍒楄〃
-            TargetListScrolView = new VerticalScrolViewLayout()
+            TargetListScrolView = new FrameLayout()
             {
-                Y = Application.GetRealHeight(49+127),
-                Height = Application.GetRealHeight(730-127-49),
-                //BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+                Height = Application.GetRealHeight(173)
             };
-            targetFL.AddChidren(TargetListScrolView);
+            bodyScrolView.AddChidren(TargetListScrolView);
+
+
 
             confirmBtn = new CommonForm.CompleteButton(1656, 907, 127);
+            confirmBtn.TextID = R.MyInternationalizationString.Next;
             AddChidren(confirmBtn);
 
-            if(isModify)
+            if (isModify)
             {
-                backGround.UnSelectedImagePath = modifySceneUI.IconPath;
-                nameRow.SetTitle(modifySceneUI.Name);
-                zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(modifyRoom.FloorId)},{modifyRoom.Name}");
                 IconPathType = modifySceneUI.IconPathType;
+                OldIconPathType = modifySceneUI.IconPathType;
+                if (IconPathType != 0)
+                {
+                    OldBackgroundImagePath = modifySceneUI.IconPath;
+                }
+                if (modifySceneUI.IconPathType == 0)
+                {
+                    backGround.ImagePath = modifySceneUI.IconPath;
+                }
+                else
+                {
+                    backGround.ImagePath = System.IO.Path.Combine(Config.Instance.FullPath, modifySceneUI.IconPath);
+                }
+                nameRow.SetTitle(modifySceneUI.Name);
+                if (Config.Instance.Home.FloorDics.Count == 0)
+                {
+                    zoneRow.SetTitle($"{modifyRoom.Name}");
+                }
+                else
+                {
+                    zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(modifyRoom.FloorId)},{modifyRoom.Name}");
+                }
                 curRoom = modifyRoom;
                 sceneTargetDevicesList.AddRange(modifySceneTargetDevicesList);
             }
@@ -449,95 +507,9 @@
 
             #region event
 
-            //閫夋嫨鑳屾櫙鍥�
             EventHandler<MouseEventArgs> backGroundIMGHander = (sender, e) =>
             {
-                if (curRoom == null)
-                {
-                    RoomCommon.ShowTipNoRoom();
-                    return;
-                }
-                if (curRoom.IsSharedRoom)
-                {
-                    RoomCommon.ShowTipRoomIsShared();
-                    return;
-                }
-
-                var localPic = new CategorySceneSelectImgByLocal();
-                Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic);
-                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                localPic.Show();
-                localPic.action = (imgPath) =>
-                {
-                    IconPathType = 0;
-                    backGround.UnSelectedImagePath = imgPath;
-                };
-
-            };
-            backGround.MouseUpEventHandler += backGroundIMGHander;
-
-            //鍖哄煙
-            EventHandler<MouseEventArgs> zoneHander = (sender, e) =>
-            {
-                List<string> floorIds = new List<string> { };
-                List<string> floorNames = new List<string> { };
-                List<List<string>> roomNames = new List<List<string>> { };
-                List<List<Common.Room>> rooms = new List<List<Common.Room>> { };
-                List<Common.Room> rs = new List<Common.Room> { };
-                List<string> rNames = new List<string> { };
-                if (Config.Instance.Home.FloorDics.Count > 0)
-                {
-                    foreach (var floor in Config.Instance.Home.FloorDics)
-                    {
-                        floorIds.Add(floor.Key);
-                        floorNames.Add(floor.Value);
-                        if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0)
-                        {
-                            roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key));
-                            rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key));
-                        }
-                    }
-                    PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) =>
-                    {
-                        curRoom = rooms[index1][index2];
-                        zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(floorIds[index1])} , {rooms[index1][index2].Name}");
-                    }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongFloor),
-                   Language.StringByID(R.MyInternationalizationString.Confrim),
-                   Language.StringByID(R.MyInternationalizationString.Cancel));
-                }
-                else
-                {
-                    for (int i = 0; i < Common.Room.Lists.Count; i++)
-                    {
-                        var r = Common.Room.Lists[i];
-                        if (r.IsLove)
-                        {
-                            continue;
-                        }
-                        rs.Add(r);
-                        rNames.Add(r.Name);
-                    }
-                    PickerView.Show(rNames, (index1) =>
-                    {
-                        curRoom = rs[index1];
-                        zoneRow.SetTitle(rs[index1].Name);
-                    }, 0, Language.StringByID(R.MyInternationalizationString.BelongFloor),
-                   Language.StringByID(R.MyInternationalizationString.Confrim),
-                   Language.StringByID(R.MyInternationalizationString.Cancel));
-                }
-            };
-            zoneRow.ClickBtn.MouseUpEventHandler += zoneHander;
-
-            //鎵ц鐩爣-娣诲姞鎵ц璁惧
-            EventHandler<MouseEventArgs> targetAddHander = (sender, e) =>
-            {
-
-                if (curRoom == null)
-                {
-                    RoomCommon.ShowTipNoRoom();
-                    return;
-                }
-                if (curRoom.IsSharedRoom)
+                if (curRoom != null && curRoom.IsSharedRoom)
                 {
                     RoomCommon.ShowTipRoomIsShared();
                     return;
@@ -556,24 +528,217 @@
                     Y = Application.GetRealHeight(1276),
                     Height = Application.GetRealHeight(450),
                     Width = Application.GetRealWidth(selectRow_Width),
-                    Gravity=Gravity.CenterHorizontal,
-                    Radius = (uint)Application.GetRealHeight(17),
+                    Gravity = Gravity.CenterHorizontal,
+                    Radius = (uint)Application.GetRealHeight(35),
                     BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor
                 };
                 selectFL.AddChidren(itemFL);
+                //itemFL.Animate = Animate.DownToUp;
+
+                var selectLocalPicture = new Button()
+                {
+                    Height = Application.GetRealHeight(selectRow_Height) - 1,
+                    TextID = R.MyInternationalizationString.LocalPicture,
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    TextSize=17
+                };
+                itemFL.AddChidren(selectLocalPicture);
+                var selectLocalLine = new Button()
+                {
+                    Y = selectLocalPicture.Bottom,
+                    Height = 1,
+                    BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+                };
+                itemFL.AddChidren(selectLocalLine);
+
+                var selectPhotographBtn = new Button()
+                {
+                    Y = selectLocalLine.Bottom,
+                    Height = Application.GetRealHeight(selectRow_Height) - 1,
+                    TextID = R.MyInternationalizationString.Photograph,
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    TextSize=17
+                };
+                itemFL.AddChidren(selectPhotographBtn);
+                var selectPhotographLine = new Button()
+                {
+                    Y = selectPhotographBtn.Bottom,
+                    Height = 1,
+                    BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2,
+                };
+                itemFL.AddChidren(selectPhotographLine);
+
+                var selectAblumsBtn = new Button()
+                {
+                    Y = selectPhotographLine.Bottom,
+                    Height = Application.GetRealHeight(selectRow_Height) - 1,
+                    TextID = R.MyInternationalizationString.MyAblums,
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    TextSize=17
+                };
+                itemFL.AddChidren(selectAblumsBtn);
+
+                var cancelBtn = new Button()
+                {
+                    Y = Application.GetRealHeight(1742),
+                    Height = Application.GetRealHeight(selectRow_Height),
+                    Width = Application.GetRealWidth(selectRow_Width),
+                    Gravity = Gravity.CenterHorizontal,
+                    TextID = R.MyInternationalizationString.Cancel,
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor,
+                    Radius = (uint)Application.GetRealHeight(35),
+                    TextSize=17
+                };
+                selectFL.AddChidren(cancelBtn);
+
+                selectLocalPicture.MouseUpEventHandler += (send, ee) =>
+                {
+                    selectFL.RemoveFromParent();
+                    var localPic = new CategorySceneSelectImgByLocal();
+                    Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic);
+                    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                    localPic.Show();
+                    localPic.action = (imgPath) =>
+                    {
+                        IconPathType = 0;
+                        backGround.ImageBytes = null;
+                        backGround.ImagePath = imgPath;
+                    };
+                };
+                selectPhotographBtn.MouseUpEventHandler += (send, ee) =>
+                {
+                    selectFL.RemoveFromParent();
+                    var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                    var fileName = $"SceneIcon_{tradeTime}.png";
+                    //閫氳繃鐩告満鎷嶇収瑁佸壀
+                    CropImage.TakePicture((imagePath) =>
+                    {
+                        if (string.IsNullOrEmpty(imagePath))
+                        {
+                            return;
+                        }
+                        if (isModify)
+                        {
+                            if (IconPathType != 0)
+                            {
+                                Global.DeleteFilebyHomeId(backGround.ImagePath);
+                                HdlAutoBackupLogic.DeleteFile(backGround.ImagePath);
+                            }
+                        }
+
+                        IconPathType = 1;
+                        backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
+                        backGround.ImagePath = imagePath;
+                        System.IO.File.Delete(imagePath);
+
+                    }, fileName, 2, 1);
+                };
+
+                selectAblumsBtn.MouseUpEventHandler += (send, ee) =>
+                {
+                    selectFL.RemoveFromParent();
+                    var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                    var fileName = $"SceneIcon_{tradeTime}.png";
+                    //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀
+                    CropImage.SelectPicture((imagePath) =>
+                    {
+                        if (string.IsNullOrEmpty(imagePath))
+                        {
+                            return;
+                        }
+                        if (isModify)
+                        {
+                            if (IconPathType != 0)
+                            {
+                                Global.DeleteFilebyHomeId(backGround.ImagePath);
+                                HdlAutoBackupLogic.DeleteFile(backGround.ImagePath);
+                            }
+                        }
+
+                        IconPathType = 2;
+                        backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
+                        backGround.ImagePath = imagePath;
+                        System.IO.File.Delete(imagePath);
+
+                    }, fileName, 2,1);
+                };
+
+                cancelBtn.MouseUpEventHandler += (send, ee) =>
+                {
+                    selectFL.RemoveFromParent();
+                };
+                selectFL.MouseUpEventHandler += (send, ee) =>
+                {
+                    selectFL.RemoveFromParent();
+                };
+            };
+            backGround.MouseUpEventHandler += backGroundIMGHander;
+
+            //鍖哄煙
+            EventHandler<MouseEventArgs> zoneHander = (sender, e) =>
+            {
+                var zone = new SelectZone();
+                zone.Init();
+                zone.ZoneAction += (selectRoom) =>
+                {
+                    curRoom = selectRoom;
+                    zoneRow.SetTitle(selectRoom.GetZoneName());
+                };
+            };
+            zoneRow.ClickBtn.MouseUpEventHandler += zoneHander;
+
+            //鎵ц鐩爣-娣诲姞鎵ц璁惧
+            EventHandler<MouseEventArgs> targetAddHander = (sender, e) =>
+            {
+
+                //if (curRoom == null)
+                //{
+                //    RoomCommon.ShowTipNoRoom();
+                //    return;
+                //}
+                if(curRoom != null)
+                {
+                    if (curRoom.IsSharedRoom)
+                    {
+                        RoomCommon.ShowTipRoomIsShared();
+                        return;
+                    }
+                }
+
+                int selectRow_Height = 150;
+                int selectRow_Width = 1034;
+                var selectFL = new FrameLayout()
+                {
+                    BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
+                };
+                AddChidren(selectFL);
+
+                var itemFL = new FrameLayout()
+                {
+                    Y = Application.GetRealHeight(1276),
+                    Height = Application.GetRealHeight(450),
+                    Width = Application.GetRealWidth(selectRow_Width),
+                    Gravity=Gravity.CenterHorizontal,
+                    Radius = (uint)Application.GetRealHeight(35),
+                    BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor
+                };
+                selectFL.AddChidren(itemFL);
+                //itemFL.Animate = Animate.DownToUp;
 
                 var selectedFunctionBtn = new Button()
                 {
                     Height = Application.GetRealHeight(selectRow_Height) - 1,
                     TextID = R.MyInternationalizationString.Function,
-                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    TextSize=17
                 };
                 itemFL.AddChidren(selectedFunctionBtn);
                 var selectedFunctionLine = new Button()
                 {
                     Y = selectedFunctionBtn.Bottom,
                     Height = 1,
-                    BackgroundColor = ZigbeeColor.Current.GXCLineColor
+                    BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
                 };
                 itemFL.AddChidren(selectedFunctionLine);
 
@@ -582,14 +747,15 @@
                     Y = selectedFunctionLine.Bottom,
                     Height = Application.GetRealHeight(selectRow_Height) - 1,
                     TextID = R.MyInternationalizationString.Scence,
-                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    TextSize=17
                 };
                 itemFL.AddChidren(selectedSceneBtn);
                 var selectedSceneLine = new Button()
                 {
                     Y = selectedSceneBtn.Bottom,
                     Height = 1,
-                    BackgroundColor = ZigbeeColor.Current.GXCLineColor,
+                    BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2,
                 };
                 itemFL.AddChidren(selectedSceneLine);
 
@@ -598,7 +764,8 @@
                     Y = selectedSceneLine.Bottom,
                     Height = Application.GetRealHeight(selectRow_Height) - 1,
                     TextID = R.MyInternationalizationString.Delay,
-                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4
+                    TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                    TextSize=17
                 };
                 itemFL.AddChidren(selectedTimerBtn);
 
@@ -612,7 +779,8 @@
                     TextID = R.MyInternationalizationString.Cancel,
                     TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
                     BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                    Radius = (uint)Application.GetRealHeight(17)
+                    Radius = (uint)Application.GetRealHeight(35),
+                    TextSize=17
                 };
                 selectFL.AddChidren(cancelBtn);
 
@@ -639,13 +807,14 @@
                     UserView.HomePage.Instance.AddChidren(sceneView);
                     UserView.HomePage.Instance.PageIndex += 1;
                     sceneView.beforeSceneTargetDeviceUIs = sceneTargetDevicesList;
+                    sceneView.currentSceneUI = modifySceneUI;
                     sceneView.Show();
                     sceneView.selectedAction = (selectedScene) =>
                     {
                         sceneTargetDevicesList.Add(selectedScene);
                         RefreshTargetListView();
                     };
-                    
+
                 };
                 //娣诲姞鏃堕棿闂撮殧
                 selectedTimerBtn.MouseUpEventHandler += (send, ee) =>
@@ -685,7 +854,7 @@
                 }
                 if (curRoom.IsSharedRoom)
                 {
-                    RemoveFromParent();
+                    RoomCommon.ShowTipRoomIsShared();
                     return;
                 }
 
@@ -693,51 +862,55 @@
                 {
                     if (string.IsNullOrEmpty(nameRow.NameText.Text))
                     {
-                        var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.SceneNameCannotBeNull), Language.StringByID(R.MyInternationalizationString.Close));
-                        alert.Show();
-                        alert.ResultEventHandler += (sendAlert, eAlert) =>
-                        {
-                            return;
-                        };
+                        CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.SceneNameCannotBeNull));
+                        return;
                     }
                     else
                     {
                         try
                         {
-                            //鏀瑰悕
+                            var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                            var fileName = $"SceneIcon_{tradeTime}.png";
                             if (modifySceneUI.Name != nameRow.NameText.Text.Trim())
                             {
                                 if (Common.Room.CurrentRoom.GetSameFloorScenes(curRoom.FloorId).Find(s => s.Name == nameRow.NameText.Text.Trim()) != null)
                                 {
-                                    Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneHadExist);
+                                    CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneHadExist));
                                     return;
                                 }
-                                //淇敼鍚嶅瓧
                                 var r = await ZigBee.Device.Scene.RenameSceneAsync(modifySceneUI.Id, nameRow.NameText.Text.Trim());
                                 var reName = r.sceneRenameResponseData.Result;
                                 if (reName == 0)
                                 {
-                                    //澶辫触
                                     return;
                                 }
                                 else if (reName == 1)
                                 {
-                                    //鎴愬姛
                                     modifySceneUI.Name = nameRow.NameText.Text.Trim();
 
                                 }
                                 else if (reName == 2)
                                 {
-                                    //娌℃湁璇ュ満鏅�
                                     return;
                                 }
                             }
-                            //鍥剧墖
-                            if(IconPathType==1 || IconPathType ==2)
+                            if (OldIconPathType != 0)
                             {
-
+                                Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath));
+                                HdlAutoBackupLogic.DeleteFile(OldBackgroundImagePath);
                             }
-                            
+                            if (IconPathType == 1 || IconPathType == 2)
+                            {
+                                Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
+                                HdlAutoBackupLogic.AddOrEditorFile(fileName);
+                                modifySceneUI.IconPath = fileName;
+                            }
+                            else
+                            {
+                                modifySceneUI.IconPath = backGround.ImagePath;
+                            }
+                            modifySceneUI.IconPathType = IconPathType;
+
                             CommonPage.Loading.Start();
                             var memberDataList = new List<ZigBee.Device.Scene.AddSceneMemberData>();
                             for (int i = 0; i < sceneTargetDevicesList.Count; i++)
@@ -758,7 +931,7 @@
                                         Epoint = sceneTarget.DeviceUI.CommonDevice.DeviceEpoint,
                                         TaskList = sceneTarget.TaskList,
                                         DelayTime = 0,
-                                        MemberNumber = i+1
+                                        MemberNumber = i + 1
                                     };
                                     memberDataList.Add(memberData);
                                 }
@@ -770,7 +943,7 @@
                                         ScenesId = 0,
                                         ElseScenesId = sceneTarget.ElseScenesId,
                                         DelayTime = 0,
-                                        MemberNumber = i+1
+                                        MemberNumber = i + 1
                                     };
                                     memberDataList.Add(memberData);
                                 }
@@ -781,7 +954,7 @@
                                         Type = 2,
                                         ScenesId = 0,
                                         DelayTime = sceneTarget.DelayTime,
-                                        MemberNumber = i+1
+                                        MemberNumber = i + 1
                                     };
                                     memberDataList.Add(memberData);
                                 }
@@ -822,8 +995,8 @@
                                     var removeDevice = new ZigBee.Device.Scene.RemoveSceneDeviceListInfo
                                     {
                                         Type = 2,
-                                        DelayTime=sceneTarget.DelayTime,
-                                        MemberNumber=sceneTarget.DelayTimeSerialNumber
+                                        DelayTime = sceneTarget.DelayTime,
+                                        MemberNumber = sceneTarget.DelayTimeSerialNumber
                                     };
                                     removeSceneDeviceListInfoList.Add(removeDevice);
                                 }
@@ -842,17 +1015,16 @@
                                     modifyRoom.Save();
                                     curRoom.Save();
                                 }
+                                EditorAction?.Invoke(modifySceneUI, curRoom);
                                 RemoveFromParent();
                             }
                             else if (result == 0)
                             {
-                                //澶辫触
-                                Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
+                                CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain));
                             }
                             else if (result == -1)
                             {
-                                //宸插瓨鍦�
-                                Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneHadExist);
+                                CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneHadExist));
                             }
                         }
                         catch (Exception ex)
@@ -870,22 +1042,31 @@
                     //鏂板
                     if (string.IsNullOrEmpty(nameRow.NameText.Text))
                     {
-                        var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.SceneNameCannotBeNull), Language.StringByID(R.MyInternationalizationString.Close));
-                        alert.Show();
-                        alert.ResultEventHandler += (sendAlert, eAlert) =>
-                        {
-                            return;
-                        };
+                        CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.SceneNameCannotBeNull));
+                        return;
                     }
                     else
                     {
                         try
                         {
-                            if (Common.Room.CurrentRoom.GetSameFloorScenes(curRoom.FloorId).Find(s => s.Name == nameRow.NameText.Text.Trim()) != null)
+                            var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                            var fileName = $"SceneIcon_{tradeTime}.png";
+                            string imgPath;
+                            if (IconPathType == 1 || IconPathType == 2)
                             {
-                                Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneHadExist);
-                                return;
+                                Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
+                                HdlAutoBackupLogic.AddOrEditorFile(fileName);
+                                imgPath = fileName;
                             }
+                            else
+                            {
+                                imgPath = backGround.ImagePath;
+                            }
+                            //if (Common.Room.CurrentRoom.GetSameFloorScenes(curRoom.FloorId).Find(s => s.Name == nameRow.NameText.Text.Trim()) != null)
+                            //{
+                            //    CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneHadExist));
+                            //    return;
+                            //}
                             CommonPage.Loading.Start();
                             var memberDataList = new List<ZigBee.Device.Scene.AddSceneMemberData>();
                             for (int i = 0; i < sceneTargetDevicesList.Count; i++)
@@ -935,20 +1116,19 @@
                                 }
                             }
 
-                            var result = await curRoom.AddScene(nameRow.NameText.Text, backGround.UnSelectedImagePath, memberDataList);
+                            var result = await curRoom.AddScene(nameRow.NameText.Text, imgPath, memberDataList, IconPathType);
                             if (result == 1)
                             {
+                                AddAction?.Invoke();
                                 RemoveFromParent();
                             }
                             else if (result == 0)
                             {
-                                //澶辫触
-                                CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.AddSceneFail);
+                                CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.AddSceneFail));
                             }
                             else if (result == -1)
                             {
-                                //宸插瓨鍦�
-                                CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneHadExist);
+                                CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneHadExist));
                             }
                         }
                         catch (Exception ex)
@@ -959,17 +1139,774 @@
                         {
                             CommonPage.Loading.Hide();
                         }
-
                     }
                 }
 
-                
             };
             #endregion
         }
 
         #endregion
 
+        #region 缂栬緫璁惧____________________________________
+
+        /// <summary>
+        /// ShowSelectAction
+        /// </summary>
+        /// <param name="device"></param>
+        private void ShowSelectAction(DeviceUI device, SceneTargetDeviceUI sceneTarget)
+        {
+            var dialog = new FrameLayout()
+            {
+                BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
+            };
+            AddChidren(dialog);
+
+            dialog.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.RemoveFromParent();
+            };
+
+            if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput)
+            {
+                SelectOnoffOutput(dialog, device, sceneTarget);
+            }
+            else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch)
+            {
+                SelectOnoffOutput(dialog, device, sceneTarget);
+            }
+            else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.DimmableLight)
+            {
+                SelectDimmableLight(dialog, device, sceneTarget);
+            }
+            else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.WindowCoveringDevice)
+            {
+                SelectWindowCoveringDevice(dialog, device, sceneTarget);
+            }
+            else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat)
+            {
+                SelectThermostat(dialog, device, sceneTarget);
+            }
+        }
+
+        /// <summary>
+        /// 鐏厜
+        /// </summary>
+        /// <param name="dialog"></param>
+        /// <param name="device"></param>
+        /// <param name="sceneTarget"></param>
+        private void SelectOnoffOutput(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget)
+        {
+            var selectFL = new FrameLayout
+            {
+                Y = Application.GetRealHeight(1391),
+                Height = Application.GetRealHeight(530),
+            };
+            dialog.AddChidren(selectFL);
+            //selectFL.Animate = Animate.DownToUp;
+
+            var titleBG = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138 * 2),
+                Radius = (uint)Application.GetRealHeight(58),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(titleBG);
+
+            var titleFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138),
+            };
+            selectFL.AddChidren(titleFL);
+
+            var line = new Button
+            {
+                Y = titleFL.Height - 1,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+            };
+            titleFL.AddChidren(line);
+
+            var cancleBtn = new Button
+            {
+                X = Application.GetRealWidth(80),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextID = R.MyInternationalizationString.Cancel
+            };
+            titleFL.AddChidren(cancleBtn);
+
+            var deviceName = new Button
+            {
+                Width = Application.GetRealWidth(600),
+                Gravity = Gravity.CenterHorizontal,
+                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextSize = 16,
+                Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
+            };
+            titleFL.AddChidren(deviceName);
+
+            var comfrimBtn = new Button
+            {
+                X = Application.GetRealWidth(800),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterRight,
+                TextID = R.MyInternationalizationString.Complete
+            };
+            titleFL.AddChidren(comfrimBtn);
+
+            var itemFL = new FrameLayout
+            {
+                Y = titleFL.Bottom,
+                Height = Application.GetRealHeight(392),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(itemFL);
+
+            var open = new SelectSceneStatuRow(0, 60);
+            itemFL.AddChidren(open);
+            open.Init();
+            open.SetTitle(R.MyInternationalizationString.Open);
+            open.IsSelected = true;
+
+
+            var shut = new SelectSceneStatuRow(0, 60 + 127 + 30);
+            itemFL.AddChidren(shut);
+            shut.Init();
+            shut.hideLine(true);
+            shut.SetTitle(R.MyInternationalizationString.Shut);
+
+            open.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = true;
+                shut.IsSelected = false;
+            };
+
+            shut.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = false;
+                shut.IsSelected = true;
+            };
+
+            cancleBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                dialog.RemoveAll();
+                dialog.RemoveFromParent();
+            };
+
+            if (sceneTarget.TaskList.Count > 0)
+            {
+                if (sceneTarget.TaskList[0].Data1 == 1)
+                {
+                    open.IsSelected = true;
+                    shut.IsSelected = false;
+                }
+                else
+                {
+                    open.IsSelected = false;
+                    shut.IsSelected = true;
+                }
+            }
+
+            comfrimBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { };
+                int taskType = 1;
+                int data1 = 0;
+                int data2 = 0;
+
+                if (open.IsSelected)
+                {
+                    //寮�
+                    data1 = 1;
+                    data2 = 0;
+                }
+                else
+                {
+                    //鍏�
+                    data1 = 0;
+                    data2 = 0;
+                }
+                var taskInfo = new ZigBee.Device.Scene.TaskListInfo
+                {
+                    TaskType = taskType,
+                    Data1 = data1,
+                    Data2 = data2
+                };
+                taskList.Add(taskInfo);
+
+                sceneTarget.TaskList = taskList;
+                sceneTarget.DeviceUI = device;
+                selectedAction?.Invoke(sceneTarget);
+                dialog.RemoveFromParent();
+            };
+        }
+        /// <summary>
+        /// 绐楀笜
+        /// </summary>
+        /// <param name="dialog"></param>
+        /// <param name="device"></param>
+        /// <param name="sceneTarget"></param>
+        private void SelectWindowCoveringDevice(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget)
+        {
+            var selectFL = new FrameLayout
+            {
+                Y = Application.GetRealHeight(1169),
+                Height = Application.GetRealHeight(752),
+            };
+            dialog.AddChidren(selectFL);
+            //selectFL.Animate = Animate.DownToUp;
+
+            var titleBG = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138 * 2),
+                Radius = (uint)Application.GetRealHeight(58),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(titleBG);
+
+            var titleFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138),
+            };
+            selectFL.AddChidren(titleFL);
+
+            var line = new Button
+            {
+                Y = titleFL.Height - 1,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+            };
+            titleFL.AddChidren(line);
+
+            var cancleBtn = new Button
+            {
+                X = Application.GetRealWidth(80),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextID = R.MyInternationalizationString.Cancel
+            };
+            titleFL.AddChidren(cancleBtn);
+
+            var deviceName = new Button
+            {
+                Width = Application.GetRealWidth(600),
+                Gravity = Gravity.CenterHorizontal,
+                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextSize = 16,
+                Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
+            };
+            titleFL.AddChidren(deviceName);
+
+            var comfrimBtn = new Button
+            {
+                X = Application.GetRealWidth(800),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterRight,
+                TextID = R.MyInternationalizationString.Complete
+            };
+            titleFL.AddChidren(comfrimBtn);
+
+            var itemFL = new FrameLayout
+            {
+                Y = titleFL.Bottom,
+                Height = Application.GetRealHeight(613),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(itemFL);
+
+            var open = new SelectDeviceWithSeekBarRow(0, 60);
+            itemFL.AddChidren(open);
+            open.Init();
+            open.SetTitle(R.MyInternationalizationString.Open);
+            open.IsSelected = true;
+
+            var shut = new SelectSceneStatuRow(0, 60 + 348 + 30);
+            itemFL.AddChidren(shut);
+            shut.Init();
+            shut.hideLine(true);
+            shut.SetTitle(R.MyInternationalizationString.Shut);
+
+            open.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = true;
+                shut.IsSelected = false;
+            };
+
+            shut.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = false;
+                shut.IsSelected = true;
+            };
+
+            cancleBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                dialog.RemoveAll();
+                dialog.RemoveFromParent();
+            };
+
+            open.SeekBar.OnProgressChangedEvent += (sender, e) =>
+            {
+                open.IsSelected = true;
+                shut.IsSelected = false;
+                open.SetSeekBarTitle();
+            };
+
+            if (sceneTarget.TaskList.Count > 0)
+            {
+                if (sceneTarget.TaskList[0].Data1 == 1)
+                {
+                    open.IsSelected = false;
+                    shut.IsSelected = true;
+                }
+                else
+                {
+                    open.IsSelected = true;
+                    shut.IsSelected = false;
+                    open.SetSeekBarProgress(sceneTarget.TaskList[0].Data2);
+                }
+            }
+
+            comfrimBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { };
+
+                int taskType = 6;
+                int data1 = 0;
+                int data2 = 0;
+
+                if (shut.IsSelected)
+                {
+                    //鍏�
+                    data1 = 1;
+                    data2 = 0;
+                }
+                else
+                {
+                    //鐧惧垎姣�
+                    data1 = 5;
+                    data2 = open.SeekBar.Progress;
+                }
+
+                var taskInfo = new ZigBee.Device.Scene.TaskListInfo
+                {
+                    TaskType = taskType,
+                    Data1 = data1,
+                    Data2 = data2
+                };
+                taskList.Add(taskInfo);
+
+                sceneTarget.TaskList = taskList;
+                sceneTarget.DeviceUI = device;
+                selectedAction?.Invoke(sceneTarget);
+                dialog.RemoveFromParent();
+            };
+        }
+        /// <summary>
+        /// 璋冨厜鐏�
+        /// </summary>
+        /// <param name="dialog"></param>
+        /// <param name="device"></param>
+        /// <param name="sceneTarget"></param>
+        private void SelectDimmableLight(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget)
+        {
+            var selectFL = new FrameLayout
+            {
+                Y = Application.GetRealHeight(1169),
+                Height = Application.GetRealHeight(752),
+            };
+            dialog.AddChidren(selectFL);
+            //selectFL.Animate = Animate.DownToUp;
+
+            var titleBG = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138 * 2),
+                Radius = (uint)Application.GetRealHeight(58),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(titleBG);
+
+            var titleFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138),
+            };
+            selectFL.AddChidren(titleFL);
+
+            var line = new Button
+            {
+                Y = titleFL.Height - 1,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+            };
+            titleFL.AddChidren(line);
+
+            var cancleBtn = new Button
+            {
+                X = Application.GetRealWidth(80),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextID = R.MyInternationalizationString.Cancel
+            };
+            titleFL.AddChidren(cancleBtn);
+
+            var deviceName = new Button
+            {
+                Width = Application.GetRealWidth(600),
+                Gravity = Gravity.CenterHorizontal,
+                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextSize = 16,
+                TextAlignment = TextAlignment.CenterLeft,
+                Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
+            };
+            titleFL.AddChidren(deviceName);
+
+            var comfrimBtn = new Button
+            {
+                X = Application.GetRealWidth(800),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterRight,
+                TextID = R.MyInternationalizationString.Complete
+            };
+            titleFL.AddChidren(comfrimBtn);
+
+            var itemFL = new FrameLayout
+            {
+                Y = titleFL.Bottom,
+                Height = Application.GetRealHeight(613),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(itemFL);
+
+            var open = new SelectDeviceWithSeekBarRow(0, 60);
+            itemFL.AddChidren(open);
+            open.Init(254);
+            open.SetTitle(R.MyInternationalizationString.Open);
+            open.IsSelected = true;
+
+            var shut = new SelectSceneStatuRow(0, 60 + 348 + 30);
+            itemFL.AddChidren(shut);
+            shut.Init();
+            shut.hideLine(true);
+            shut.SetTitle(R.MyInternationalizationString.Shut);
+
+            open.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = true;
+                shut.IsSelected = false;
+            };
+
+            shut.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = false;
+                shut.IsSelected = true;
+            };
+
+            cancleBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                dialog.RemoveAll();
+                dialog.RemoveFromParent();
+            };
+
+            open.SeekBar.OnProgressChangedEvent += (sender, e) =>
+            {
+                open.IsSelected = true;
+                shut.IsSelected = false;
+                open.SetSeekBarTitle();
+            };
+
+            if (sceneTarget.TaskList.Count > 0)
+            {
+                if (sceneTarget.TaskList[0].Data1 == 0)
+                {
+                    open.IsSelected = false;
+                    shut.IsSelected = true;
+                }
+                else
+                {
+                    open.IsSelected = true;
+                    shut.IsSelected = false;
+                    open.SetSeekBarProgress(sceneTarget.TaskList[0].Data1);
+                }
+            }
+
+            comfrimBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { };
+
+                int taskType = 3;
+                int data1 = 0;
+                int data2 = 0;
+
+                if (shut.IsSelected)
+                {
+                    //鍏�
+                    data1 = 0;
+                    data2 = 0;
+                }
+                else
+                {
+                    //鐧惧垎姣�
+                    data1 = open.SeekBar.Progress;
+                    data2 = 0;
+                }
+
+                var taskInfo = new ZigBee.Device.Scene.TaskListInfo
+                {
+                    TaskType = taskType,
+                    Data1 = data1,
+                    Data2 = data2
+                };
+                taskList.Add(taskInfo);
+
+                sceneTarget.TaskList = taskList;
+                sceneTarget.DeviceUI = device;
+                selectedAction?.Invoke(sceneTarget);
+                dialog.RemoveFromParent();
+            };
+        }
+        /// <summary>
+        /// 绌鸿皟
+        /// </summary>
+        /// <param name="dialog"></param>
+        /// <param name="device"></param>
+        /// <param name="sceneTarget"></param>
+        private void SelectThermostat(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget)
+        {
+        /// 娓╁害
+        int tempId=0;
+        /// 妯″紡
+        int modelId=0;
+        /// 椋庨��
+        int fanid=0;
+
+            var selectFL = new FrameLayout
+            {
+                Y = Application.GetRealHeight(815),
+                Height = Application.GetRealHeight(1106),
+            };
+            dialog.AddChidren(selectFL);
+            //selectFL.Animate = Animate.DownToUp;
+
+            var titleBG = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138 * 2),
+                Radius = (uint)Application.GetRealHeight(58),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(titleBG);
+
+            var titleFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(138),
+            };
+            selectFL.AddChidren(titleFL);
+
+            var line = new Button
+            {
+                Y = titleFL.Height - 1,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+            };
+            titleFL.AddChidren(line);
+
+            var cancleBtn = new Button
+            {
+                X = Application.GetRealWidth(80),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextID = R.MyInternationalizationString.Cancel
+            };
+            titleFL.AddChidren(cancleBtn);
+
+            var deviceName = new Button
+            {
+                Width = Application.GetRealWidth(600),
+                Gravity = Gravity.CenterHorizontal,
+                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextSize = 16,
+                TextAlignment = TextAlignment.CenterLeft,
+                Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
+            };
+            titleFL.AddChidren(deviceName);
+
+            var comfrimBtn = new Button
+            {
+                X = Application.GetRealWidth(800),
+                Width = Application.GetRealWidth(200),
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
+                TextSize = 14,
+                TextAlignment = TextAlignment.CenterRight,
+                TextID = R.MyInternationalizationString.Complete
+            };
+            titleFL.AddChidren(comfrimBtn);
+
+            var itemFL = new FrameLayout
+            {
+                Y = titleFL.Bottom,
+                Height = Application.GetRealHeight(968),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+            };
+            selectFL.AddChidren(itemFL);
+
+            var open = new SelectDeviceWithPickViewRow(0, 60);
+            itemFL.AddChidren(open);
+            open.Init();
+            open.SetTitle(R.MyInternationalizationString.Open);
+            open.IsSelected = true;
+
+            open.pickerView.OnSelectChangeEvent = (l1, l2, l3) =>
+            {
+                tempId = l1;
+                modelId = l2;
+                fanid = l3;
+            };
+
+            var shut = new SelectSceneStatuRow(0, 60 + 703 + 30);
+            itemFL.AddChidren(shut);
+            shut.Init();
+            shut.hideLine(true);
+            shut.SetTitle(R.MyInternationalizationString.Shut);
+
+            open.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = true;
+                shut.IsSelected = false;
+            };
+
+            shut.ClickButton.MouseUpEventHandler += (sender, e) =>
+            {
+                open.IsSelected = false;
+                shut.IsSelected = true;
+            };
+
+            cancleBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                dialog.RemoveAll();
+                dialog.RemoveFromParent();
+            };
+
+            if (sceneTarget.TaskList.Count > 0)
+            {
+                if (sceneTarget.TaskList.Count == 1)
+                {
+                    open.IsSelected = false;
+                    shut.IsSelected = true;
+                }
+                else
+                {
+                    open.IsSelected = true;
+                    shut.IsSelected = false;
+
+                    for (int i = 0; i < sceneTarget.TaskList.Count; i++)
+                    {
+                        var tasklist = sceneTarget.TaskList[i];
+                        if (tasklist.Data1 == 6)
+                        {
+                            fanid = open.fanList.IndexOf(tasklist.Data2);
+                        }
+                        if (tasklist.Data1 == 3)
+                        {
+                            modelId = open.modeList.IndexOf(tasklist.Data2);
+                        }
+                        if (tasklist.Data1 == 4 || tasklist.Data1 == 5)
+                        {
+                            tempId = open.temperatureList.IndexOf(tasklist.Data2 / 100);
+                        }
+                    }
+                    open.pickerView.setCurrentItems(tempId, modelId, fanid);
+                }
+            }
+
+            comfrimBtn.MouseUpEventHandler = (sender, e) =>
+            {
+
+                var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { };
+
+                int taskType = 5;
+                int data1 = 0;
+                int data2 = 0;
+
+                if (shut.IsSelected)
+                {
+                    //鍏�
+                    data1 = 3;
+                    data2 = 0;
+                    var taskInfo = new ZigBee.Device.Scene.TaskListInfo
+                    {
+                        TaskType = taskType,
+                        Data1 = data1,
+                        Data2 = data2
+                    };
+                    taskList.Add(taskInfo);
+                }
+                else
+                {
+                    //fan
+                    var taskInfo = new ZigBee.Device.Scene.TaskListInfo
+                    {
+                        TaskType = taskType,
+                        Data1 = 6,
+                        Data2 = open.fanList[fanid]
+                    };
+                    taskList.Add(taskInfo);
+
+                    //mode
+                    var taskInfo2 = new ZigBee.Device.Scene.TaskListInfo
+                    {
+                        TaskType = taskType,
+                        Data1 = 3,
+                        Data2 = open.modeList[modelId]
+                    };
+                    taskList.Add(taskInfo2);
+
+                    //tem
+                    if (open.modeList[modelId] == 4)
+                    {
+                        //heat
+                        var taskInfo3 = new ZigBee.Device.Scene.TaskListInfo
+                        {
+                            TaskType = taskType,
+                            Data1 = 4,
+                            Data2 = open.temperatureList[tempId] * 100
+                        };
+                        taskList.Add(taskInfo3);
+
+                    }
+                    else
+                    {
+                        //heat
+                        var taskInfo3 = new ZigBee.Device.Scene.TaskListInfo
+                        {
+                            TaskType = taskType,
+                            Data1 = 5,
+                            Data2 = open.temperatureList[tempId] * 100
+                        };
+                        taskList.Add(taskInfo3);
+                    }
+                }
+
+                sceneTarget.TaskList = taskList;
+                sceneTarget.DeviceUI = device;
+                selectedAction?.Invoke(sceneTarget);
+                dialog.RemoveFromParent();
+            };
+        }
+
+        #endregion
 
     }
 }

--
Gitblit v1.8.0