From 5ea6aa8ea047d4d7b6137fa86c03109aeb1b67ff Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 18 十二月 2020 18:03:18 +0800 Subject: [PATCH] Merge branch 'CJL' into NewFilePath --- HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs | 78 + HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs | 5 HDL-ON_Android/Assets/Language.ini | 9 HDL-ON_Android/Assets/Phone/Public/PopupDialog.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs | 143 ++- HDL-ON_iOS/AppDelegate.cs | 15 HDL_ON/HDL_ON.projitems | 3 HDL_ON/UI/UI0-Public/Widget/SelectPopupDialog.cs | 527 ++++++++++++ HDL_ON/UI/UI0-Public/Widget/TextButton.cs | 91 + HDL_ON/DAL/Server/IMessageCommon.cs | 9 HDL-ON_iOS/Resources/Language.ini | 9 HDL_ON/DAL/Server/NewApiRes.cs | 83 - HDL_ON/Common/HDLCommon.cs | 17 HDL_ON/UI/UI0-Public/PublicAssmebly.cs | 8 HDL_ON/Common/Utlis.cs | 77 + HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs | 77 HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs | 10 HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs | 29 HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs | 4 HDL_ON/Common/Constant.cs | 31 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs | 320 ++++-- HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 10 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs | 217 ++++ HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs | 630 +++++++++++++++ HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs | 4 HDL_ON/Entity/Function/Function.cs | 1 HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/FunctionIntroductionPage.cs | 14 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 1 HDL_ON/Common/R.cs | 23 HDL-ON_Android/Other/JPush/JPushReceiver.cs | 39 31 files changed, 2,107 insertions(+), 377 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 2ca0eec..5e20c6b 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -253,7 +253,7 @@ 231=鍏朵粬鍖哄煙 232=鎴愬憳绠$悊 233=鏄电О -234=浣跨敤鏉冮檺 +234=鎴愬憳鏉冮檺绠$悊 235=鍒涘缓鍦烘櫙 236=鏄电О涓嶈兘涓虹┖ 237=缂栬緫鏄电О @@ -273,7 +273,7 @@ 251=娣诲姞澶辫触锛屾潈闄愪笉瓒炽�� 252=淇濆瓨鎴愬姛 253=淇濆瓨涓紝璇风◢鍚� -254=淇敼鎴愬憳鏄电О +254=鏄电О缂栬緫 255=绉婚櫎璇ユ垚鍛� 256=鏆傛棤宸叉敹钘忕殑鍔熻兘 257=璇疯緭鍏ュ唴瀹� @@ -586,6 +586,11 @@ 9053=鎺ㄩ�佹敞鍐屽紓甯� 9054=鏁板瓧瀵嗙爜楠岃瘉 9055=缁樺埗鎵嬪娍楠岃瘉 +9056=骞� +9057=鏃犲尯鍩熷姛鑳� +9058=鏄惁闇�瑕佷繚瀛� +9059=鏆傛棤鍒嗕韩 +9060=浣跨敤鏉冮檺 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� 10001=璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 diff --git a/HDL-ON_Android/Assets/Phone/Public/PopupDialog.png b/HDL-ON_Android/Assets/Phone/Public/PopupDialog.png new file mode 100644 index 0000000..6c95d58 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Public/PopupDialog.png Binary files differ diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs index f24b091..2665c1d 100644 --- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs +++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs @@ -50,12 +50,43 @@ Content = notificationMessage.NotificationContent, Extras = notificationMessage.NotificationExtras }; + + var jpushExpandData = GetJPushExpandData(pushMes); + if (jpushExpandData != null && jpushExpandData.messageType != null) + { + pushMes.messageType = jpushExpandData.messageType; + System.Console.WriteLine("PushMes messageType : " + pushMes.messageType); + } + System.Console.WriteLine("PushMes title : " + pushMes.Title); System.Console.WriteLine("PushMes message : " + pushMes.Content); System.Console.WriteLine("PushMes extras : " + pushMes.Extras); HDLCommon.Current.AdjustPushMessage(pushMes); } + + /// <summary> + /// + /// </summary> + /// <param name="pushMes"></param> + /// <returns></returns> + ExpandData GetJPushExpandData(JPushMessageInfo pushMes) + { + try + { + if (pushMes.Extras != null) + { + var jpushExpandData = Newtonsoft.Json.JsonConvert.DeserializeObject<JPushExpandData>(pushMes.Extras.ToString()); + return Newtonsoft.Json.JsonConvert.DeserializeObject<ExpandData>(jpushExpandData.expandData); + } + return null; + } + catch + { + return null; + } + } + /// <summary> /// 娉ㄥ唽鎴愬姛鍥炶皟 @@ -122,6 +153,14 @@ Content = notificationMessage.NotificationContent, Extras = notificationMessage.NotificationExtras }; + + var jpushExpandData = GetJPushExpandData(pushMes); + if (jpushExpandData != null && jpushExpandData.messageType != null) + { + pushMes.messageType = jpushExpandData.messageType; + System.Console.WriteLine("PushMes messageType : " + pushMes.messageType); + } + System.Console.WriteLine("PushMes title : " + pushMes.Title); System.Console.WriteLine("PushMes message : " + pushMes.Content); System.Console.WriteLine("PushMes extras : " + pushMes.Extras); diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index 20b5b0b..71bc528 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -295,6 +295,7 @@ var body = alert["body"] as NSString; var title = alert["title"] as NSString; var expandData = ""; + var messageType = ""; if (userInfo.ContainsKey(new NSString("expandData"))) { var expandDataStr = userInfo["expandData"] as NSString; @@ -304,6 +305,11 @@ if (expandDataNSD != null) { expandData = expandDataNSD.ToString(); + if(expandDataNSD.ContainsKey(new NSString("messageType"))){ + messageType = expandDataNSD["messageType"] as NSString; + Utlis.WriteLine("messageType: "+ messageType); + } + } } else @@ -311,20 +317,13 @@ expandData = expandDataStr; } - //var expandDataNSD = userInfo["expandData"] as NSDictionary; - //if (expandDataNSD != null && expandDataNSD is NSDictionary) - //{ - // if (expandDataNSD.ContainsKey(new NSString("messageType"))) - // { - // expandData = expandDataNSD["messageType"] as NSString; - // } - //} } var pushMes = new JPushMessageInfo() { Title = title, Content = body, Extras = expandData, + messageType = messageType }; System.Console.WriteLine("PushMes title : " + pushMes.Title); System.Console.WriteLine("PushMes message : " + pushMes.Content); diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 8540797..5956521 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -253,7 +253,7 @@ 231=鍏朵粬鍖哄煙 232=鎴愬憳绠$悊 233=鏄电О -234=浣跨敤鏉冮檺 +234=鎴愬憳鏉冮檺绠$悊 235=鍒涘缓鍦烘櫙 236=鏄电О涓嶈兘涓虹┖ 237=缂栬緫鏄电О @@ -273,7 +273,7 @@ 251=娣诲姞澶辫触锛屾潈闄愪笉瓒炽�� 252=淇濆瓨鎴愬姛 253=淇濆瓨涓紝璇风◢鍚� -254=淇敼鎴愬憳鏄电О +254=鏄电О缂栬緫 255=绉婚櫎璇ユ垚鍛� 256=鏆傛棤宸叉敹钘忕殑鍔熻兘 257=璇疯緭鍏ュ唴瀹� @@ -587,6 +587,11 @@ 9053=鎺ㄩ�佹敞鍐屽紓甯� 9054=鏁板瓧瀵嗙爜楠岃瘉 9055=缁樺埗鎵嬪娍楠岃瘉 +9056=骞� +9057=鏃犲尯鍩熷姛鑳� +9058=鏄惁闇�瑕佷繚瀛� +9059=鏆傛棤鍒嗕韩 +9060=浣跨敤鏉冮檺 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� 10001=璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 diff --git a/HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png b/HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png new file mode 100644 index 0000000..6c95d58 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png Binary files differ diff --git a/HDL_ON/Common/Constant.cs b/HDL_ON/Common/Constant.cs index ff3f1b5..f611384 100755 --- a/HDL_ON/Common/Constant.cs +++ b/HDL_ON/Common/Constant.cs @@ -236,6 +236,37 @@ } /// <summary> + /// 鎺ㄩ�佹秷鎭疢essageType + /// </summary> + public enum PushMessageType + { + /// <summary> + /// Prompt + /// </summary> + Prompt = 0, + /// <summary> + /// 鎶ヨ绫� + /// </summary> + Alarm, + /// <summary> + /// 涓版灄鍙瀵硅鍛煎彨 + /// </summary> + FLCall, + /// <summary> + /// 鎸や笅绾挎帹閫� + /// </summary> + OffLine, + /// <summary> + /// 鑷姩鍖栨墽琛� + /// </summary> + LogicExecute, + /// <summary> + /// 瀹夐槻鎶ヨ + /// </summary> + SecurityAlarm, + } + + /// <summary> /// BottomLine 绫诲瀷 /// </summary> public enum BottomLineType diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index d3f1eba..02943ea 100755 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -269,7 +269,11 @@ { Shared.Application.RunOnMainThread(() => { - new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); + //鎶ヨ鎺ㄩ�佹墠寮圭獥鎻愮ず锛坢essageType鍖呭惈Alarm鍏抽敭瀛楃殑锛� + if (jpushMessageInfo.messageType != null && jpushMessageInfo.messageType.Contains("Alarm")) + { + new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); + } GetPushMessageAction?.Invoke(); }); return; @@ -366,6 +370,17 @@ break; } } + + + /// <summary> + /// + /// </summary> + /// <param name="userName"></param> + /// <returns></returns> + public string GetUserName(string userName) + { + return string.IsNullOrEmpty(userName) ? Language.StringByID(StringId.UsersWhoNameIsEmpty) : userName; + } #endregion } } diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 43209de..21dda1c 100755 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -150,7 +150,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; @@ -754,7 +754,26 @@ /// 缁樺埗鎵嬪娍楠岃瘉 /// </summary> public const int GestureVerification = 9055; - + /// <summary> + /// 骞� + /// </summary> + public const int Years = 9056; + /// <summary> + /// 鏃犲尯鍩熷姛鑳� + /// </summary> + public const int NoAreaFunction = 9057; + /// <summary> + /// 鏄惁闇�瑕佷繚瀛� + /// </summary> + public const int IfNeedToSave = 9058; + /// <summary> + /// 鏆傛棤鍒嗕韩 + /// </summary> + public const int NoShare = 9059; + /// <summary> + /// 浣跨敤鏉冮檺 + /// </summary> + public const int PermissionToUse = 9060; #region 缃戠粶璇锋眰鍝嶅簲閿欒鎻愮ず淇℃伅 diff --git a/HDL_ON/Common/Utlis.cs b/HDL_ON/Common/Utlis.cs index 62cb24e..a0d84c0 100755 --- a/HDL_ON/Common/Utlis.cs +++ b/HDL_ON/Common/Utlis.cs @@ -336,6 +336,33 @@ private const int Day = 24 * Hour; private const int Month = 30 * Day; + ///// <summary> + ///// 鏃堕棿杞崲 + ///// 灏戜簬1澶� 鏄剧ず 鏃跺垎 + ///// 灏戜簬涓�骞� 鏄剧ず 鏈堟棩 + ///// 澶т簬涓�骞� 鏄剧ず 骞� + ///// </summary> + ///// <param name="dateTime"></param> + ///// <returns></returns> + //public static string ToFriendlyDisplay(this DateTime dateTime) + //{ + // var ts = DateTime.Now - dateTime; + // var delta = ts.TotalSeconds; + // if (delta < Day) + // { + // //鏄剧ず 鏃�:鍒� + // return dateTime.ToString("HH:mm"); + // } + // else if (delta < 12 * Month) + // { + // //鏄剧ず 鏈�:鏃� + // return dateTime.ToString("MM/dd"); + // } + // else + // { //鏄剧ず 骞� + // return dateTime.ToString("yyyy"); + // } + //} /// <summary> /// 鏃堕棿杞崲 /// 灏戜簬1澶� 鏄剧ず 鏃跺垎 @@ -346,23 +373,42 @@ /// <returns></returns> public static string ToFriendlyDisplay(this DateTime dateTime) { - var ts = DateTime.Now - dateTime; - var delta = ts.TotalSeconds; - if (delta < 24 * Hour) - { - //鏄剧ず 鏃�:鍒� - return dateTime.ToString("HH:mm"); - } - else if (delta < 12 * Month) - { - //鏄剧ず 鏈�:鏃� - return dateTime.ToString("MM/dd"); - } - else - { //鏄剧ず 骞� + var nowDateTime = DateTime.Now; + var subYear = nowDateTime.Year - dateTime.Year; + var subMonth = nowDateTime.Month - dateTime.Month; + var subDay = nowDateTime.Day - dateTime.Day; + + //骞翠唤宸�煎ぇ浜�0 + if(subYear > 0) + { + //鏄剧ず 骞� return dateTime.ToString("yyyy"); - } + } + else + { + //鐩稿悓骞翠唤锛屾湀浠藉樊鍊煎ぇ浜�0 + if (subMonth > 0) + { + //鏄剧ず 鏈�:鏃� + return dateTime.ToString("MM/dd"); + } + else + { + //鐩稿悓鏈堜唤锛屾棩鏈熷樊鍊煎ぇ浜�0 + if (subDay > 0) + { + //鏄剧ず 鏈�:鏃� + return dateTime.ToString("MM/dd"); + } + else + { + //鍚屼竴澶╂樉绀� 鏃�:鍒� + return dateTime.ToString("HH:mm"); + } + } + } } + /// <summary> /// 鏃堕棿杞崲 /// 灏戜簬1澶� 鏄剧ず 鏃跺垎 @@ -377,6 +423,7 @@ } #endregion + } diff --git a/HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs b/HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs new file mode 100644 index 0000000..19708a4 --- /dev/null +++ b/HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs @@ -0,0 +1,78 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; + +namespace HDL_ON +{ + public class FloorSelectPopupDialog + { + public FloorSelectPopupDialog() + { + } + + /// <summary> + /// 涓�绾ist + /// </summary> + List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); + /// <summary> + /// 浜岀骇鑱斿姩List + /// </summary> + List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); + + /// <summary> + /// + /// </summary> + public void ShowView(Action<string> selectAction, string selectTag = DiySelectPopupDialog.ALLSELECT) + { + + var floorList = SpatialInfo.CurrentSpatial.FloorList; + var roomList = SpatialInfo.CurrentSpatial.RoomList; + + if (floorList == null || floorList.Count == 0) + { + //娌℃湁妤煎眰鍙姞杞芥埧闂� + if (roomList == null) + { + Utlis.WriteLine("roomList null"); + return; + } + + mFirstList.Clear(); + foreach (var room in roomList) + { + mFirstList.Add(new RoomCellInfo() { Title = room.roomName, TagId = room.roomId }); + } + var roomSelectPopupDialog = new DiySelectPopupDialog(); + roomSelectPopupDialog.ShowView(mFirstList, null, selectAction, selectTag); + } + else + { + mFirstList.Clear(); + mSecondList.Clear(); + //涓�绾ф暟缁勪负妤煎眰 + foreach (var floor in floorList) + { + mFirstList.Add(new RoomCellInfo() { Title = floor.roomName, TagId = floor.roomId }); + var mList = new List<RoomCellInfo>(); + var allRoom = roomList.FindAll((room) => room.parentId == floor.roomId); + foreach (var mRoom in allRoom) + { + mList.Add(new RoomCellInfo() { Title = mRoom.roomName, TagId = mRoom.roomId }); + } + + if(mList == null) + { + mList = new List<RoomCellInfo>(); + } + mSecondList.Add(mList); + } + + var roomSelectPopupDialog = new DiySelectPopupDialog(); + roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag); + + } + + } + + } +} diff --git a/HDL_ON/DAL/Server/IMessageCommon.cs b/HDL_ON/DAL/Server/IMessageCommon.cs index 12b884d..041a6ac 100755 --- a/HDL_ON/DAL/Server/IMessageCommon.cs +++ b/HDL_ON/DAL/Server/IMessageCommon.cs @@ -156,6 +156,15 @@ //*********缃戝叧********* //缃戝叧涓嶅瓨鍦� stateCodeDic["10506"] = StringId.GatewayDoesNotExist; + + + //鎺у埗澶辫触 + stateCodeDic["14007"] = StringId.ControlFailure; + //缃戝叧绂荤嚎 + stateCodeDic["14005"] = StringId.GatewayOffline; + //璁惧绂荤嚎 + stateCodeDic["14006"] = StringId.DeviceOffline; + //*********鍦烘櫙/鑷姩鍖�********* //鍦烘櫙宸插瓨鍦� stateCodeDic["14501"] = StringId.SceneAlreadyExists; diff --git a/HDL_ON/DAL/Server/NewApiRes.cs b/HDL_ON/DAL/Server/NewApiRes.cs index 8b7a67a..5ba1bf8 100755 --- a/HDL_ON/DAL/Server/NewApiRes.cs +++ b/HDL_ON/DAL/Server/NewApiRes.cs @@ -878,56 +878,6 @@ public string homeId; } - - - //鑾峰彇椤圭洰 (浣忓畢)涓嬮潰鐨勫瓙璐﹀彿 - /// <summary> - /// 鑾峰彇鎴愬憳淇℃伅鐨勭粨鏋� - /// </summary> - /// [Serializable] - public class SubAccountNewRes - { - - /// <summary> - /// - /// </summary> - public string id; - /// <summary> - /// - /// </summary> - public string homeId; - /// <summary> - /// - /// </summary> - public string homeRegionId; - /// <summary> - /// - /// </summary> - public string childAccountId; - /// <summary> - /// - /// </summary> - public string childAccountRegionId; - /// <summary> - /// 瀛愯处鎴风被鍨� ORDINARY銆丏EBUG銆丄DMIN - /// </summary> - public string childAccountType; - /// <summary> - /// 鏄惁鍏佽杩滅▼鎺у埗 - /// </summary> - public bool isRemoteControl; - /// <summary> - /// 鏄电О1 - /// </summary> - public string nickName; - /// <summary> - /// - /// </summary> - public string createTime; - - - } - /// <summary> /// 鏇存柊瀛愯处鍙峰娉ㄥ悕瀛� /// </summary> @@ -1446,9 +1396,42 @@ /// 鎺ㄩ�侀檮鍔犳暟鎹� /// </summary> public string Extras; + /// <summary> + /// 淇℃伅绫诲瀷 + /// </summary> + public string messageType = ""; } + /// <summary> + /// 鏋佸厜鎺ㄩ�佹秷鎭� + /// </summary> + [System.Serializable] + public class JPushExpandData + { + /// <summary> + /// 闄勫姞鍐呭 + /// </summary> + public string expandData; + + } + + /// <summary> + /// 鏋佸厜鎺ㄩ�佹秷鎭� + /// </summary> + [System.Serializable] + public class ExpandData + { + /// <summary> + /// 闄勫姞鍐呭 + /// </summary> + public string expantContent; + /// <summary> + /// 淇℃伅绫诲瀷 + /// </summary> + public string messageType; + } + //#region 鏃ф帴鍙� ///// <summary> ///// diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 3696447..386cc78 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -343,6 +343,7 @@ ApiAlinkControlActionObj aaao = new ApiAlinkControlActionObj(); aaao.deviceId = this.deviceId; aaao.spk = this.spk; + aaao.bus = this.bus; foreach (var kv in keyValues) { aaao.attributes.Add(new AlinkControlAttributes() diff --git a/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs b/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs index d07795c..2c1680d 100755 --- a/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs +++ b/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> /// @@ -87,7 +87,7 @@ /// <summary> /// 鐢ㄦ埛鍚嶅瓧 /// </summary> - public string UserName = ""; + public string memberName = ""; /// <summary> /// /// </summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index b2a7318..bbc8669 100755 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -260,6 +260,9 @@ <Compile Include="$(MSBuildThisFileDirectory)Common\OnAppConfig.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\UserInfo.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAddPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\SelectPopupDialog.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Common\Utlis\FloorSelectPopupDialog.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\DiySelectPopupDialog.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)UI\" /> diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs index 33894e3..9c76cae 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs @@ -31,10 +31,10 @@ //btnConfirm.IsSelected = false; if (string.IsNullOrEmpty(editText.Text.Trim()) || list.Contains(editText.Text.Trim())) { - if (titleId == StringId.ModifyMemberNickname) - { - return; - } + //if (titleId == StringId.ModifyMemberNickname) + //{ + // return; + //} string tipMsgString = ""; if (string.IsNullOrEmpty(editText.Text.Trim())) { diff --git a/HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs b/HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs new file mode 100644 index 0000000..2d885b4 --- /dev/null +++ b/HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs @@ -0,0 +1,630 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON +{ + /// <summary> + /// 妤煎眰DiySelectPopupDialog + /// </summary> + public class DiySelectPopupDialog : Dialog + { + /// <summary> + /// ALLSELECT + /// </summary> + public const string ALLSELECT = "ALLSELECT"; + + /// bodyView + /// </summary> + FrameLayout bodyView; + /// <summary> + /// 搴曢儴View + /// 鑷繁鏍规嵁闇�瑕佽皟鏁碭銆乊鍧愭爣 + /// </summary> + public FrameLayout BackView; + /// <summary> + /// + /// </summary> + Button leftAllButton; + /// <summary> + /// 涓�绾ф粦鍔╒iew + /// </summary> + VerticalScrolViewLayout leftScrolView; + /// <summary> + /// 浜岀骇婊戝姩View + /// </summary> + VerticalScrolViewLayout rightScrolView; + /// <summary> + /// 閫変腑鍥炶皟浜嬩欢 + /// </summary> + Action<string> SelectAction; + /// <summary> + /// 涓�绾ist + /// </summary> + List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); + /// <summary> + /// 浜岀骇鑱斿姩List + /// </summary> + List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); + /// <summary> + /// 浜岀骇鎵�鏈塋ist + /// </summary> + List<RoomCellInfo> mSecondAllList = new List<RoomCellInfo>(); + + /// <summary> + /// RoomSelectPopupDialog + /// </summary> + /// <param name="SelectAction"></param> + public DiySelectPopupDialog() + { + bodyView = new FrameLayout(); + + } + + /// <summary> + /// 鏄剧ずView + /// mFirstList銆乵SecondList涓嶅悎娉曢兘涓嶄細鏄剧ずView + /// mSecondList 涓嶄紶涓洪粯璁や竴绾� + /// </summary> + /// <param name="mFirstList"></param> + /// <param name="mSecondList"></param> + public void ShowView(List<RoomCellInfo> mFirstList, List<List<RoomCellInfo>> mSecondList, Action<string> SelectAction, string selectTagId = ALLSELECT) + { + if (mFirstList == null) + { + Utlis.WriteLine("mFirstList null"); + return; + } + //娉ㄥ唽鍥炶皟浜嬩欢 + this.SelectAction = SelectAction; + //浜屾槸鍚﹂渶瑕佷簩绾у垽鏂� + if (mSecondList == null || mSecondList.Count == 0) + { + //涓�绾� + this.mFirstList = mFirstList; + //View鏄剧ず + ShowOneBaseView(); + //鏁版嵁鍐呭濉厖 + RefreshOneBaseView(selectTagId); + } + else + { + if (mFirstList.Count != mSecondList.Count) + { + Utlis.WriteLine("鏁版嵁 涓嶈仈鍔ㄥ紓甯�"); + return; + } + //浜岀骇鑱斿姩 + this.mFirstList = mFirstList; + this.mSecondList = mSecondList; + this.mSecondAllList.Clear(); + foreach(var list in mSecondList) + { + foreach (var data in list) + { + this.mSecondAllList.Add(data); + } + } + + //View鏄剧ず + ShowDoubleBaseView(); + //鏁版嵁鍐呭濉厖 + RefreshDoubleBaseView(); + // + SetSelectTagId(selectTagId); + + } + this.Show(); + } + + + /// <summary> + /// + /// </summary> + void SelectAll() + { + RefreshSelectButton(leftScrolView, ALLSELECT); + var all = new RoomCellInfo() + { + TagId = ALLSELECT, + Title = "ALL", + }; + LoadRightScrolView(all, this.mSecondAllList); + } + + /// <summary> + /// 鏍规嵁tagID閫変腑 + /// </summary> + void SetSelectTagId(string tagId) + { + if (string.IsNullOrEmpty(tagId) || tagId == ALLSELECT) + { + SelectAll(); + } + else + { + + var tagInfo = mFirstList.Find((m) => m.TagId == tagId); + if (tagInfo != null) + { + var index = mFirstList.IndexOf(tagInfo); + if (index < mSecondList.Count) + { + RefreshSelectButton(leftScrolView, tagId); + LoadRightScrolView(tagInfo, mSecondList[index]); + return; + } + else + { + SelectAll(); + } + } + else + { + SelectAll(); + } + } + } + + #region 浜岀骇鑱斿姩閫夋嫨鏁堟灉 + /// <summary> + /// 鏄剧ず浜岀骇view + /// </summary> + void ShowDoubleBaseView() + { + bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; + this.AddChidren(bodyView); + bodyView.MouseUpEventHandler = (sender, e) => + { + this.Close(); + }; + + BackView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(104), + Width = Application.GetRealWidth(283), + Height = Application.GetRealWidth(242), + }; + bodyView.AddChidren(BackView); + + var backImageView = new ImageView(){ + Width = BackView.Width, + Height = BackView.Height, + ImagePath = "Public/PopupDialog.png" + }; + BackView.AddChidren(backImageView); + + leftAllButton = new Button() + { + Y = Application.GetRealWidth(14), + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + IsSelected = true, + //IsBold = true, + }; + BackView.AddChidren(leftAllButton); + //鍒嗗壊绾� + var lineView1 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = leftAllButton.Bottom, + X = leftAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView1); + + leftScrolView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = leftAllButton.Bottom, + Height = Application.GetRealWidth(176), + Width = Application.GetRealWidth(128), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(leftScrolView); + + rightScrolView = new VerticalScrolViewLayout() + { + X = leftScrolView.Right + Application.GetRealWidth(12), + Y = Application.GetRealWidth(58), + Height = Application.GetRealWidth(176), + Width = Application.GetRealWidth(128), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(rightScrolView); + + leftAllButton.MouseUpEventHandler = (sender, e) => + { + leftAllButton.IsSelected = true; + + //鍔犺浇鍏ㄩ儴 + SelectAll(); + }; + } + + /// <summary> + /// 鍒锋柊浜岀骇鑱斿姩鐨刅IEW + /// </summary> + void RefreshDoubleBaseView() + { + leftScrolView.RemoveAll(); + for (var i = 0; i < mFirstList.Count; i++) + { + AddSelectButton(leftScrolView, mFirstList[i], mSecondList[i]); + } + } + + /// <summary> + /// scrolView閲岄潰Button 閫変腑鏁堟灉浜掓枼 + /// </summary> + /// <param name="scrolView"></param> + /// <param name="selectBtnTag"></param> + void RefreshSelectButton(VerticalScrolViewLayout scrolView, string selectBtnTag) + { + try + { + if (leftAllButton != null) + { + leftAllButton.IsSelected = selectBtnTag == ALLSELECT; + } + + if (scrolView != null) + { + for (int i = 0; i < scrolView.ChildrenCount; i++) + { + if (scrolView.GetChildren(i).GetType() == typeof(FrameLayout)) + { + var cellView = (FrameLayout)scrolView.GetChildren(i); + for (int j = 0; j < cellView.ChildrenCount; j++) + { + if (cellView.GetChildren(j).GetType() == typeof(Button)) + { + var titleButton = (Button)cellView.GetChildren(j); + var o = titleButton.GetTagByKey("BtnKey"); + if (o != null && o.ToString() == selectBtnTag) + { + titleButton.IsSelected = true; + } + else + { + titleButton.IsSelected = false; + } + } + } + } + } + } + } + catch + { + + } + } + + /// <summary> + /// 娣诲姞涓�绾фゼ灞傞�夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="firstData"></param> + /// <param name="rightList"></param> + void AddSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo firstData, List<RoomCellInfo> rightList) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + Tag = "cell" + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = firstData.Title, + }; + cellView.AddChidren(titleButton); + titleButton.AddTag("BtnKey", firstData.TagId); + + //椤堕儴鍒嗗壊绾� + var lineView = new FrameLayout() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(112), + BackgroundColor = CSS_Color.DividingLineColor, + Y = cellView.Height - Application.GetRealHeight(1), + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + //cellView.BackgroundColor = CSS_Color.viewTranslucence; + RefreshSelectButton(scrolView, firstData.TagId); + LoadRightScrolView(firstData, rightList); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + + + /// <summary> + /// 鍔犺浇浜岀骇婊戝姩View + /// </summary> + /// <param name="firstData"></param> + /// <param name="rightList"></param> + void LoadRightScrolView(RoomCellInfo firstData, List<RoomCellInfo> rightList) + { + rightScrolView.RemoveAll(); + + //娣诲姞椤堕儴鍒嗗壊绾� + var lineView2 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + rightScrolView.AddChidren(lineView2); + //娣诲姞鍏ㄩ儴鎸夐挳 + var allInfo = new RoomCellInfo() + { + Title = Language.StringByID(StringId.All), + TagId = firstData.TagId,//涓婁竴绾фゼ灞侷D + }; + AddRightSelectButton(rightScrolView, allInfo, true); + + for (var i = 0; i < rightList.Count; i++) + { + AddRightSelectButton(rightScrolView, rightList[i]); + } + + } + + /// <summary> + /// 娣诲姞浜岀骇閫夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="secondData"></param> + /// <param name="isSelected"></param> + void AddRightSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo secondData, bool isSelected = false) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + //X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = secondData.Title, + IsSelected = isSelected + }; + cellView.AddChidren(titleButton); + + var lineView = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = cellView.Height - Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + this.Close(); + //鍥炶皟閫変腑绱㈠紩 + SelectAction?.Invoke(secondData.TagId); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + + } + + #endregion + + + #region 鍙湁涓�绾х殑鑱斿姩 + /// <summary> + /// 閮芥樉绀轰竴绾х殑 + /// </summary> + void ShowOneBaseView() + { + bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; + this.AddChidren(bodyView); + bodyView.MouseUpEventHandler = (sender, e) => + { + this.Close(); + }; + + BackView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(104), + Width = Application.GetRealWidth(160), + Height = Application.GetRealWidth(198), + }; + bodyView.AddChidren(BackView); + + var backImageView = new ImageView() + { + Width = BackView.Width, + Height = BackView.Height, + ImagePath = "PersonalCenter/HomeList3bg.png" + }; + BackView.AddChidren(backImageView); + + leftAllButton = new Button() + { + Y = Application.GetRealWidth(14), + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + //IsBold = true, + }; + BackView.AddChidren(leftAllButton); + //鍒嗗壊绾� + var lineView1 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = leftAllButton.Bottom, + X = leftAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView1); + + leftScrolView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = leftAllButton.Bottom, + Height = Application.GetRealWidth(132), + Width = Application.GetRealWidth(144), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(leftScrolView); + + leftAllButton.MouseUpEventHandler = (sender, e) => + { + this.Close(); + SelectAction?.Invoke(ALLSELECT); + }; + } + + /// <summary> + /// + /// </summary> + /// <param name="tagId"></param> + void RefreshOneBaseView(string tagId) + { + if (leftAllButton != null) + { + leftAllButton.IsSelected = tagId == ALLSELECT; + } + leftScrolView.RemoveAll(); + for (var i = 0; i < mFirstList.Count; i++) + { + AddOneSelectButton(leftScrolView, mFirstList[i], tagId); + } + } + + /// <summary> + /// 娣诲姞涓�绾фゼ灞傞�夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="firstIndex"></param> + /// <param name="firstText"></param> + void AddOneSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo firstData, string tagId) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + Tag = "cell" + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = firstData.Title, + }; + cellView.AddChidren(titleButton); + titleButton.IsSelected = firstData.TagId == tagId; + titleButton.AddTag("BtnKey", firstData.TagId); + + //椤堕儴鍒嗗壊绾� + var lineView = new FrameLayout() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(112), + BackgroundColor = CSS_Color.DividingLineColor, + Y = cellView.Height - Application.GetRealHeight(1), + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + this.Close(); + //鍥炶皟閫変腑绱㈠紩 + SelectAction?.Invoke(firstData.TagId); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + + + #endregion + + + #region 閫夋嫨妤煎眰鍜屾埧闂翠笓鐢� + + + #endregion + + + } + + /// <summary> + /// + /// </summary> + public class RoomCellInfo + { + /// <summary> + /// + /// </summary> + public string Title; + /// <summary> + /// + /// </summary> + public string TagId; + } +} diff --git a/HDL_ON/UI/UI0-Public/Widget/SelectPopupDialog.cs b/HDL_ON/UI/UI0-Public/Widget/SelectPopupDialog.cs new file mode 100644 index 0000000..4d1629b --- /dev/null +++ b/HDL_ON/UI/UI0-Public/Widget/SelectPopupDialog.cs @@ -0,0 +1,527 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON +{ + /// <summary> + /// 閫氱敤PopupDialog 鍗曢�夋晥鏋� + /// 鍙洖璋僆ndex + /// </summary> + public class SelectPopupDialog : Dialog + { + /// bodyView + /// </summary> + FrameLayout bodyView; + /// <summary> + /// 搴曢儴View + /// 鑷繁鏍规嵁闇�瑕佽皟鏁碭銆乊鍧愭爣 + /// </summary> + public FrameLayout BackView; + /// <summary> + /// 涓�绾ф粦鍔╒iew + /// </summary> + VerticalScrolViewLayout leftScrolView; + /// <summary> + /// 浜岀骇婊戝姩View + /// </summary> + VerticalScrolViewLayout rightScrolView; + /// <summary> + /// 閫変腑鍥炶皟浜嬩欢 + /// </summary> + Action<int, int> SelectAction; + /// <summary> + /// 涓�绾ist + /// </summary> + List<string> mFirstList = new List<string>(); + /// <summary> + /// 浜岀骇鑱斿姩List + /// </summary> + List<List<string>> mSecondList = new List<List<string>>(); + + /// <summary> + /// SelectPopupDialog + /// </summary> + /// <param name="SelectAction"></param> + public SelectPopupDialog() + { + bodyView = new FrameLayout(); + + } + + /// <summary> + /// 鏄剧ずView + /// mFirstList銆乵SecondList涓嶅悎娉曢兘涓嶄細鏄剧ずView + /// mSecondList 涓嶄紶涓洪粯璁や竴绾� + /// </summary> + /// <param name="mFirstList"></param> + /// <param name="mSecondList"></param> + public void ShowView(List<string> mFirstList, List<List<string>> mSecondList, Action<int, int> SelectAction) + { + if (mFirstList == null) + { + Utlis.WriteLine("mFirstList null"); + return; + } + //娉ㄥ唽鍥炶皟浜嬩欢 + this.SelectAction = SelectAction; + //浜屾槸鍚﹂渶瑕佷簩绾у垽鏂� + if (mSecondList == null || mSecondList.Count == 0) + { + //涓�绾� + this.mFirstList = mFirstList; + //View鏄剧ず + ShowOneBaseView(); + //鏁版嵁鍐呭濉厖 + RefreshOneBaseView(); + } + else + { + if (mFirstList.Count != mSecondList.Count) + { + Utlis.WriteLine("鏁版嵁 涓嶈仈鍔ㄥ紓甯�"); + return; + } + //浜岀骇鑱斿姩 + this.mFirstList = mFirstList; + this.mSecondList = mSecondList; + //View鏄剧ず + ShowDoubleBaseView(); + //鏁版嵁鍐呭濉厖 + RefreshDoubleBaseView(); + + } + this.Show(); + } + + #region 浜岀骇鑱斿姩閫夋嫨鏁堟灉 + /// <summary> + /// 鏄剧ず浜岀骇view + /// </summary> + void ShowDoubleBaseView() + { + bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; + this.AddChidren(bodyView); + bodyView.MouseUpEventHandler = (sender, e) => + { + this.Close(); + }; + + BackView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(104), + Width = Application.GetRealWidth(283), + Height = Application.GetRealWidth(242), + }; + bodyView.AddChidren(BackView); + + var backImageView = new ImageView(){ + Width = BackView.Width, + Height = BackView.Height, + ImagePath = "Public/PopupDialog.png" + }; + BackView.AddChidren(backImageView); + + var leftAllButton = new Button() + { + Y = Application.GetRealWidth(14), + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + IsBold = true, + }; + BackView.AddChidren(leftAllButton); + //鍒嗗壊绾� + var lineView1 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = leftAllButton.Bottom, + X = leftAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView1); + + leftScrolView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = leftAllButton.Bottom, + Height = Application.GetRealWidth(176), + Width = Application.GetRealWidth(128), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(leftScrolView); + + var rightAllButton = new Button() + { + Y = Application.GetRealWidth(58), + X = leftScrolView.Right + Application.GetRealWidth(12), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + IsBold = true, + }; + BackView.AddChidren(rightAllButton); + + var lineView2 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = rightAllButton.Y, + X = rightAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView2); + + var lineView3 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = rightAllButton.Bottom, + X = rightAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView3); + + rightScrolView = new VerticalScrolViewLayout() + { + X = leftScrolView.Right + Application.GetRealWidth(12), + Y = Application.GetRealWidth(102), + Height = Application.GetRealWidth(132), + Width = Application.GetRealWidth(128), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(rightScrolView); + } + + /// <summary> + /// 鍒锋柊浜岀骇鑱斿姩鐨刅IEW + /// </summary> + void RefreshDoubleBaseView() + { + leftScrolView.RemoveAll(); + for (var i = 0; i < mFirstList.Count; i++) + { + AddSelectButton(leftScrolView, i, mFirstList[i], mSecondList[i]); + } + } + + /// <summary> + /// scrolView閲岄潰Button 閫変腑鏁堟灉浜掓枼 + /// </summary> + void RefreshSelectButton(VerticalScrolViewLayout scrolView, string selectBtnTag) + { + try + { + if (scrolView != null) + { + for (int i = 0; i < scrolView.ChildrenCount; i++) + { + if (scrolView.GetChildren(i).GetType() == typeof(FrameLayout)) + { + var cellView = (FrameLayout)scrolView.GetChildren(i); + for (int j = 0; j < cellView.ChildrenCount; j++) + { + if (cellView.GetChildren(j).GetType() == typeof(Button)) + { + var titleButton = (Button)cellView.GetChildren(j); + var o = titleButton.GetTagByKey("BtnKey"); + if (o != null && o.ToString() == selectBtnTag) + { + titleButton.IsSelected = true; + } + else + { + titleButton.IsSelected = false; + } + } + } + } + } + } + } + catch + { + + } + } + + /// <summary> + /// 娣诲姞涓�绾фゼ灞傞�夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + void AddSelectButton(VerticalScrolViewLayout scrolView, int firstIndex, string firstText, List<string> rightList) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + Tag = "cell" + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = firstText, + }; + cellView.AddChidren(titleButton); + titleButton.AddTag("BtnKey", firstIndex.ToString()); + + //椤堕儴鍒嗗壊绾� + var lineView = new FrameLayout() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(112), + BackgroundColor = CSS_Color.DividingLineColor, + Y = cellView.Height - Application.GetRealHeight(1), + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + //cellView.BackgroundColor = CSS_Color.viewTranslucence; + RefreshSelectButton(scrolView, firstIndex.ToString()); + LoadRightScrolView(firstIndex, rightList); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + /// <summary> + /// 鍔犺浇浜岀骇婊戝姩View + /// </summary> + /// <param name="firstIndex">涓�绾х殑绱㈠紩</param> + /// <param name="rightList">浜岀骇瀵瑰簲涓�绾х殑List</param> + void LoadRightScrolView(int firstIndex, List<string> rightList) + { + rightScrolView.RemoveAll(); + for (var i = 0; i < rightList.Count; i++) + { + AddRightSelectButton(rightScrolView, firstIndex, rightList[i], i); + } + + } + + /// <summary> + /// 娣诲姞浜岀骇閫夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="firstIndex"></param> + /// <param name="secondText"></param> + /// <param name="secondIndex"></param> + void AddRightSelectButton(VerticalScrolViewLayout scrolView, int firstIndex, string secondText, int secondIndex) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + //X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = secondText, + }; + cellView.AddChidren(titleButton); + + var lineView = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = cellView.Height - Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + this.Close(); + //鍥炶皟閫変腑绱㈠紩 + SelectAction?.Invoke(firstIndex, secondIndex); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + #endregion + + + #region 鍙湁涓�绾х殑鑱斿姩 + /// <summary> + /// 閮芥樉绀轰竴绾х殑 + /// </summary> + void ShowOneBaseView() + { + bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; + this.AddChidren(bodyView); + bodyView.MouseUpEventHandler = (sender, e) => + { + this.Close(); + }; + + BackView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(104), + Width = Application.GetRealWidth(160), + Height = Application.GetRealWidth(198), + }; + bodyView.AddChidren(BackView); + + var backImageView = new ImageView() + { + Width = BackView.Width, + Height = BackView.Height, + ImagePath = "PersonalCenter/HomeList3bg.png" + }; + BackView.AddChidren(backImageView); + + var leftAllButton = new Button() + { + Y = Application.GetRealWidth(14), + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + IsBold = true, + }; + BackView.AddChidren(leftAllButton); + //鍒嗗壊绾� + var lineView1 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = leftAllButton.Bottom, + X = leftAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView1); + + leftScrolView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = leftAllButton.Bottom, + Height = Application.GetRealWidth(132), + Width = Application.GetRealWidth(144), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(leftScrolView); + } + + void RefreshOneBaseView() + { + leftScrolView.RemoveAll(); + for (var i = 0; i < mFirstList.Count; i++) + { + AddOneSelectButton(leftScrolView, i, mFirstList[i]); + } + } + + /// <summary> + /// 娣诲姞涓�绾фゼ灞傞�夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="firstIndex"></param> + /// <param name="firstText"></param> + void AddOneSelectButton(VerticalScrolViewLayout scrolView, int firstIndex, string firstText) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + Tag = "cell" + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = firstText, + }; + cellView.AddChidren(titleButton); + titleButton.AddTag("BtnKey", firstIndex.ToString()); + + //椤堕儴鍒嗗壊绾� + var lineView = new FrameLayout() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(112), + BackgroundColor = CSS_Color.DividingLineColor, + Y = cellView.Height - Application.GetRealHeight(1), + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + this.Close(); + //鍥炶皟閫変腑绱㈠紩 + SelectAction?.Invoke(firstIndex, 0); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + #endregion + + + #region 閫夋嫨妤煎眰鍜屾埧闂翠笓鐢� + + + #endregion + + + } + + +} diff --git a/HDL_ON/UI/UI0-Public/Widget/TextButton.cs b/HDL_ON/UI/UI0-Public/Widget/TextButton.cs index 4148731..cebc715 100755 --- a/HDL_ON/UI/UI0-Public/Widget/TextButton.cs +++ b/HDL_ON/UI/UI0-Public/Widget/TextButton.cs @@ -4,6 +4,8 @@ #if __IOS__ using UIKit; using Foundation; +#else +using Android.Graphics; #endif namespace HDL_ON.UI @@ -11,7 +13,7 @@ /// <summary> /// TextButton /// 瑙e喅iOS 鏂囨湰鍒拌竟妗嗘湁杈硅窛闂 - /// + /// 鏀寔鏍规嵁鏂囨湰鍔ㄦ�佽绠楅珮搴� /// </summary> public class TextButton : Button { @@ -22,6 +24,45 @@ (this.uiView as MyButton).ContentEdgeInsets = new UIEdgeInsets(0, 0, 0, 0); #endif + } + + /// <summary> + /// 璁剧疆闇�瑕侀檺鍒剁殑鏈�澶ц鏁� + /// 浣嗘槸瓒呰繃琛屾暟鐨勮瘽浼氱己灏戠渷鐣ュ彿...锛屾殏鏃舵棤娉曡В鍐� + /// </summary> + public int MaxLine = 0; + /// <summary> + /// 鍔ㄦ�佽绠楅珮搴� + /// 璧嬪�兼枃鏈悗鍜屾寚瀹氬搴﹀悗锛岄�氳繃璁$畻鐪熷疄鐨勯渶瑕佸搴﹀拰鎸囧畾瀹藉害绠楀嚭澶氳闇�瑕佺殑鐪熷疄楂樺害 + /// 璇ユ柟娉曟湁璇樊涓嶈兘100%鍑嗙‘ + /// 鏈�姝g‘鏂规硶鏄牴鎹� 鍗曡鍗曚釜瀛椾綋鐨勯珮搴﹀姞涓婅璺濇潵璁$畻 + /// </summary> + /// <returns></returns> + public int GetMoreLineNeedHeight() + { + //璁$畻闇�瑕佺殑鐪熷疄瀹藉害 + int needWidth = this.GetTextWidth(); + //璁$畻鍦ㄦ寚瀹氬搴︽儏鍐典笅锛岄渶瑕佺殑鐪熷疄琛屾暟 + int line = (needWidth / this.Width); + //姹備綑 + int modValue = (needWidth % this.Width); + //浣欏ぇ浜�0锛屽垯澶氬姞涓�琛� + if (modValue > 0) + { + line = line + 1; + } + if (line > 0) + { + if(MaxLine != 0) + { + line = Math.Min(line, MaxLine); + } + return line * this.Height; + } + else + { + return this.Height; + } } int _lineSpacing; @@ -60,42 +101,13 @@ /// 鏄剧ず褰撳墠鏂囧瓧闇�瑕佸嚑琛� /// </summary> /// <returns></returns> - int GetNeedLinesWithWidth() + public int GetNeedLinesWithWidth() { - return 0; + return (this.GetTextWidth() / this.Width) * this.Height; + //return 0; } - /** - -// @param width 缁欏畾涓�涓搴� -// @return 杩斿洖琛屾暟 -// */ -//- (NSInteger) needLinesWithWidth:(CGFloat) width -// { -// //鍒涘缓涓�涓猯abe -// UILabel * label = [[UILabel alloc] -// init]; -// //font鍜屽綋鍓峫abel淇濇寔涓�鑷� -// label.font = self.font; -// NSString* text = self.text; -// NSInteger sum = 0; -// //鎬昏鏁板彈鎹㈣绗﹀奖鍝嶏紝鎵�浠ヨ繖閲岃绠楁�昏鏁帮紝闇�瑕佺敤鎹㈣绗﹀垎闅旇繖娈垫枃瀛楋紝鐒跺悗璁$畻姣忔鏂囧瓧鐨勮鏁帮紝鐩稿姞鍗虫槸鎬昏鏁般�� -// NSArray* splitText = [text componentsSeparatedByString: @"\n"]; -// for (NSString* sText in splitText) -// { -// label.text = sText; -// //鑾峰彇杩欐鏂囧瓧涓�琛岄渶瑕佺殑size -// CGSize textSize = [label systemLayoutSizeFittingSize: CGSizeZero]; -// //size.width/鎵�闇�瑕佺殑width 鍚戜笂鍙栨暣灏辨槸杩欐鏂囧瓧鍗犵殑琛屾暟 -// NSInteger lines = ceilf(textSize.width / width); -// //褰撴槸0鐨勬椂鍊欙紝璇存槑杩欐槸鎹㈣锛岄渶瑕佹寜涓�琛岀畻銆� -// lines = lines == 0 ? 1 : lines; -// sum += lines; -// } -// return sum; -// } - //#elif __Android__ #else /// <summary> @@ -107,8 +119,19 @@ (this.AndroidView as Android.Widget.Button).SetLineSpacing(spacing, 1); } -#endif + /// <summary> + /// + /// </summary> + /// <returns></returns> + int GetTextHeight() + { + string text = "Text"; + Rect rect = new Rect(); + (this.AndroidView as Android.Widget.Button).Paint.GetTextBounds(text, 0, text.Length, rect); + return rect.Height(); } +#endif + } diff --git a/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs b/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs index fb23965..21d8ff3 100755 --- a/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs +++ b/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs @@ -77,20 +77,24 @@ }; contentView.AddChidren(mesView); - Button btnMes = new Button() + TextButton btnMes = new TextButton() { Gravity = Gravity.CenterHorizontal, Width = mesView.Width, - Height = mesView.Height, + //Height = mesView.Height, + Height = Application.GetRealWidth(20), TextAlignment = TextAlignment.TopLeft, TextColor = CSS_Color.TextualColor, TextSize = CSS_FontSize.TextFontSize, - IsMoreLines = true, Text = msgStr, //BackgroundColor = CSS_Color.AuxiliaryColor2 }; mesView.AddChidren(btnMes); + //鍔ㄦ�佽绠楅珮搴� + var needHeight = btnMes.GetMoreLineNeedHeight(); + btnMes.IsMoreLines = true; + btnMes.Height = needHeight; Button btnLine = new Button() { diff --git a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs index f130b5b..d61b913 100755 --- a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs @@ -221,9 +221,9 @@ if (selectId == 0) { allMenuButton.IsSelected = true; - shareMenuButton.IsSelected = false; - alarmMenuButton.IsSelected = false; - systemMenuButton.IsSelected = false; + shareMenuButton.IsSelected = true; + alarmMenuButton.IsSelected = true; + systemMenuButton.IsSelected = true; } else if (selectId == 1) @@ -293,21 +293,26 @@ VerticalScrolViewMiddle.AddChidren(rowView); //鏍囬 - var btnTilte = new Button() + var btnTilte = new TextButton() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(12), - Width = Application.GetRealWidth(320), - Height = Application.GetRealHeight(20), + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(20), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, - Text = pushMessageInfo.messageTitle + Text = pushMessageInfo.messageContent }; rowView.AddChidren(btnTilte); + // + var needHeight = btnTilte.GetMoreLineNeedHeight(); + btnTilte.IsMoreLines = true; + btnTilte.Height = needHeight; + rowView.Height = Application.GetRealHeight(45) + needHeight; //鍓爣棰� - var btnSubtitle = new Button() + var btnSubtitle = new TextButton() { X = Application.GetRealWidth(16), Y = btnTilte.Bottom + Application.GetRealHeight(4), @@ -316,7 +321,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = pushMessageInfo.messageContent + Text = pushMessageInfo.messageTitle }; rowView.AddChidren(btnSubtitle); @@ -359,6 +364,8 @@ rowView.MouseUpEventHandler = eventHandler; btnTilte.MouseUpEventHandler = eventHandler; btnSubtitle.MouseUpEventHandler = eventHandler; + + } /// <summary> @@ -435,7 +442,7 @@ }; VerticalScrolViewMiddle.AddChidren(bgView); - var yearBtn = new Button() + var yearBtn = new TextButton() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(16), @@ -445,9 +452,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, IsBold = true, - Text = yearStr }; bgView.AddChidren(yearBtn); + yearBtn.Text = yearStr + Language.StringByID(StringId.Years); } /// <summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs index 6f1aa84..8ac9bfb 100755 --- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs @@ -70,7 +70,9 @@ bodyView.AddChidren(topView); //涓嶆槸A缃戝叧鎴栬�呮槸鎴愬憳 鍙厑璁告坊鍔犲満鏅殣钘忚嚜鍔ㄥ寲 - if (DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) + var HideAutoPage = DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; + //鍒ゆ柇鏄惁闇�瑕侀殣钘忚嚜鍔ㄥ寲 + if (HideAutoPage) { btnSceneTilte = new Button() { @@ -147,7 +149,11 @@ bodyView.AddChidren(contentPageView); LoadScenePageView(); - LoadAutomationPageView(); + //鍒ゆ柇鏄惁闇�瑕侀殣钘忚嚜鍔ㄥ寲 + if (!HideAutoPage) + { + LoadAutomationPageView(); + } LoadEventList(); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/FunctionIntroductionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/FunctionIntroductionPage.cs index 9f6526c..c0eccff 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/FunctionIntroductionPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/FunctionIntroductionPage.cs @@ -63,7 +63,7 @@ /// 鍔犺浇鍖哄煙閫夋嫨RowView /// </summary> /// <param name="VerticalScrolViewMiddle"></param> - void AddRowView(VerticalScrolViewLayout VerticalScrolViewMiddle, HelpURLInfo functionInfo) + void AddRowView(VerticalScrolViewLayout VerticalScrolViewMiddle, APPFunctionURLInfo functionInfo) { var rowView = new FrameLayout() { @@ -125,27 +125,27 @@ } #region 娴嬭瘯 - List<HelpURLInfo> list = new List<HelpURLInfo>(); + List<APPFunctionURLInfo> list = new List<APPFunctionURLInfo>(); /// <summary> /// /// </summary> void TestLoad() { - list.Add(new HelpURLInfo() + list.Add(new APPFunctionURLInfo() { Title = "HDL ON PRO 1.0.10 涓昏鏇存柊", CreateTime = "11鏈�26", Url = Constant.URL_PRIVACYPOLICY, }); - list.Add(new HelpURLInfo() + list.Add(new APPFunctionURLInfo() { Title = "HDL ON PRO 1.0.09 涓昏鏇存柊", CreateTime = "10鏈�26", Url = Constant.URL_PRIVACYPOLICY, }); - list.Add(new HelpURLInfo() + list.Add(new APPFunctionURLInfo() { Title = "HDL ON PRO 1.0.08 涓昏鏇存柊", CreateTime = "09鏈�26", @@ -162,10 +162,10 @@ /// <summary> - /// 甯姪缃戦〉鍦板潃 + /// 鍔熻兘浠嬬粛缃戦〉淇℃伅 /// </summary> [System.Serializable] - public class HelpURLInfo + public class APPFunctionURLInfo { /// <summary> /// diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs index 172eb57..b47c385 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs @@ -31,44 +31,53 @@ ResidenceMemberInfo memberInfo; - Room room; - - Action<string> refreshFunctionCount; + /// <summary> + /// 褰撳墠鐨勬埧闂磖oomId + /// 濡傛灉涓虹┖锛屽垯浠h〃绠$悊鏃犲垎閰嶅尯鍩熺殑鍔熻兘鍒嗕韩 + /// </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 { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs index eba16f4..ee44a30 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs @@ -22,19 +22,31 @@ { btnOption.MouseUpEventHandler = (sender, e) => { - if (titleId == StringId.PermissionToUse)//浠庝釜浜轰腑蹇冭繘鍏ュ崟鐙垎浜� + Action action = () => { UploadShareDeviceList(); - } - 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; - } + }; + //鏄惁闇�瑕佷繚瀛� + 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; + //} }; } @@ -55,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() @@ -92,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) { @@ -128,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) { @@ -145,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(); }); } } @@ -203,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> @@ -212,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); @@ -243,7 +270,7 @@ roomList.Add(new ShareData() { shareType = ShareType.ROOM.ToString(), - shareTypeId = room.roomId + shareTypeId = roomId }); var deleteShareObj = new DeleteShareObj() @@ -274,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)) { @@ -295,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; @@ -314,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) @@ -344,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; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs index 57277aa..e8d86ff 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs @@ -136,8 +136,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - Text = memberInfo.nickName - }; + //Text = memberInfo.UserName, + Text = HDLCommon.Current.GetUserName(memberInfo.memberName) + }; view1.AddChidren(btnMemberName); var btnMemberEmail = new Button() diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs index 1c7dcff..88370c4 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs @@ -90,7 +90,7 @@ //璁剧疆鐢ㄦ埛鏄电О if (string.IsNullOrEmpty(mInfo.nickName)) { - mInfo.nickName = mInfo.UserName; + mInfo.nickName = mInfo.memberName; } //璁剧疆鐢ㄦ埛澶村儚璺緞 CheckIfDownloadHeadImage(mInfo); @@ -218,7 +218,7 @@ }) { IsBackground = true }.Start(); }; - new PublicAssmebly().LoadDialog_EditParater(StringId.ModifyMemberNickname, mInfo.nickName, callBack, StringId.HouseNameCannotBeEmpty, 0, new List<string>()); + new PublicAssmebly().LoadDialog_EditParater(StringId.ModifyMemberNickname, mInfo.nickName, callBack, StringId.NicknameCannotBeEmpty, 0, new List<string>()); }; btn1.MouseUpEventHandler = eventHandler; btn2.MouseUpEventHandler = eventHandler; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs index 99953e8..2914390 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs +++ b/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() { @@ -58,9 +59,11 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, - Text = memberInfo.nickName + "(" + memberInfo.Account + ")", + //Text = memberInfo.nickName + "(" + memberInfo.UserName + ")", }; headPortraitView.AddChidren(btnMemberName); + string username = HDLCommon.Current.GetUserName(memberInfo.memberName); + btnMemberName.Text = memberInfo.nickName + "(" + username + ")"; #region RoomList roomListView = new VerticalScrolViewLayout() @@ -117,141 +120,210 @@ var btnLine = new Button() { X = Application.GetRealWidth(16), - Y = btnTitle.Bottom, + Y = titleView.Height - Application.GetRealHeight(2), Width = Application.GetRealWidth(360), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor, }; - roomListView.AddChidren(btnLine); + titleView.AddChidren(btnLine); //--------------------------------------------- - //var roomListView = new VerticalScrolViewLayout() - //{ - // Y = btnLine.Bottom, - // Height = Application.GetRealHeight(440), - //}; - //contentView.AddChidren(roomListView); - - //List<Function> funss = new List<Function>(); - //if (memberInfo.CurResidenceShareDate.Count > 0) - //{ - // foreach (var sd in memberInfo.CurResidenceShareDate) - // { - // funss.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<ShareData>(System.Text.Encoding.UTF8.GetString(sd.ShareDataBytes))); - // } - //} - foreach (var room in SpatialInfo.CurrentSpatial.RoomList) + //鏈垎閰嶅尯鍩熺殑鍔熻兘 + List<Function> allFunctionList = FunctionList.List.GetDeviceFunctionList(); + //鏈垎閰嶅尯鍩熺殑鍔熻兘 + List<Function> unallocatedList = new List<Function>(); + // + foreach (var function in allFunctionList) { - var roomView = new FrameLayout() + function.roomIds.Remove(null); + if (function.roomIds.Count > 0) { - Height = Application.GetRealWidth(50), - BackgroundColor = 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++; - } + //allocatedList.Add(function); } - //绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘 - for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) + else { - var sd = memberInfo.CurResidenceShareDate[i]; - if (FunctionList.List.GetDeviceFunctionList().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); - - 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; - - if (SpatialInfo.CurrentSpatial.RoomList.IndexOf(room) < SpatialInfo.CurrentSpatial.RoomList.Count - 2) - { - var btnRoomLine = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(49), - Width = Application.GetRealWidth(343), - Height = Application.GetRealWidth(1), - BackgroundColor = CSS_Color.DividingLineColor, - }; - roomView.AddChidren(btnRoomLine); + unallocatedList.Add(function); } } - //if (DB_ResidenceData.rooms.Count > 10) - //{ - // roomListView.ScrollEnabled = true; - //} - //else - //{ - // roomListView.ScrollEnabled = false; + //绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘 + 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++; + } + } - // roomListView.AddChidren(new Button() - // { - // Height = Application.GetRealWidth(441), - // BackgroundColor = CSS_Color.BackgroundColor, - // }); - //} + try + { + //閬嶅巻鍔犺浇鎴块棿鍒嗕韩涓暟缁熻鐘舵�丷owLayout + foreach (var room in SpatialInfo.CurrentSpatial.RoomList) + { + AddRoomFunctionRowLayout(room); + } + //2020-12-16 鍔犺浇鏈垎閰嶅尯鍩熷姛鑳絉owLayout + AddNoAreaFunctionRowLayout(unallocatedList); + } + catch + { + Utlis.WriteLine("AddRoomFunctionRowLayout error"); + } } + + /// <summary> + /// 娣诲姞鎴块棿鍒嗕韩涓暟缁熻鐘舵�佺殑RowLayout + /// </summary> + /// <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), + 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); + + + + 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); + + //濡傛灉鎴块棿涓虹┖锛屼唬琛ㄧ鐞嗘棤鍒嗛厤鍖哄煙 + if (mRoom != null) + { + //鏄剧ず鎴块棿鍚� + btnRoomName.Text = mRoom.roomName; + roomFunctionList = mRoom.GetRoomFunctions(false); + roomId = mRoom.roomId; + //娣诲姞鍒嗗壊绾� + var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); + roomView.AddChidren(lineView); + } + else + { + //鏄剧ず鏃犲尯鍩熷姛鑳� + btnRoomName.TextID = StringId.NoAreaFunction; + roomFunctionList = unallocatedList; + roomId = null; + } + + //鍒犻櫎鎸夐挳 + 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) => + { + //涓�閿垹闄ゆ墍鏈夊垎浜� + 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) => + { + 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(); + } + + } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs index e2c2d07..5018a0f 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs @@ -1,6 +1,8 @@ 锘縰sing System; using System.Collections.Generic; +using System.Threading; using HDL_ON.DAL.Server; +using HDL_ON.Entity; using Shared; namespace HDL_ON.UI @@ -19,12 +21,7 @@ { Action action = () => { - var responePack = new HttpServerRequest().DeleteResidenceMemberAccount(memberInfo); - if (responePack.Code == StateCode.SUCCESS) - { - this.RemoveFromParent(); - backAction(); - } + RemoveTheMember(); }; new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.ConfirmToRemoveTheMember, action); }; @@ -45,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(); @@ -62,7 +59,7 @@ } else { - memberInfo.CurResidenceShareDate = new List<ShareData>(); + memberInfo.CurResidenceShareData = new List<ShareData>(); IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); } } @@ -85,5 +82,203 @@ { IsBackground = true }.Start(); } + /// <summary> + /// 鍒犻櫎瀛愯处鍙� + /// </summary> + void RemoveTheMember() + { + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + new System.Threading.Thread(() => + { + try + { + var responePack = new HttpServerRequest().DeleteResidenceMemberAccount(memberInfo); + if (responePack.Code == StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { + this.RemoveFromParent(); + backAction(); + }); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); + } + } + catch (Exception ex) + { + + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + + + /// <summary> + /// 涓�閿垹闄ゅ綋鍓嶆埧闂存墍鏈夊垎浜� + /// </summary> + /// <param name="funs_Del">闇�瑕佷竴閿垹闄ょ殑鍒嗕韩鏁版嵁</param> + /// <param name="roomFunctionList">褰撳墠鎴块棿鎵�鏈夊姛鑳藉垪琛�</param> + /// <param name="roomId">濡傛灉鎴块棿ID涓虹┖锛屽垯浠h〃绠$悊鏃犲垎閰嶅尯鍩熺殑鍔熻兘锛屼笉闇�瑕佸垹闄ゆ埧闂村垎浜�</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涓虹┖锛屽垯浠h〃绠$悊鏃犲垎閰嶅尯鍩熺殑鍔熻兘锛屼笉闇�瑕佸垹闄ゆ埧闂村垎浜� + 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; + } + } } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index 33dcfe9..4d22aef 100755 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/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); -- Gitblit v1.8.0