gxc
2020-01-10 b9cb076fe6127160c96c35bf9c8cebcffe1d5ccd
ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -26,9 +26,10 @@
        /// 构造函数
        /// </summary>
        /// <param name="doorLock"></param>
        public AddScenePage(ZigBee.Device.Panel key)
        public AddScenePage(ZigBee.Device.Panel key, List<ScenesListInfo> gwScenesList)
        {
            this.currentKey = key;
            gwCurScenesList = gwScenesList;
        }
        #region ◆ 变量申明__________________________
@@ -46,6 +47,7 @@
        Button btnFloorText;
        Dictionary<string, string> dicFloor;//楼层列表
        List<SceneUI> currentKeyAllRoomSceneList = new List<SceneUI>();
        public List<ScenesListInfo> gwCurScenesList = new List<ScenesListInfo>();//网关中的场景列表
        #endregion
        /// <summary>
@@ -67,7 +69,6 @@
            var btnAddFrameLayout = new FrameLayout
            {
                X = Application.GetRealWidth(830),
                Width = Application.GetRealWidth(200),
            };
            this.titleFrameLayout.AddChidren(btnAddFrameLayout);
@@ -77,7 +78,8 @@
                X = Application.GetRealWidth(15),
                Text = Language.StringByID(R.MyInternationalizationString.FirstFloor),
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextSize = 15,
                TextSize = 14,
                IsBold = true,
                TextAlignment = TextAlignment.CenterRight,
            };
            btnAddFrameLayout.AddChidren(btnFloorText);
@@ -95,6 +97,14 @@
            {
                SideslipFramelayout();
            };
            if (Common.Config.Instance.Home.FloorDics.Count == 0)
            {
                btnAddFrameLayout.Width = 0;
            }
            else
            {
                btnAddFrameLayout.Width = Application.GetRealWidth(200);
            }
            MidFrameLayoutContent(btnFloorText);
        }
@@ -136,6 +146,7 @@
                TextID = R.MyInternationalizationString.Save,
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                IsBold = true,
                TextSize = 16,
            };
            bottomFrameLayout.AddChidren(btnFinifh);
@@ -194,7 +205,7 @@
            Shared.Common.Room curRoom = roomList[0];
            int index = 0;
            RefreshRoomList(curRoom, ref index);
            RefreshSceneList(roomList[index]);
            //RefreshSceneList(roomList[index]);
            if (curRoom.SceneUIList.Count == 0)
            {
@@ -551,7 +562,14 @@
            }
            Button oldScene = null;
            int curIndex = 0;
            foreach (var scene in curRoom.SceneUIList)
            var currentSceneUIList = GetMatchSceneUIList(curRoom);
            if (currentSceneUIList.Count == 0)
            {
                btnFinifh.Enable = false;
                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
                return;
            }
            foreach (var scene in currentSceneUIList)
            {
                #region 绑定表UI显(无数据处理)
                var rowLayout = new FrameLayout()
@@ -567,16 +585,17 @@
                    Y = Application.GetMinRealAverage(46),
                    Width = Application.GetMinRealAverage(81),
                    Height = Application.GetMinRealAverage(81),
                    UnSelectedImagePath = "Scene/SceneIcon.png"
            };
                    UnSelectedImagePath = "Scene/SceneIcon.png",// scene.IconPath,
                };
                rowLayout.AddChidren(devicePic);
                var btnBindName = new Button()
                {
                    Width = Application.GetRealWidth(500 - 120),
                    Width = Application.GetRealWidth(790),
                    X = devicePic.Right + Application.GetRealWidth(20),
                    TextColor = Shared.Common.ZigbeeColor.Current.TextBlack,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = 15,
                };
                rowLayout.AddChidren(btnBindName);
@@ -734,8 +753,9 @@
                Height = Application.GetRealHeight(58),
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(81),
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextSize = 14,
                IsBold = true,
                TextAlignment = TextAlignment.CenterLeft,
                TextID = R.MyInternationalizationString.SelectFloor,
            };
@@ -786,6 +806,7 @@
                if (currentKey.currentSelectFloorId == floorId)
                {
                    btnAllMethod.IsSelected = true;
                    btnAllMethod.IsBold = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                }
@@ -813,6 +834,7 @@
                        oldbuttonText = btnMethodText;
                        btnMethodText.IsSelected = true;
                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                        oldbuttonText.IsBold = true;
                    }
                    //获取楼层对应的房间
@@ -880,6 +902,20 @@
            }
            return currentKeyAllRoomSceneList;
        }
        //获取网关中存在的本地场景列表
        List<SceneUI> GetMatchSceneUIList(Shared.Common.Room curRoom)
        {
            var tempSceneUIList = new List<SceneUI>();
            foreach (var scene in curRoom.SceneUIList)
            {
                var gwSc = gwCurScenesList.Find(obj => (obj.ScenesId == scene.Id));
                if (gwSc != null)
                {
                    tempSceneUIList.Add(scene);
                }
            }
            return tempSceneUIList;
        }
        public void DeviceInfoChange(CommonDevice common, string typeTag)
        {