From 8e4dd3cdef1348bcf1285576bb946afb85ce2526 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 08 十二月 2020 17:31:27 +0800 Subject: [PATCH] 增加分享设备的时候,判断当前房间分享设备总数,从而决定是否需要增加或者移除房间分享 --- HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs | 282 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 141 insertions(+), 141 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs index 0c37300..45badbc 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs @@ -24,127 +24,7 @@ { if (titleId == StringId.PermissionToUse)//浠庝釜浜轰腑蹇冭繘鍏ュ崟鐙垎浜� { - new Thread(() => - { - try - { - bool result = false; - Action act = () => { }; - Application.RunOnMainThread(() => - { - act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); - }); - - //1.绠$悊鎴块棿鍒嗕韩 - if (funs_New != null && funs_New.Count > 0) - { - //鍒嗕韩璁惧澶т簬0 - var success = ShareRoom(); - if (success) - { - Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩鎴愬姛"); - } - else - { - Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩澶辫触"); - } - } - else - { - var success = DeleteShareRoom(); - if (success) - { - Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩鎴愬姛"); - } - else - { - Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩澶辫触"); - } - } - - //2.鎵归噺鍒犻櫎鍒嗕韩 - var deleteShareObj = new DeleteShareObj() - { - shareDatas = funs_Del, - homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, - }; - LoadMethod_DelSharedData(deleteShareObj); - - //3.鎵归噺涓婁紶 - var funs_NeedAdd = new List<ShareData>(); - foreach (var f in funs_New) - { - var sd = funs.Find((obj) => obj.shareTypeId == f.shareTypeId); - //濡傛灉璇ュ姛鑳藉凡缁忓垎浜紝涓嶇敤鍒嗕韩 - if (null == sd) - { - funs_NeedAdd.Add(f); - - } - } - - List<string> childAccountIds = new List<string>(); - childAccountIds.Add(memberInfo.childAccountId); - var addShareObj = new AddShareObj() - { - shareDatas = funs_NeedAdd, - childAccountIds = childAccountIds, - homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, - }; - result = LoadMethod_AddShareData(addShareObj); - - if (!result) - { - Application.RunOnMainThread(() => - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingFailed), true); - }); - } - - - Application.RunOnMainThread(() => - { - act(); - }); - if (result) - { - //4.1绠$悊鏈�缁堢殑鍒嗕韩鍒楄〃 - var funs_final = new List<ShareData>(); - funs_final.AddRange(funs); - //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); - } - } - //4.3娣诲姞鏂板鐨� - funs_final.AddRange(funs_NeedAdd); - - Application.RunOnMainThread(() => - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingSucceeded), true); - memberInfo.CurResidenceShareDate = 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()); - }); - } - } - catch { } - finally - { - - } - }) - { IsBackground = true }.Start(); + UploadShareDeviceList(); } else { @@ -156,6 +36,133 @@ //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } }; + } + + /// <summary> + /// 绠$悊璁惧鍒嗕韩 + /// 2020-12-08 1.澧炲姞鍒嗕韩璁惧鐨勬椂鍊欙紝鍒ゆ柇褰撳墠鎴块棿鍒嗕韩璁惧鎬绘暟锛屼粠鑰屽喅瀹氭槸鍚﹂渶瑕佸鍔犳垨鑰呯Щ闄ゆ埧闂村垎浜� + /// </summary> + void UploadShareDeviceList() + { + new Thread(() => + { + try + { + bool result = false; + Action act = () => { }; + Application.RunOnMainThread(() => + { + act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); + }); + + //1.绠$悊鏈�缁堝睘浜庢埧闂寸殑鍒嗕韩 + if (funs_New != null && funs_New.Count > 0) + { + //鏈�缁堝睘浜庢埧闂寸殑鍒嗕韩澶т簬0 + var success = ShareRoom(); + if (success) + { + Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩鎴愬姛"); + } + else + { + Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩澶辫触"); + } + } + else + { + var success = DeleteShareRoom(); + if (success) + { + Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩鎴愬姛"); + } + else + { + Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩澶辫触"); + } + } + + //2.鎵归噺鍒犻櫎鍒嗕韩 + var deleteShareObj = new DeleteShareObj() + { + shareDatas = funs_Del, + homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, + }; + LoadMethod_DelSharedData(deleteShareObj); + + //3.鎵归噺涓婁紶 + var funs_NeedAdd = new List<ShareData>(); + foreach (var f in funs_New) + { + var sd = funs.Find((obj) => obj.shareTypeId == f.shareTypeId); + //濡傛灉璇ュ姛鑳藉凡缁忓垎浜紝涓嶇敤鍒嗕韩 + if (null == sd) + { + funs_NeedAdd.Add(f); + } + } + //3.1 鎻愪氦璇锋眰 + List<string> childAccountIds = new List<string>(); + childAccountIds.Add(memberInfo.childAccountId); + var addShareObj = new AddShareObj() + { + shareDatas = funs_NeedAdd, + childAccountIds = childAccountIds, + homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, + }; + result = LoadMethod_AddShareData(addShareObj); + + if (!result) + { + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingFailed), true); + }); + } + + Application.RunOnMainThread(() => + { + act(); + }); + if (result) + { + //4.1绠$悊鏈�缁堢殑鍒嗕韩鍒楄〃 + var funs_final = new List<ShareData>(); + funs_final.AddRange(funs); + //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); + } + } + //4.3娣诲姞鏂板鐨� + funs_final.AddRange(funs_NeedAdd); + + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingSucceeded), true); + memberInfo.CurResidenceShareDate = 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()); + }); + } + } + catch { } + finally + { + + } + }) + { IsBackground = true }.Start(); } /// <summary> @@ -202,7 +209,8 @@ bool ShareRoom() { var roomList = new List<ShareData>(); - roomList.Add(new ShareData() { + roomList.Add(new ShareData() + { shareType = ShareType.ROOM.ToString(), shareTypeId = room.roomId }); @@ -254,22 +262,13 @@ } } - ///// <summary> - ///// 鏇存柊鍏变韩鏁版嵁 - ///// </summary> - //bool EditShareData(ShareData sd) - //{ - // var responePack = new HttpServerRequest().EditShareData(sd); - // if (responePack.Code == StateCode.SUCCESS) - // { - // return true; - // } - // else - // { - // return false; - // } - //} - + /// <summary> + /// LoadMethod_SharedDataChange + /// </summary> + /// <param name="btnChoose"></param> + /// <param name="btn2"></param> + /// <param name="btn3"></param> + /// <param name="function"></param> void LoadMethod_SharedDataChange(Button btnChoose, Button btn2, FrameLayout btn3, Function function) { EventHandler<MouseEventArgs> eventHandler = (sender, e) => @@ -295,7 +294,7 @@ { var newSd = new ShareData(); newSd.shareTypeId = function.deviceId; - + funs_New.Add(newSd); } btnChooseAll.IsSelected = true; @@ -335,6 +334,7 @@ btn2.MouseUpEventHandler = eventHandler; btn3.MouseUpEventHandler = eventHandler; } + /// <summary> /// 鍏ㄩ�夋寜閽偣鍑讳簨浠� /// </summary> @@ -347,7 +347,7 @@ funs_New = new List<ShareData>(); if (btnChooseAll.IsSelected) { - foreach(var f in room.GetRoomFunctions(false)) + foreach (var f in room.GetRoomFunctions(false)) { var ssdd = new ShareData(); ssdd.shareTypeId = f.deviceId; @@ -356,7 +356,7 @@ } else { - foreach(var f in room.GetRoomFunctions(false)) + foreach (var f in room.GetRoomFunctions(false)) { var sd = funs.Find((obj) => obj.shareTypeId == f.deviceId); if (sd != null) -- Gitblit v1.8.0