陈嘉乐
2020-06-16 7167334c0e89dd84827d59e726123d14776e3a09
HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -44,14 +45,16 @@
        #region 区域变量
        int showdFunctionCount = 0;
        string roomId;
        string showedFunctionRoomId="0";
        Room room;
        string showedFunctionRoomId = "0";
        List<Function> unallocatedList = new List<Function>();
        List<Function> allocatedList = new List<Function>();
        #endregion
        public RoomEditFunctionPage(string rId)
        public RoomEditFunctionPage(Room r)
        {
            bodyView = this;
            roomId = rId;
            room = r;
        }
        /// <summary>
@@ -101,7 +104,7 @@
            btnChoosedRoom = new Button()
            {
                X = Application.GetRealWidth(313-100+24),
                X = Application.GetRealWidth(313 - 100 + 24),
                Width = Application.GetRealWidth(100),
                //Height = Application.GetRealHeight(55),
                TextAlignment = TextAlignment.CenterRight,
@@ -134,7 +137,20 @@
            };
            bodyView.AddChidren(functionListView);
            LoadFunctionListRow(true);
            foreach (var function in DB_ResidenceData.residenceData.functionList.functions)
            {
                function.roomIdList.Remove(null);
                if (function.roomIdList.Count > 0 )
                {
                    allocatedList.Add(function);
                }
                else
                {
                    unallocatedList.Add(function);
                }
            }
            LoadFunctionListRow(unallocatedList);
            btnConfrim = new Button()
@@ -161,24 +177,13 @@
        /// 显示功能Row
        /// </summary>
        /// <param name="showUnallocated">是否是显示未分配</param>
        void LoadFunctionListRow(bool showUnallocated)
        void LoadFunctionListRow(List<Function> functions)
        {
            showdFunctionCount = 0;
            functionListView.RemoveAll();
            foreach (var function in DB_ResidenceData.residenceData.functionList.functions)
            foreach (var function in functions)
            {
                if (function.roomIdList.Count > 0 && !function.roomIdList.Contains(roomId)&& showUnallocated)
                {
                    continue;
                }
                if (!showUnallocated && showedFunctionRoomId != null)//如果需要显示已经分配的功能,并且指定显示分到的房间
                {
                    if (!function.roomIdList.Contains(showedFunctionRoomId))//如果当前功能不是需要显示的
                    {
                        continue;
                    }
                }
                functionListView.AddChidren(new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
@@ -204,21 +209,26 @@
                functionRow.AddChidren(btnFunctionIcon);
                switch (function.functionCategory)
                {
                    case FunctionType.AC:
                        btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon.png";
                    case FunctionCategory.Thermostat:
                        switch (function.functionType)
                        {
                            case FunctionType.AC:
                                btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon.png";
                                break;
                            case FunctionType.FloorHeating:
                                btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png";
                                break;
                        }
                        break;
                    case FunctionType.Curtain:
                    case FunctionCategory.Curtain:
                        btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png";
                        break;
                    case FunctionType.Light:
                    case FunctionCategory.Light:
                        btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png";
                        break;
                    case FunctionType.FloorHeating:
                        btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png";
                        break;
                }
                if (showUnallocated)
                if (!btnAllocated.IsSelected)
                {
                    var btnFunctionName = new Button()
                    {
@@ -268,10 +278,10 @@
                    Height = Application.GetRealWidth(28),
                    SelectedImagePath = "Public/SelectionIcon.png",
                    UnSelectedImagePath = "Public/UnSelectionIcon.png",
                    IsSelected = function.roomIdList.Contains(roomId)
                    IsSelected = function.roomIdList.Contains(room.sid)
                };
                functionRow.AddChidren(btnChooseIcon);
                LoadEvent_ChangeRoomFunctionList(functionRow,btnChooseIcon, function);
                LoadEvent_ChangeRoomFunctionList(functionRow, btnChooseIcon, function);
                showdFunctionCount++;
            }
@@ -279,12 +289,15 @@
            if (showdFunctionCount < 9)
            {
                functionListView.Height = Application.GetRealHeight(51 * showdFunctionCount);
            }else
            {
                functionListView.Height = Application.GetRealHeight(518 - 40 - 62);
            }
        }
        /// <summary>
        /// 显示房间选中弹窗
        /// 显示房间选选择弹窗
        /// </summary>
        void LoadPage_LoadChooseRoomDialog()
        {
@@ -331,7 +344,7 @@
                Tag = "0"
            };
            roomListView.AddChidren(btnAllRoom);
            LoadEvent_ChangeShowedFunctionList(btnAllRoom,dialog,Language.StringByID(StringId.All));
            LoadEvent_ChangeShowedFunctionList(btnAllRoom, dialog, Language.StringByID(StringId.All));
            roomListView.AddChidren(new Button()
            {
@@ -357,7 +370,7 @@
                    Tag = tempRoom.sid,
                };
                roomListView.AddChidren(btnRoom);
                LoadEvent_ChangeShowedFunctionList(btnRoom,dialog,tempRoom.name);
                LoadEvent_ChangeShowedFunctionList(btnRoom, dialog, tempRoom.name);
                roomListView.AddChidren(new Button()
                {
@@ -367,7 +380,8 @@
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
            }
            dialogBodyView.MouseUpEventHandler = (sender, e) => {
            dialogBodyView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };