2020-12-17 1.成员管理UI还原度修改。2.增加右键删除。3.增加无区域功能管理。
10个文件已修改
675 ■■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,26 +1,45 @@
<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs" Line="66" Column="1" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs" Line="313" Column="39" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs" Line="144" Column="46" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs" Line="228" Column="39" />
      <File FileName="HDL_ON/Common/R.cs" Line="148" Column="26" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="Common" expanded="True" />
              <Node name="DAL" expanded="True">
                <Node name="DriverLayer" expanded="True" />
                <Node name="Server" expanded="True" />
              </Node>
              <Node name="Entity" expanded="True">
                <Node name="Function" expanded="True" />
                <Node name="ResponseEntity" expanded="True" />
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI0-Public" expanded="True" />
                <Node name="UI2" expanded="True">
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="MemberManagement" expanded="True">
                      <Node name="MemberPermissionPage.cs" selected="True" />
                      <Node name="MemberFunctionPermissionPage.cs" selected="True" />
                    </Node>
                  </Node>
                  <Node name="FuntionControlView" expanded="True">
                    <Node name="Light" expanded="True" />
                  </Node>
                </Node>
              </Node>
            </Node>
            <Node name="HDL-ON_Android" expanded="True">
              <Node name="Assets" expanded="True" />
            </Node>
            <Node name="HDL-ON_iOS" expanded="True">
              <Node name="References" expanded="True" />
              <Node name="Resources" expanded="True" />
            </Node>
          </Node>
HDL-ON_Android/Assets/Language.ini
@@ -273,7 +273,7 @@
251=添加失败,权限不足。
252=保存成功
253=保存中,请稍后
254=修改成员昵称
254=昵称编辑
255=移除该成员
256=暂无已收藏的功能
257=请输入内容
@@ -576,6 +576,8 @@
9056=年
9057=无区域功能
9058=是否需要保存
9059=暂无分享
9060=使用权限
10000=无效登录密钥,请重新登录!
10001=请求服务器失败,请稍后再试!
HDL-ON_iOS/Resources/Language.ini
@@ -273,7 +273,7 @@
251=添加失败,权限不足。
252=保存成功
253=保存中,请稍后
254=修改成员昵称
254=昵称编辑
255=移除该成员
256=暂无已收藏的功能
257=请输入内容
@@ -576,6 +576,8 @@
9056=年
9057=无区域功能
9058=是否需要保存
9059=暂无分享
9060=使用权限
10000=无效登录密钥,请重新登录!
10001=请求服务器失败,请稍后再试!
HDL_ON/Common/R.cs
@@ -145,7 +145,7 @@
        public const int EditNickname = 237;
        public const int NicknameCannotBeEmpty = 236;
        public const int CreateScene = 235;
        public const int PermissionToUse = 234;
        public const int MemberPermissionManagement = 234;
        public const int Nickname = 233;
        public const int MemberManagement = 232;
        public const int OtherArea = 231;
@@ -750,6 +750,14 @@
        /// 是否需要保存
        /// </summary>
        public const int IfNeedToSave = 9058;
        /// <summary>
        /// 暂无分享
        /// </summary>
        public const int NoShare = 9059;
        /// <summary>
        /// 使用权限
        /// </summary>
        public const int PermissionToUse = 9060;
        #region 网络请求响应错误提示信息
HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs
@@ -38,7 +38,7 @@
        /// <summary>
        /// 子账号获得的当前住宅的功能数据
        /// </summary>
        public List<ShareData> CurResidenceShareDate = new List<ShareData>();
        public List<ShareData> CurResidenceShareData = new List<ShareData>();
        /// <summary>
        /// 
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
@@ -31,44 +31,53 @@
        ResidenceMemberInfo memberInfo;
        Room room;
        Action<string> refreshFunctionCount;
        /// <summary>
        /// 当前的房间roomId
        /// 如果为空,则代表管理无分配区域的功能分享
        /// </summary>
        string roomId;
        /// <summary>
        /// 房间所有功能列表
        /// </summary>
        List<Function> roomFunctionList = new List<Function>();
        /// <summary>
        /// 之前的分享列表
        /// 刷新回调Action
        /// </summary>
        List<ShareData> funs;
        Action refreshAction;
        /// <summary>
        /// 当前账号的所有分享列表
        /// </summary>
        List<ShareData> curResidenceShareData;
        /// <summary>
        /// 属于当前房间最终的设备分享列表
        /// </summary>
        List<ShareData> funs_New;
        List<ShareData> funs_RoomAll;
        //shareDataList = new List<ShareData>();
        /// <summary>
        /// 删除的分享列表
        /// </summary>
        List<ShareData> funs_Del;
        public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r, Action<string> action)
        /// <summary>
        ///
        /// </summary>
        /// <param name="mInfo"></param>
        /// <param name="roomFunctionList"></param>
        /// <param name="roomId"></param>
        /// <param name="refreshAction"></param>
        public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, List<Function> roomFunctionList, List<ShareData> funs_RoomAll, string roomId, Action refreshAction)
        {
            bodyView = this;
            memberInfo = mInfo;
            room = r;
            funs = new List<ShareData>();
            funs = memberInfo.CurResidenceShareDate;
            funs_New = new List<ShareData>();
            funs_Del = new List<ShareData>();
            refreshFunctionCount = action;
        }
        public MemberFunctionPermissionPage(Room r,List<ShareData> sd)
        {
            bodyView = this;
            room = r;
            funs = new List<ShareData>();
            funs_New = sd;
            funs_Del = new List<ShareData>();
            memberInfo = new ResidenceMemberInfo();
            this.memberInfo = mInfo;
            this.roomFunctionList = roomFunctionList;
            this.roomId = roomId;
            //this.curResidenceShareData = new List<ShareData>();
            this.curResidenceShareData = memberInfo.CurResidenceShareData;
            this.funs_RoomAll = new List<ShareData>();
            this.funs_RoomAll.AddRange(funs_RoomAll);
            this.funs_Del = new List<ShareData>();
            this.refreshAction = refreshAction;
        }
        public void LoadPage(int tId)
@@ -132,7 +141,7 @@
                BackgroundColor = CSS_Color.MainColor,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                TextID = titleId == StringId.PermissionToUse ? StringId.Confirm : StringId.Shared,
                TextID = titleId == StringId.MemberPermissionManagement ? StringId.Confirm : StringId.Shared,
                TextSize = CSS_FontSize.SubheadingFontSize,
                IsBold = true,
                Radius = (uint)Application.GetRealWidth(22),
@@ -141,23 +150,17 @@
            };
            bodyView.AddChidren(btnOption);
            if(titleId == StringId.PermissionToUse)
            {
                LoadFunctionRow(funs);
            }
            else
            {
                LoadFunctionRow(funs_New);
            }
            LoadFunctionRow(funs_RoomAll);
            LoadEventList();
        }
        /// <summary>
        /// 加载功能列表
        /// </summary>
        void LoadFunctionRow(List<ShareData>  shareDatas)
        void LoadFunctionRow(List<ShareData> shareDatas)
        {
            contentView.RemoveAll();
            foreach (var function in room.GetRoomFunctions(false))
            foreach (var function in roomFunctionList)
            {
                var roomView = new FrameLayout()
                {
@@ -195,7 +198,7 @@
                {
                    btnChoose.IsSelected = true;
                    //刷新属于当前房间的分享统计
                    funs_New.Add(shareData);
                    //funs_New.Add(shareData);
                }
                else
                {
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs
@@ -22,24 +22,31 @@
        {
            btnOption.MouseUpEventHandler = (sender, e) =>
            {
                if (titleId == StringId.PermissionToUse)//从个人中心进入单独分享
                Action action = () =>
                {
                    Action action = () =>
                    {
                        UploadShareDeviceList();
                    };
                    //是否需要保存
                    new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action);
                }
                else
                {
                    //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New));
                    //2020-12-01 屏蔽页面
                    //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo);
                    //MainPage.BasePageView.AddChidren(page);
                    //page.LoadPage();
                    //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                }
                    UploadShareDeviceList();
                };
                //是否需要保存
                new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action);
                //if (titleId == StringId.PermissionToUse)//从个人中心进入单独分享
                //{
                //    Action action = () =>
                //    {
                //        UploadShareDeviceList();
                //    };
                //    //是否需要保存
                //    new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action);
                //}
                //else
                //{
                //    //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New));
                //    //2020-12-01 屏蔽页面
                //    //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo);
                //    //MainPage.BasePageView.AddChidren(page);
                //    //page.LoadPage();
                //    //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                //}
            };
        }
@@ -60,32 +67,12 @@
                        act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait));
                    });
                    //1.管理最终属于房间的分享
                    if (funs_New != null && funs_New.Count > 0)
                    if (!string.IsNullOrEmpty(roomId))
                    {
                        //最终属于房间的分享大于0
                        var success = ShareRoom();
                        if (success)
                        {
                            Utlis.WriteLine("添加房间分享成功");
                        }
                        else
                        {
                            Utlis.WriteLine("添加房间分享失败");
                        }
                        //如果房间ID不为空,管理房间
                        ManageRoomSharing();
                    }
                    else
                    {
                        var success = DeleteShareRoom();
                        if (success)
                        {
                            Utlis.WriteLine("删除房间分享成功");
                        }
                        else
                        {
                            Utlis.WriteLine("删除房间分享失败");
                        }
                    }
                    //2.批量删除分享
                    var deleteShareObj = new DeleteShareObj()
@@ -97,9 +84,9 @@
                    //3.批量上传
                    var funs_NeedAdd = new List<ShareData>();
                    foreach (var f in funs_New)
                    foreach (var f in funs_RoomAll)
                    {
                        var sd = funs.Find((obj) => obj.shareTypeId == f.shareTypeId);
                        var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.shareTypeId);
                        //如果该功能已经分享,不用分享
                        if (null == sd)
                        {
@@ -133,7 +120,7 @@
                    {
                        //4.1管理最终的分享列表
                        var funs_final = new List<ShareData>();
                        funs_final.AddRange(funs);
                        funs_final.AddRange(curResidenceShareData);
                        //4.2移除删除的
                        foreach (var share_d in funs_Del)
                        {
@@ -150,14 +137,13 @@
                        Application.RunOnMainThread(() =>
                        {
                            new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingSucceeded), true);
                            memberInfo.CurResidenceShareDate = funs_final;
                            memberInfo.CurResidenceShareData = funs_final;
                        });
                        Thread.Sleep(1600);
                        Application.RunOnMainThread(() =>
                        {
                            //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
                            MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
                            refreshFunctionCount?.Invoke(funs_New.Count.ToString());
                            refreshAction?.Invoke();
                        });
                    }
                }
@@ -208,6 +194,42 @@
        }
        /// <summary>
        /// 管理房间分享操作
        /// funs_New 大于1分享房间
        /// </summary>
        bool ManageRoomSharing()
        {
            bool success = false;
            //1.管理最终属于房间的分享
            if (funs_RoomAll != null && funs_RoomAll.Count > 0)
            {
                //最终属于房间的分享大于0
                success = ShareRoom();
                if (success)
                {
                    Utlis.WriteLine("添加房间分享成功");
                }
                else
                {
                    Utlis.WriteLine("添加房间分享失败");
                }
            }
            else
            {
                success = DeleteShareRoom();
                if (success)
                {
                    Utlis.WriteLine("删除房间分享成功");
                }
                else
                {
                    Utlis.WriteLine("删除房间分享失败");
                }
            }
            return success;
        }
        /// <summary>
        /// 分享房间
        /// </summary>
        /// <returns></returns>
@@ -217,7 +239,7 @@
            roomList.Add(new ShareData()
            {
                shareType = ShareType.ROOM.ToString(),
                shareTypeId = room.roomId
                shareTypeId = roomId
            });
            List<string> childAccountIds = new List<string>();
            childAccountIds.Add(memberInfo.childAccountId);
@@ -248,7 +270,7 @@
            roomList.Add(new ShareData()
            {
                shareType = ShareType.ROOM.ToString(),
                shareTypeId = room.roomId
                shareTypeId = roomId
            });
            var deleteShareObj = new DeleteShareObj()
@@ -279,16 +301,16 @@
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                btnChoose.IsSelected = !btnChoose.IsSelected;
                var sd = funs.Find((obj) => obj.shareTypeId == function.deviceId);
                var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == function.deviceId);
                if (btnChoose.IsSelected)
                {
                    try
                    {
                        if (null != sd)
                        {
                            if (!funs_New.Contains(sd))
                            if (!funs_RoomAll.Contains(sd))
                            {
                                funs_New.Add(sd);
                                funs_RoomAll.Add(sd);
                            }
                            if (funs_Del.Contains(sd))
                            {
@@ -300,12 +322,12 @@
                            var newSd = new ShareData();
                            newSd.shareTypeId = function.deviceId;
                            funs_New.Add(newSd);
                            funs_RoomAll.Add(newSd);
                        }
                        btnChooseAll.IsSelected = true;
                        foreach (var f in room.GetRoomFunctions(false))
                        foreach (var f in roomFunctionList)
                        {
                            if (funs_New.Find((obj) => obj.shareTypeId == f.deviceId) == null)
                            if (funs_RoomAll.Find((obj) => obj.shareTypeId == f.deviceId) == null)
                            {
                                btnChooseAll.IsSelected = false;
                                break;
@@ -319,10 +341,10 @@
                }
                else
                {
                    var onFuns = funs_New.Find((obj) => obj.shareTypeId == function.deviceId);
                    if (funs_New.Contains(onFuns))
                    var onFuns = funs_RoomAll.Find((obj) => obj.shareTypeId == function.deviceId);
                    if (funs_RoomAll.Contains(onFuns))
                    {
                        funs_New.Remove(onFuns);
                        funs_RoomAll.Remove(onFuns);
                    }
                    if (null != sd)
@@ -349,28 +371,28 @@
            {
                btnChooseAll.IsSelected = !btnChooseAll.IsSelected;
                funs_Del = new List<ShareData>();
                funs_New = new List<ShareData>();
                funs_RoomAll = new List<ShareData>();
                if (btnChooseAll.IsSelected)
                {
                    foreach (var f in room.GetRoomFunctions(false))
                    foreach (var f in roomFunctionList)
                    {
                        var ssdd = new ShareData();
                        ssdd.shareTypeId = f.deviceId;
                        funs_New.Add(ssdd);
                        funs_RoomAll.Add(ssdd);
                    }
                }
                else
                {
                    foreach (var f in room.GetRoomFunctions(false))
                    foreach (var f in roomFunctionList)
                    {
                        var sd = funs.Find((obj) => obj.shareTypeId == f.deviceId);
                        var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.deviceId);
                        if (sd != null)
                        {
                            funs_Del.Add(sd);
                        }
                    }
                }
                LoadFunctionRow(funs_New);
                LoadFunctionRow(funs_RoomAll);
            };
            btnChooseAll.MouseUpEventHandler = eventHandler;
            allRoomView.MouseUpEventHandler = eventHandler;
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs
@@ -4,11 +4,12 @@
using HDL_ON.Entity;
using System.Collections.Generic;
using HDL_ON.DAL;
using HDL_ON.DAL.Server;
namespace HDL_ON.UI
{
    /// <summary>
    /// 使用权限页面
    /// 成员权限管理页面
    /// </summary>
    public partial class MemberPermissionPage : FrameLayout
    {
@@ -30,7 +31,7 @@
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.PermissionToUse)).LoadTopView();
            new TopViewDiv(bodyView, Language.StringByID(StringId.MemberPermissionManagement)).LoadTopView();
            FrameLayout headPortraitView = new FrameLayout()
            {
@@ -131,6 +132,7 @@
            List<Function> allFunctionList = FunctionList.List.GetDeviceFunctionList();
            //未分配区域的功能
            List<Function> unallocatedList = new List<Function>();
            //
            foreach (var function in allFunctionList)
            {
                function.roomIds.Remove(null);
@@ -145,14 +147,14 @@
            }
            //移除当前住宅已经不存在的功能
            for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;)
            for (int i = 0; i < memberInfo.CurResidenceShareData.Count;)
            {
                var sd = memberInfo.CurResidenceShareDate[i];
                var sd = memberInfo.CurResidenceShareData[i];
                if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
                {
                    //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
                    //待确认是否同步云端删除分享
                    memberInfo.CurResidenceShareDate.Remove(sd);
                    memberInfo.CurResidenceShareData.Remove(sd);
                }
                else
                {
@@ -160,118 +162,57 @@
                }
            }
            foreach (var room in SpatialInfo.CurrentSpatial.RoomList)
            try
            {
                var roomView = new RowLayout()
                //遍历加载房间分享个数统计状态RowLayout
                foreach (var room in SpatialInfo.CurrentSpatial.RoomList)
                {
                    Height = Application.GetRealWidth(50),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    LineColor = CSS_Color.MainBackgroundColor,
                };
                roomListView.AddChidren(roomView);
                var btnRoomName = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealWidth(4),
                    Width = Application.GetRealWidth(330),
                    Height = Application.GetRealWidth(24),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    Text = room.roomName,
                };
                roomView.AddChidren(btnRoomName);
                //计算已经加入房间的设备数量
                int addCount = 0;
                foreach (var sd in memberInfo.CurResidenceShareDate)
                {
                    if (room.GetRoomFunctions(false).Find((obj) => obj.deviceId == sd.shareTypeId) != null)
                    {
                        addCount++;
                    }
                    AddRoomFunctionRowLayout(room);
                }
                ////移除当前住宅已经不存在的功能
                //for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;)
                //{
                //    var sd = memberInfo.CurResidenceShareDate[i];
                //    if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
                //    {
                //        //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
                //        memberInfo.CurResidenceShareDate.Remove(sd);
                //    }
                //    else
                //    {
                //        i++;
                //    }
                //}
                var btnFunctionCount = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnRoomName.Bottom,
                    Width = Application.GetRealWidth(330),
                    Height = Application.GetRealWidth(18),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.PromptingColor1,
                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                    Text = addCount + "/" + room.GetRoomFunctions(false).Count.ToString(),
                };
                roomView.AddChidren(btnFunctionCount);
                var btnRight = new Button()
                {
                    X = Application.GetRealWidth(351),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/Right.png",
                };
                roomView.AddChidren(btnRight);
                //分割线
                var lineView = new LineView(roomView.Height - Application.GetRealHeight(1));
                roomView.AddChidren(lineView);
                //删除按钮
                var deleteBtn = new Button()
                {
                    TextID = StringId.Del,
                    BackgroundColor = CSS_Color.AuxiliaryColor2,
                    TextColor = CSS_Color.MainBackgroundColor,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                roomView.AddRightView(deleteBtn);
                deleteBtn.MouseUpEventHandler = (sender, e) =>
                {
                    //删除事件
                };
                EventHandler<MouseEventArgs> eHandler = (sender, e) =>
                {
                    Action<string> refreshFunctionCount = (newCount) => {
                        btnFunctionCount.Text = newCount + "/" + room.GetRoomFunctions(false).Count.ToString();
                    };
                    var mmp = new MemberFunctionPermissionPage(memberInfo, room, refreshFunctionCount);
                    MainPage.BasePageView.AddChidren(mmp);
                    mmp.LoadPage(StringId.PermissionToUse);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                roomView.MouseUpEventHandler = eHandler;
                btnRoomName.MouseUpEventHandler = eHandler;
                btnRight.MouseUpEventHandler = eHandler;
                btnFunctionCount.MouseUpEventHandler = eHandler;
                //2020-12-16 加载未分配区域功能RowLayout
                AddNoAreaFunctionRowLayout(unallocatedList);
            }
            //2020-12-16 加载未分配区域功能
            AddNoAreaFunction(unallocatedList);
            catch
            {
                Utlis.WriteLine("AddRoomFunctionRowLayout error");
            }
        }
        /// <summary>
        /// 添加未分配区域功能
        /// 添加房间分享个数统计状态的RowLayout
        /// </summary>
        /// <param name="unallocatedList"></param>
        void AddNoAreaFunction(List<Function> unallocatedList)
        /// <param name="mRoom"></param>
        void AddRoomFunctionRowLayout(Room mRoom)
        {
            ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null);
        }
        /// <summary>
        /// 添加未分配区域功能 的个数统计状态的RowLayout
        /// </summary>
        /// <param name="unallocatedList">未分配的所有功能列表</param>
        void AddNoAreaFunctionRowLayout(List<Function> unallocatedList)
        {
            ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList);
        }
        /// <summary>
        /// 2020-12-17 重新调整
        /// 添加房间分享或者无区域分配 个数统计状态的RowLayout
        /// </summary>
        /// <param name="room">如果房间为空,代表管理无分配区域</param>
        /// <param name="unallocatedList">管理无分配区域才有效</param>
        void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList)
        {
            /// 当前房间或者无分配区域分享列表
            List<ShareData> funs_RoomAll = new List<ShareData>();
            /// <summary>
            /// 房间或者无分配区域所有功能列表
            /// </summary>
            List<Function> roomFunctionList = new List<Function>();
            /// 房间ID
            string roomId = "";
            var roomView = new RowLayout()
            {
                Height = Application.GetRealWidth(50),
@@ -289,33 +230,25 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                TextID = StringId.NoAreaFunction
                //Text = room.roomName,
            };
            roomView.AddChidren(btnRoomName);
            //计算已经加入房间的设备数量
            int addCount = 0;
            foreach (var sd in memberInfo.CurResidenceShareDate)
            //如果房间为空,代表管理无分配区域
            if (mRoom != null)
            {
                if (unallocatedList.Find((obj) => obj.deviceId == sd.shareTypeId) != null)
                {
                    addCount++;
                }
                //显示房间名
                btnRoomName.Text = mRoom.roomName;
                roomFunctionList = mRoom.GetRoomFunctions(false);
                roomId = mRoom.roomId;
            }
            ////移除当前住宅已经不存在的功能
            //for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;)
            //{
            //    var sd = memberInfo.CurResidenceShareDate[i];
            //    if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
            //    {
            //        //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
            //        memberInfo.CurResidenceShareDate.Remove(sd);
            //    }
            //    else
            //    {
            //        i++;
            //    }
            //}
            else
            {
                //显示无区域功能
                btnRoomName.TextID = StringId.NoAreaFunction;
                roomFunctionList = unallocatedList;
                roomId = null;
            }
            var btnFunctionCount = new Button()
            {
@@ -326,7 +259,7 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                Text = addCount + "/" + unallocatedList.Count.ToString(),
                //Text = addCount + "/" + room.GetRoomFunctions(false).Count.ToString(),
            };
            roomView.AddChidren(btnFunctionCount);
@@ -339,9 +272,9 @@
                UnSelectedImagePath = "Public/Right.png",
            };
            roomView.AddChidren(btnRight);
            ////分割线
            //var lineView = new LineView(roomView.Height - Application.GetRealHeight(1));
            //roomView.AddChidren(lineView);
            //分割线
            var lineView = new LineView(roomView.Height - Application.GetRealHeight(1));
            roomView.AddChidren(lineView);
            //删除按钮
            var deleteBtn = new Button()
            {
@@ -353,25 +286,41 @@
            roomView.AddRightView(deleteBtn);
            deleteBtn.MouseUpEventHandler = (sender, e) =>
            {
                //删除事件
                //一键删除所有分享
                DeleteRoomAllShare(funs_RoomAll, roomFunctionList, roomId, btnFunctionCount, roomView);
            };
            //计算已经加入房间的设备数量的Action事件
            Action RefreshAction = () => {
                funs_RoomAll = new List<ShareData>();
                int addCount = 0;
                foreach (var sd in memberInfo.CurResidenceShareData)
                {
                    if (roomFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) != null)
                    {
                        addCount++;
                        funs_RoomAll.Add(sd);
                    }
                }
                btnFunctionCount.Text = addCount + "/" + roomFunctionList.Count.ToString();
                //Utlis.WriteLine("刷新成功");
            };
            //点击调整事件
            EventHandler<MouseEventArgs> eHandler = (sender, e) =>
            {
                Action<string> refreshFunctionCount = (newCount) => {
                    btnFunctionCount.Text = newCount + "/" + unallocatedList.Count.ToString();
                };
                //var mmp = new MemberFunctionPermissionPage(memberInfo, room, refreshFunctionCount);
                //MainPage.BasePageView.AddChidren(mmp);
                //mmp.LoadPage(StringId.PermissionToUse);
                //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionList, funs_RoomAll, roomId, RefreshAction);
                MainPage.BasePageView.AddChidren(mmp);
                mmp.LoadPage(StringId.MemberPermissionManagement);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            roomView.MouseUpEventHandler = eHandler;
            btnRoomName.MouseUpEventHandler = eHandler;
            btnRight.MouseUpEventHandler = eHandler;
            btnFunctionCount.MouseUpEventHandler = eHandler;
            RefreshAction?.Invoke();
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Threading;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI
@@ -40,16 +42,16 @@
                    var responePack = new HttpServerRequest().GetShareDataByMemberAccount(memberInfo.childAccountId);
                    if (responePack.Code == StateCode.SUCCESS)
                    {
                        if(responePack.Data != null)
                        if (responePack.Data != null)
                        {
                            var responeObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ShareData>>(responePack.Data.ToString());
                            memberInfo.CurResidenceShareDate = responeObj;
                            memberInfo.CurResidenceShareData = responeObj;
                        }
                        else
                        {
                            memberInfo.CurResidenceShareDate = new List<ShareData>();
                            memberInfo.CurResidenceShareData = new List<ShareData>();
                        }
                        Application.RunOnMainThread(() =>
                        {
                            ShowRoomListView();
@@ -57,7 +59,7 @@
                    }
                    else
                    {
                        memberInfo.CurResidenceShareDate = new List<ShareData>();
                        memberInfo.CurResidenceShareData = new List<ShareData>();
                        IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
                    }
                }
@@ -125,5 +127,158 @@
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 一键删除当前房间所有分享
        /// </summary>
        /// <param name="funs_Del">需要一键删除的分享数据</param>
        /// <param name="roomFunctionList">当前房间所有功能列表</param>
        /// <param name="roomId">如果房间ID为空,则代表管理无分配区域的功能,不需要删除房间分享</param>
        /// <param name="btnFunctionCount">个数统计数量</param>
        /// <param name="roomView">背景View</param>
        void DeleteRoomAllShare(List<ShareData> funs_Del, List<Function> roomFunctionList, string roomId, Button btnFunctionCount, RowLayout roomView)
        {
            //需要删除的分享为0
            if (funs_Del == null || funs_Del.Count == 0)
            {
                //关闭右滑菜单
                roomView.HideMenu();
                Utlis.ShowTip(Language.StringByID(StringId.NoShare));
                return;
            }
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            new Thread(() =>
            {
                try
                {
                    bool result = false;
                    //如果房间ID为空,则代表管理无分配区域的功能,不需要删除房间分享
                    if (!string.IsNullOrEmpty(roomId))
                    {
                        //删除房间分享
                        var success = DeleteShareRoom(roomId);
                        if (success)
                        {
                            Utlis.WriteLine("删除房间分享成功");
                        }
                        else
                        {
                            Utlis.WriteLine("删除房间分享失败");
                        }
                    }
                    //2.批量删除分享
                    var deleteShareObj = new DeleteShareObj()
                    {
                        shareDatas = funs_Del,
                        homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID,
                    };
                    result = LoadMethod_DelSharedData(deleteShareObj);
                    if (!result)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.delFail), true);
                        });
                    }
                    else
                    {
                        //删除分享成功
                        //4.1管理最终的分享列表
                        var funs_final = new List<ShareData>();
                        funs_final.AddRange(memberInfo.CurResidenceShareData);
                        //4.2移除删除的
                        foreach (var share_d in funs_Del)
                        {
                            var sd = funs_final.Find((obj) => obj.shareTypeId == share_d.shareTypeId);
                            //如果该功能已经分享,不用分享
                            if (null != sd)
                            {
                                funs_final.Remove(share_d);
                            }
                        }
                        Application.RunOnMainThread(() =>
                        {
                            new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.SavedSuccessfully), true);
                            //清空
                            funs_Del.Clear();
                            memberInfo.CurResidenceShareData = funs_final;
                            btnFunctionCount.Text = 0 + "/" + roomFunctionList.Count.ToString();
                            //关闭右滑菜单
                            roomView.HideMenu();
                        });
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 删除房间分享
        /// </summary>
        /// <returns></returns>
        bool DeleteShareRoom(string roomId)
        {
            var roomList = new List<ShareData>();
            roomList.Add(new ShareData()
            {
                shareType = ShareType.ROOM.ToString(),
                shareTypeId = roomId
            });
            var deleteShareObj = new DeleteShareObj()
            {
                shareDatas = roomList,
                homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID,
            };
            var responePack = new HttpServerRequest().DeleteShareData(deleteShareObj);
            if (responePack.Code != StateCode.SUCCESS)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        /// <summary>
        /// 删除共享数据点击事件
        /// </summary>
        /// <param name="function"></param>
        bool LoadMethod_DelSharedData(DeleteShareObj sd)
        {
            var responePack = new HttpServerRequest().DeleteShareData(sd);
            if (responePack.Code != StateCode.SUCCESS)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -297,6 +297,7 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = DB_ResidenceData.Instance.CurrentRegion.Name,
                IsBold = true
            };
            residenceInfoView.AddChidren(btnCurResidenceName);