黄学彪
2020-07-13 23420922845c9e77019a55c3b3e3271eb1ec261e
ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs
@@ -42,6 +42,10 @@
        /// 设备列表控件
        /// </summary>
        private VerticalListControl listDeviceView = null;
        /// <summary>
        /// 当前选择的楼层
        /// </summary>
        private string nowSelectFloorId = string.Empty;
        #endregion
@@ -57,6 +61,8 @@
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.AddFunction));
            //初始化右上角的控件
            this.InitTopRightMenuControl();
            //初始化中部信息
            this.InitMiddleFrame();
        }
@@ -66,8 +72,58 @@
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空body
            this.ClearBodyFrame();
            //初始化房间菜单控件
            this.InitRoomMenuControl();
        }
        /// <summary>
        /// 初始化右上角的控件
        /// </summary>
        private void InitTopRightMenuControl()
        {
            //获取楼层
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
            if (dicFloor.Count == 0)
            {
                return;
            }
            var btnIconContr = new MostRightIconControl(69, 69);
            btnIconContr.UnSelectedImagePath = "Item/Drop_Down.png";
            topFrameLayout.AddChidren(btnIconContr);
            btnIconContr.InitControl();
            var btnFloor = new NormalViewControl(300, 69, true);
            btnFloor.Gravity = Gravity.CenterVertical;
            btnFloor.X = btnIconContr.X + btnIconContr.btnIcon.X - Application.GetRealWidth(300);
            btnFloor.TextAlignment = TextAlignment.CenterRight;
            topFrameLayout.AddChidren(btnFloor);
            foreach (var floorId in dicFloor.Keys)
            {
                //第一个楼层
                this.nowSelectFloorId = floorId;
                btnFloor.Text = dicFloor[floorId];
                break;
            }
            btnIconContr.ButtonClickEvent += (sender, e) =>
            {
                //楼层菜单
                var contr = new TopRightFloorMenuControl(dicFloor.Count, 2, this.nowSelectFloorId, Language.StringByID(R.MyInternationalizationString.SelectFloor));
                foreach (var floorId in dicFloor.Keys)
                {
                    contr.AddRowMenu(floorId, () =>
                    {
                        //记录起选择的ID
                        this.nowSelectFloorId = floorId;
                        btnFloor.Text = dicFloor[this.nowSelectFloorId];
                        //初始化中部信息
                        this.InitMiddleFrame();
                    });
                }
            };
        }
        #endregion
@@ -98,7 +154,10 @@
            roomSwitchContr.SelectRoomEvent += (selectRoom) =>
            {
                //在外面清空(特效的问题)
                this.deviceFunctionMenuContr?.RemoveAll();
                if (this.deviceFunctionMenuContr != null && this.deviceFunctionMenuContr.Parent != null)
                {
                    this.deviceFunctionMenuContr.RemoveAll();
                }
                this.listDeviceView?.RemoveAll();
                HdlThreadLogic.Current.RunMainInThread(() =>
@@ -116,7 +175,10 @@
            this.btnFinishControl = new BottomClickButton();
            btnFinishControl.TextID = R.MyInternationalizationString.uFinish;
            bodyFrameLayout.AddChidren(btnFinishControl);
            btnFinishControl.Visible = false;
            if (this.dicNewListTask == null || this.dicNewListTask.Count == 0)
            {
                btnFinishControl.Visible = false;
            }
            btnFinishControl.ButtonClickEvent += (sender, e) =>
            {
                //回调函数
@@ -136,20 +198,24 @@
        /// <returns></returns>
        private List<Room> GetCanShowRoomList()
        {
            //先将列表Dictionary化
            this.dicNewListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>();
            this.dicOldListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>();
            foreach (var data in this.listAdjustTarget)
            if (this.dicNewListTask == null)
            {
                if (data.Type == 0)
                //先将列表Dictionary化
                this.dicNewListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>();
                this.dicOldListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>();
                foreach (var data in this.listAdjustTarget)
                {
                    //只要设备
                    string mainkey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint);
                    dicOldListTask[mainkey] = data.TaskList;
                    if (data.Type == 0)
                    {
                        //只要设备
                        string mainkey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint);
                        dicOldListTask[mainkey] = data.TaskList;
                    }
                }
            }
            //当前楼层的全部房间
            var lisrRoom = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom();
            var lisrRoom = HdlRoomLogic.Current.GetRoomsByFloorIdAppendLoveRoom(this.nowSelectFloorId);
            var listShowRoom = new List<Room>();
            foreach (var room in lisrRoom)
            {
@@ -181,7 +247,7 @@
            var dicGroupDevice = this.GetAllGroupDevice(room);
            //只初始化一次
            if (this.deviceFunctionMenuContr == null)
            if (this.deviceFunctionMenuContr == null || this.deviceFunctionMenuContr.Parent == null)
            {
                //设备菜单的白色背景
                var functionBack1 = new FrameLayout();
@@ -256,7 +322,7 @@
                        HdlThreadLogic.Current.RunMainInThread(() =>
                        {
                            //初始化设备列表控件
                            this.InitListDeviceControls(listDeviceView, rowInfo, room);
                            this.InitListDeviceControls(listDeviceView, rowInfo);
                        });
                    }
                };
@@ -273,7 +339,7 @@
            if (nowSelectDeviceInfo != null)
            {
                //初始化默认的设备列表控件
                this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo, room);
                this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo);
            }
        }
@@ -286,7 +352,7 @@
        /// </summary>
        /// <param name="listView"></param>
        /// <param name="rowInfo"></param>
        private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo, Room i_room)
        private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo)
        {
            //先清空
            listView.RemoveAll();