wxr
2020-12-23 fa7d172c21d4a78925ae39b3cbfe7b100c3dead9
Merge branch 'CJL' into NewFilePath
9个文件已修改
335 ■■■■ 已修改文件
HDL_ON/Common/HDLCommon.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewApiRes.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePage.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs 126 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/HDLCommon.cs
@@ -258,11 +258,11 @@
                {
                    Shared.Application.RunOnMainThread(() =>
                    {
                        //账号在别处登陆,被踢下线 跳转到登录页面
                        new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
                        ////账号在别处登陆,被踢下线 跳转到登录页面
                        //new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
                        //退出登录操作
                        CheckLogout();
                    });
                    return;
                }
@@ -290,6 +290,8 @@
        }
        /// <summary>
        /// 账号在别处登陆,被踢下线 跳转到登录页面
        /// 要在主线程调用
        /// 退出登录操作
        /// </summary>
        public void CheckLogout()
@@ -297,6 +299,9 @@
            //未登录不用处理
            if (!UserInfo.Current.IsLogin) return;
            //账号在别处登陆,被踢下线 跳转到登录页面
            new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
#if DEBUG
            return;
#endif
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -557,7 +557,12 @@
            DisConnectRemoteMqttClient("挤下线");
            HDLCommon.Current.CheckLogout();
            Application.RunOnMainThread(() =>
            {
                //弹窗提示被挤下线
                HDLCommon.Current.CheckLogout();
            });
            //UserInfo.Current.LastTime = DateTime.MinValue;
            //UserInfo.Current.SaveUserInfo();
HDL_ON/DAL/Server/NewApiRes.cs
@@ -1360,10 +1360,11 @@
        /// 子账号ID
        /// </summary>
        public string childAccountId;
        /// <summary>
        /// 分享类型 1.ROOM  2.DEVICE 3.SCENE
        /// </summary>
        public string shareType = "DEVICE";
        ///// <summary>
        ///// 分享类型 1.ROOM  2.DEVICE 3.SCENE
        ///// 不传默认查全部
        ///// </summary>
        //public string shareType = "DEVICE";
    }
    #endregion
HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -130,7 +130,8 @@
                };
                topView.AddChidren(btnLinkStateTip);
                //更新链接状态icon颜色
                LoadEvent_CheckLinkStatus();
                CheckLinkStatus();//2020-12-22
                //LoadEvent_CheckLinkStatus();
                btnResidenceName = new Button()
                {
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -21,32 +21,63 @@
                bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25;
            }
        }
        /// <summary>
        /// 更新连接状态图标
        /// </summary>
        void CheckLinkStatus()
        {
            if (Control.Ins.GatewayOnline)
            {
                if (Control.Ins.IsRemote)
                {
                    bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.MainColor;
                }
                else
                {
                    bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipRemote;
                }
            }
            else
            {
                bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail;
            }
        }
        /// <summary>
        /// 确认连接状态
        /// </summary>
        public static void LoadEvent_CheckLinkStatus()
        {
            if (bodyView != null)
            Application.RunOnMainThread(() =>
            {
                Application.RunOnMainThread(() =>
                if (bodyView != null)
                {
                    if (Control.Ins.GatewayOnline)
                    {
                        if (Control.Ins.IsRemote)
                        {
                            bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.MainColor;
                        }
                        else
                        {
                            bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipRemote;
                        }
                    }
                    else
                    {
                        bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail;
                    }
                });
            }
                    bodyView.CheckLinkStatus();
                }
            });
            //if (bodyView != null)
            //{
            //    Application.RunOnMainThread(() =>
            //    {
            //        if (Control.Ins.GatewayOnline)
            //        {
            //            if (Control.Ins.IsRemote)
            //            {
            //                bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.MainColor;
            //            }
            //            else
            //            {
            //                bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipRemote;
            //            }
            //        }
            //        else
            //        {
            //            bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail;
            //        }
            //    });
            //}
        }
        /// <summary>
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
old mode 100755 new mode 100644
@@ -37,9 +37,10 @@
        /// </summary>
        string roomId;
        /// <summary>
        /// 房间所有功能列表
        /// 房间所有功能和场景列表
        /// </summary>
        List<Function> roomFunctionList = new List<Function>();
        List<RoomData> roomFunctionOrSceneList = new List<RoomData>();
        /// <summary>
        /// 刷新回调Action
@@ -63,14 +64,14 @@
        /// 
        /// </summary>
        /// <param name="mInfo"></param>
        /// <param name="roomFunctionList"></param>
        /// <param name="roomFunctionOrSceneList">房间所有功能和场景列表</param>
        /// <param name="roomId"></param>
        /// <param name="refreshAction"></param>
        public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, List<Function> roomFunctionList, List<ShareData> funs_RoomAll, string roomId, Action refreshAction)
        public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, List<RoomData> roomFunctionOrSceneList, List<ShareData> funs_RoomAll, string roomId, Action refreshAction)
        {
            bodyView = this;
            this.memberInfo = mInfo;
            this.roomFunctionList = roomFunctionList;
            this.roomFunctionOrSceneList = roomFunctionOrSceneList;
            this.roomId = roomId;
            //this.curResidenceShareData = new List<ShareData>();
            this.curResidenceShareData = memberInfo.CurResidenceShareData;
@@ -160,7 +161,7 @@
        void LoadFunctionRow(List<ShareData> shareDatas)
        {
            contentView.RemoveAll();
            foreach (var function in roomFunctionList)
            foreach (var roomData in roomFunctionOrSceneList)
            {
                var roomView = new FrameLayout()
                {
@@ -177,7 +178,7 @@
                    TextSize = CSS_FontSize.SubheadingFontSize,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = function.name,
                    Text = roomData.name,
                };
                roomView.AddChidren(btnRoomText);
@@ -193,7 +194,7 @@
                };
                roomView.AddChidren(btnChoose);
                var shareData = shareDatas.Find((obj) => obj.shareTypeId == function.deviceId);
                var shareData = shareDatas.Find((obj) => obj.shareTypeId == roomData.shareTypeId);
                if (shareData != null)
                {
                    btnChoose.IsSelected = true;
@@ -205,7 +206,7 @@
                    if (btnChooseAll.IsSelected)
                        btnChooseAll.IsSelected = false;
                }
                LoadMethod_SharedDataChange(btnChoose, btnRoomText, roomView, function);
                LoadMethod_SharedDataChange(btnChoose, btnRoomText, roomView, roomData);
                var btnLine = new Button()
                {
@@ -217,7 +218,28 @@
                };
                contentView.AddChidren(btnLine);
            }
        }
    }
    /// <summary>
    /// 房间所有功能和者场景列表
    /// </summary>
    public class RoomData
    {
        /// <summary>
        /// 设备名字或者场景名字
        /// </summary>
        public string shareTypeId;
        /// <summary>
        /// 设备名字或者场景名字
        /// </summary>
        public string name;
        /// <summary>
        /// 分享类型 1.ROOM  2.DEVICE 3.SCENE
        /// </summary>
        public string shareType = ShareType.DEVICE.ToString();
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs
old mode 100755 new mode 100644
@@ -67,11 +67,12 @@
                        act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait));
                    });
                    if (!string.IsNullOrEmpty(roomId))
                    {
                        //如果房间ID不为空,管理房间
                        ManageRoomSharing();
                    }
                    //2020-12-22 屏蔽房间分享管理
                    //if (!string.IsNullOrEmpty(roomId))
                    //{
                    //    //如果房间ID不为空,管理房间
                    //    ManageRoomSharing();
                    //}
                  
                    //2.批量删除分享
@@ -296,12 +297,12 @@
        /// <param name="btn2"></param>
        /// <param name="btn3"></param>
        /// <param name="function"></param>
        void LoadMethod_SharedDataChange(Button btnChoose, Button btn2, FrameLayout btn3, Function function)
        void LoadMethod_SharedDataChange(Button btnChoose, Button btn2, FrameLayout btn3, RoomData roomData)
        {
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                btnChoose.IsSelected = !btnChoose.IsSelected;
                var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == function.deviceId);
                var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == roomData.shareTypeId);
                if (btnChoose.IsSelected)
                {
                    try
@@ -320,14 +321,14 @@
                        else
                        {
                            var newSd = new ShareData();
                            newSd.shareTypeId = function.deviceId;
                            newSd.shareTypeId = roomData.shareTypeId;
                            funs_RoomAll.Add(newSd);
                        }
                        btnChooseAll.IsSelected = true;
                        foreach (var f in roomFunctionList)
                        foreach (var f in roomFunctionOrSceneList)
                        {
                            if (funs_RoomAll.Find((obj) => obj.shareTypeId == f.deviceId) == null)
                            if (funs_RoomAll.Find((obj) => obj.shareTypeId == f.shareTypeId) == null)
                            {
                                btnChooseAll.IsSelected = false;
                                break;
@@ -341,7 +342,7 @@
                }
                else
                {
                    var onFuns = funs_RoomAll.Find((obj) => obj.shareTypeId == function.deviceId);
                    var onFuns = funs_RoomAll.Find((obj) => obj.shareTypeId == roomData.shareTypeId);
                    if (funs_RoomAll.Contains(onFuns))
                    {
                        funs_RoomAll.Remove(onFuns);
@@ -374,18 +375,19 @@
                funs_RoomAll = new List<ShareData>();
                if (btnChooseAll.IsSelected)
                {
                    foreach (var f in roomFunctionList)
                    foreach (var f in roomFunctionOrSceneList)
                    {
                        var ssdd = new ShareData();
                        ssdd.shareTypeId = f.deviceId;
                        ssdd.shareTypeId = f.shareTypeId;
                        ssdd.shareType = f.shareType;
                        funs_RoomAll.Add(ssdd);
                    }
                }
                else
                {
                    foreach (var f in roomFunctionList)
                    foreach (var f in roomFunctionOrSceneList)
                    {
                        var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.deviceId);
                        var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.shareTypeId);
                        if (sd != null)
                        {
                            funs_Del.Add(sd);
@@ -399,4 +401,7 @@
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs
old mode 100755 new mode 100644
@@ -146,21 +146,41 @@
                }
            }
            //移除当前住宅已经不存在的功能
            for (int i = 0; i < memberInfo.CurResidenceShareData.Count;)
            //所有场景
            List<Scene> allSceneList = FunctionList.List.scenes;
            //全局场景场景
            List<Scene> globalSceneList = new List<Scene>();
            //找出所有的全局场景
            foreach (var mScene in allSceneList)
            {
                var sd = memberInfo.CurResidenceShareData[i];
                if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
                //roomIds大于0 代表分配到房间
                mScene.roomIds.Remove(null);
                if (mScene.roomIds.Count > 0)
                {
                    //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
                    //待确认是否同步云端删除分享
                    memberInfo.CurResidenceShareData.Remove(sd);
                    //allocatedList.Add(function);
                }
                else
                {
                    i++;
                    globalSceneList.Add(mScene);
                }
            }
            ////移除当前住宅已经不存在的功能
            //for (int i = 0; i < memberInfo.CurResidenceShareData.Count;)
            //{
            //    var sd = memberInfo.CurResidenceShareData[i];
            //    if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
            //    {
            //        //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
            //        //待确认是否同步云端删除分享
            //        memberInfo.CurResidenceShareData.Remove(sd);
            //    }
            //    else
            //    {
            //        i++;
            //    }
            //}
            try
            {
@@ -170,7 +190,7 @@
                    AddRoomFunctionRowLayout(room);
                }
                //2020-12-16 加载未分配区域功能RowLayout
                AddNoAreaFunctionRowLayout(unallocatedList);
                AddNoAreaFunctionRowLayout(unallocatedList, globalSceneList);
            }
            catch
            {
@@ -184,16 +204,17 @@
        /// <param name="mRoom"></param>
        void AddRoomFunctionRowLayout(Room mRoom)
        {
            ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null);
            ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null, null);
        }
        /// <summary>
        /// 添加未分配区域功能 的个数统计状态的RowLayout
        ///
        /// </summary>
        /// <param name="unallocatedList">未分配的所有功能列表</param>
        void AddNoAreaFunctionRowLayout(List<Function> unallocatedList)
        /// <param name="globalSceneList">全区域的场景</param>
        void AddNoAreaFunctionRowLayout(List<Function> unallocatedList, List<Scene> globalSceneList)
        {
            ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList);
            ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList, globalSceneList);
        }
        /// <summary>
@@ -202,14 +223,15 @@
        /// </summary>
        /// <param name="room">如果房间为空,代表管理无分配区域</param>
        /// <param name="unallocatedList">管理无分配区域才有效</param>
        void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList)
        /// <param name="globalSceneList">全局场景</param>
        void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList, List<Scene> globalSceneList)
        {
            /// 当前房间或者无分配区域分享列表
            List<ShareData> funs_RoomAll = new List<ShareData>();
            /// <summary>
            /// 房间或者无分配区域所有功能列表
            /// </summary>
            List<Function> roomFunctionList = new List<Function>();
            /// 房间所有功能和者场景列表
            List<RoomData> roomFunctionOrSceneList = new List<RoomData>();
            /// 房间ID
            string roomId = "";
@@ -264,7 +286,36 @@
            {
                //显示房间名
                btnRoomName.Text = mRoom.roomName;
                roomFunctionList = mRoom.GetRoomFunctions(false);
                var mRoomFunctionList = mRoom.GetRoomFunctions(false);
                var mRoomSceneList = mRoom.GetRoomScenes(false);
                //遍历所有功能列表
                if (mRoomFunctionList != null)
                {
                    foreach (var fun in mRoomFunctionList)
                    {
                        roomFunctionOrSceneList.Add(new RoomData()
                        {
                            shareTypeId = fun.deviceId,
                            shareType = ShareType.DEVICE.ToString(),
                            name = fun.name,
                        });
                    }
                }
                //遍历所有场景列表
                if (mRoomSceneList != null)
                {
                    foreach (var roomScene in mRoomSceneList)
                    {
                        roomFunctionOrSceneList.Add(new RoomData()
                        {
                            shareTypeId = roomScene.userSceneId,
                            shareType = ShareType.SCENE.ToString(),
                            name = roomScene.name,
                        });
                    }
                }
                roomId = mRoom.roomId;
                //添加分割线
                var lineView = new LineView(roomView.Height - Application.GetRealHeight(1));
@@ -274,8 +325,35 @@
            {
                //显示无区域功能
                btnRoomName.TextID = StringId.NoAreaFunction;
                roomFunctionList = unallocatedList;
                roomId = null;
                //遍历所有功能列表
                if (unallocatedList != null)
                {
                    foreach (var fun in unallocatedList)
                    {
                        roomFunctionOrSceneList.Add(new RoomData()
                        {
                            shareTypeId = fun.deviceId,
                            shareType = ShareType.DEVICE.ToString(),
                            name = fun.name,
                        });
                    }
                }
                //遍历所有场景列表
                if (globalSceneList != null)
                {
                    foreach (var roomScene in globalSceneList)
                    {
                        roomFunctionOrSceneList.Add(new RoomData()
                        {
                            shareTypeId = roomScene.userSceneId,
                            shareType = ShareType.SCENE.ToString(),
                            name = roomScene.name,
                        });
                    }
                }
            }
            //删除按钮
@@ -290,7 +368,7 @@
            deleteBtn.MouseUpEventHandler = (sender, e) =>
            {
                //一键删除所有分享
                DeleteRoomAllShare(funs_RoomAll, roomFunctionList, roomId, btnFunctionCount, roomView);
                DeleteRoomAllShare(funs_RoomAll, roomFunctionOrSceneList, roomId, btnFunctionCount, roomView);
            };
            //计算已经加入房间的设备数量的Action事件
@@ -299,19 +377,19 @@
                int addCount = 0;
                foreach (var sd in memberInfo.CurResidenceShareData)
                {
                    if (roomFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) != null)
                    if (roomFunctionOrSceneList.Find((obj) => obj.shareTypeId == sd.shareTypeId) != null)
                    {
                        addCount++;
                        funs_RoomAll.Add(sd);
                    }
                }
                btnFunctionCount.Text = addCount + "/" + roomFunctionList.Count.ToString();
                btnFunctionCount.Text = addCount + "/" + roomFunctionOrSceneList.Count.ToString();
                //Utlis.WriteLine("刷新成功");
            };
            //点击调整事件
            EventHandler<MouseEventArgs> eHandler = (sender, e) =>
            {
                var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionList, funs_RoomAll, roomId, RefreshAction);
                var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionOrSceneList, funs_RoomAll, roomId, RefreshAction);
                MainPage.BasePageView.AddChidren(mmp);
                mmp.LoadPage(StringId.MemberPermissionManagement);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs
old mode 100755 new mode 100644
@@ -132,11 +132,11 @@
        /// 一键删除当前房间所有分享
        /// </summary>
        /// <param name="funs_Del">需要一键删除的分享数据</param>
        /// <param name="roomFunctionList">当前房间所有功能列表</param>
        /// <param name="roomFunctionOrSceneList">当前房间所有功能列表</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)
        void DeleteRoomAllShare(List<ShareData> funs_Del, List<RoomData> roomFunctionOrSceneList, string roomId, Button btnFunctionCount, RowLayout roomView)
        {
            //需要删除的分享为0
            if (funs_Del == null || funs_Del.Count == 0)
@@ -156,20 +156,21 @@
                try
                {
                    bool result = false;
                    //如果房间ID为空,则代表管理无分配区域的功能,不需要删除房间分享
                    if (!string.IsNullOrEmpty(roomId))
                    {
                        //删除房间分享
                        var success = DeleteShareRoom(roomId);
                        if (success)
                        {
                            Utlis.WriteLine("删除房间分享成功");
                        }
                        else
                        {
                            Utlis.WriteLine("删除房间分享失败");
                        }
                    }
                    //2020-12-22 屏蔽房间分享管理
                    ////如果房间ID为空,则代表管理无分配区域的功能,不需要删除房间分享
                    //if (!string.IsNullOrEmpty(roomId))
                    //{
                    //    //删除房间分享
                    //    var success = DeleteShareRoom(roomId);
                    //    if (success)
                    //    {
                    //        Utlis.WriteLine("删除房间分享成功");
                    //    }
                    //    else
                    //    {
                    //        Utlis.WriteLine("删除房间分享失败");
                    //    }
                    //}
                    //2.批量删除分享
                    var deleteShareObj = new DeleteShareObj()
@@ -209,7 +210,7 @@
                            //清空
                            funs_Del.Clear();
                            memberInfo.CurResidenceShareData = funs_final;
                            btnFunctionCount.Text = 0 + "/" + roomFunctionList.Count.ToString();
                            btnFunctionCount.Text = 0 + "/" + roomFunctionOrSceneList.Count.ToString();
                            //关闭右滑菜单
                            roomView.HideMenu();
                        });