From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs | 163 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 92 insertions(+), 71 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs index 75e25ac..b071030 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs @@ -19,7 +19,7 @@ /// </summary> private VerticalFrameRefreshControl listView = null; /// <summary> - /// 鍏ㄩ儴鐨勮 + /// 鍏ㄩ儴鐨勮,涓婚敭鏄嚜鍔ㄩ�掑鐨勪笢瑗� /// </summary> private Dictionary<string, RowLayoutControl> dicAllRow = null; @@ -32,6 +32,9 @@ /// </summary> public void ShowForm() { + //宸︽粦浣胯兘 + this.ScrollEnabled = false; + Common.CommonPage.Instance.IsDrawerLockMode = true; //璁剧疆澶撮儴淇℃伅 @@ -65,10 +68,10 @@ /// <summary> /// 鍒濆鍖栦腑閮ㄤ俊鎭� /// </summary> - private async void InitMiddleData(bool showReload) + private void InitMiddleData(bool showReload) { //鑾峰彇鏁版嵁 - var dicData = await this.GetMessageData(); + var dicData = this.GetMessageData(); if (dicData == null) { if (showReload == true) @@ -154,7 +157,7 @@ framBack.Name = dateIndex.ToString(); framBack.Height = Application.GetRealHeight(100); framBack.BackgroundColor = UserCenterColor.Current.White; - listView.AddChidrenFrame(framBack); + listView.AddChidren(framBack); //鏃ユ湡 string strMonth = Language.StringByID(R.MyInternationalizationString.Month); @@ -172,8 +175,15 @@ for (int i = 0; i < listData.Count; i++) { - //娣诲姞淇℃伅琛� - this.AddMsgRowControl(framBack, listData[i], i != listData.Count - 1); + //涓�鏉′俊鎭噷闈紝瀹冨彲鑳藉寘鍚涓姤璀� + for (int j = 0; j < listData[i].listMsg.Count; j++) + { + //璁剧疆宸茶鐨勫垵濮嬪�� + listData[i].ListReading.Add(listData[i].IsReading); + //娣诲姞淇℃伅琛� + bool addLine = i != listData.Count - 1 || j != listData[i].listMsg.Count - 1; + this.AddMsgRowControl(framBack, listData[i], j, addLine); + } } //璋冩暣楂樺害 listView.AdjustChidrenFrameHeight(framBack, Application.GetRealHeight(23)); @@ -249,8 +259,9 @@ /// </summary> /// <param name="frameList"></param> /// <param name="recordInfo"></param> + /// <param name="msgIndex">鎶ヨ娑堟伅鐨勪笅鏍�</param> /// <param name="addLine"></param> - private void AddMsgRowControl(FrameListControl frameList, MessageRecordInfo recordInfo, bool addLine) + private void AddMsgRowControl(FrameListControl frameList, MessageRecordInfo recordInfo, int msgIndex, bool addLine) { var rowControl = new RowLayoutControl(frameList.rowSpace / 2); frameList.AddChidren(rowControl); @@ -265,24 +276,24 @@ var btnMsgObject = rowControl.frameTable.AddLeftCaption(recordInfo.MsgObjectText, 600); //娑堟伅 - var btnMsg = rowControl.frameTable.AddMostRightView(recordInfo.MsgText, 600, 60); + var btnMsg = rowControl.frameTable.AddMostRightView(recordInfo.listMsg[msgIndex], 600, 60); btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; btnMsg.Y = Application.GetRealHeight(5) + rowControl.frameTable.chidrenYaxis; - rowControl.frameTable.AddChidren(btnMsg, ChidrenBindMode.BindEventOnly); + rowControl.frameTable.AddChidren(btnMsg, ChidrenBindMode.BindEvent); //鏃堕棿 var btnTime = rowControl.frameTable.AddMostRightView("", 200, 50); btnTime.TextColor = UserCenterColor.Current.TextGrayColor1; btnTime.Y = btnMsg.Bottom + Application.GetRealHeight(12); var convertTime = UserCenterLogic.ConvertUtcTimeToLocalTime(recordInfo.CreatedOnUtc); btnTime.Text = convertTime.ToString("HH锛歮m"); - rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEventOnly); + rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEvent); //搴曠嚎 if (addLine == true) { - rowControl.frameTable.AddBottomLine(); + rowControl.frameTable.AddBottomLine(); } //宸茶 - if (recordInfo.IsReading == true) + if (recordInfo.ListReading[msgIndex] == true) { rowControl.frameTable.UseClickStatu = false; //娑堟伅绫诲瀷 @@ -295,13 +306,13 @@ //鏂版秷鎭� PicViewControl btnNewTip = null; - if (recordInfo.IsReading == false) + if (recordInfo.ListReading[msgIndex] == false) { btnNewTip = new PicViewControl(78, 55); btnNewTip.UnSelectedImagePath = "Item/NewVersion.png"; btnNewTip.Y = Application.GetRealHeight(9) + rowControl.frameTable.chidrenYaxis; btnNewTip.X = btnMsgObject.Right + Application.GetRealWidth(10); - rowControl.frameTable.AddChidren(btnNewTip, ChidrenBindMode.BindEventOnly); + rowControl.frameTable.AddChidren(btnNewTip, ChidrenBindMode.BindEvent); } //涓昏涓讳汉鍜岀鐞嗗憳鑳藉鍒犻櫎 @@ -313,9 +324,9 @@ { //纭鍒犻櫎娑堟伅? string msg = Language.StringByID(R.MyInternationalizationString.uDeleteMessageMsg); - this.ShowMassage(ShowMsgType.Confirm, msg, async () => + this.ShowMassage(ShowMsgType.Confirm, msg, () => { - await this.DeleteMsg(recordInfo.Id, frameList, rowControl); + this.DeleteMsg(recordInfo.Id, frameList, rowControl); }); }; } @@ -323,11 +334,11 @@ //鐐瑰嚮 rowControl.frameTable.ButtonClickEvent += async (sender, e) => { - if (recordInfo.IsReading == true) + if (recordInfo.ListReading[msgIndex] == true) { return; } - recordInfo.IsReading = true; + recordInfo.ListReading[msgIndex] = true; rowControl.frameTable.UseClickStatu = false; //娑堟伅绫诲瀷 btnMsgObject.TextColor = UserCenterColor.Current.TextGrayColor1; @@ -337,7 +348,7 @@ if (sender != null) { //鏍囪宸茶(涓嶇瀹冩垚鍔熶笉鎴愬姛) - await this.SetTickIsRead(recordInfo.Id); + this.SetTickIsRead(recordInfo.Id); } }; } @@ -350,12 +361,12 @@ /// 鏍囪宸茶 /// </summary> /// <param name="strId"></param> - private async System.Threading.Tasks.Task<bool> SetTickIsRead(string strId) + private bool SetTickIsRead(string strId) { var pra = new MessageReadStatuPra(); pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); pra.Id = strId; - var result = await UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagMessageMessageCenterItem", true, pra); + var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagMessageMessageCenterItem", true, pra); return result; } @@ -371,23 +382,21 @@ //纭鏍囪鍏ㄩ儴娑堟伅涓哄凡璇�? this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uUnTipAllMessageMsg), () => { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //鎵撳紑杩涘害鏉� this.ShowProgressBar(); - foreach (var contr in this.dicAllRow.Values) - { - //鏍囪瘑鍏ㄩ儴涓哄凡璇� - var result = await this.SetTickIsRead(contr.MainKeys); - if (result == false) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return; - } - } + + var pra = new MessageReadStatuPra(); + pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + pra.TagAllOrClearType = 0; + var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagAllOrClearMessageCenter", true, pra); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); + if (result == false) + { + return; + } HdlThreadLogic.Current.RunMain(() => { @@ -411,12 +420,12 @@ /// <param name="strId"></param> /// <param name="frameList"></param> /// <param name="rowContr"></param> - private async System.Threading.Tasks.Task<bool> DeleteMsg(string strId, FrameListControl frameList, RowLayoutControl rowContr) + private bool DeleteMsg(string strId, FrameListControl frameList, RowLayoutControl rowContr) { var pra = new MessageReadStatuPra(); pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); pra.Id = strId; - var result = await UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/DelMessageCenterItem", true, pra); + var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/DelMessageCenterItem", true, pra); if (result == false) { return false; @@ -448,20 +457,20 @@ //纭鍒犻櫎鍏ㄩ儴娑堟伅? this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uDeleteAllMessageMsg), () => { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //鎵撳紑杩涘害鏉� this.ShowProgressBar(); - foreach (var contr in this.dicAllRow.Values) + + var pra = new MessageReadStatuPra(); + pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + pra.TagAllOrClearType = 1; + var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagAllOrClearMessageCenter", true, pra); + if (result == false) { - //鍒犻櫎鍏ㄩ儴娑堟伅 - var result = await this.DeleteMsg(contr.MainKeys, null, null); - if (result == false) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return; - } + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + return; } //鍒濆鍖栦腑閮ㄤ俊鎭� this.InitMiddleData(true); @@ -543,7 +552,7 @@ /// 鑾峰彇娑堟伅璁板綍 /// </summary> /// <returns></returns> - private async Task<Dictionary<string, List<List<MessageRecordInfo>>>> GetMessageData() + private Dictionary<string, List<List<MessageRecordInfo>>> GetMessageData() { this.dicAllRow = new Dictionary<string, RowLayoutControl>(); var allListData = new List<MessageRecordInfo>(); @@ -553,7 +562,7 @@ //浼犳劅鍣ㄤ笂鎶� pra.Topic = "/IASInfoReport"; - var dataInfo = await this.GetMessageDataFromDb(pra); + var dataInfo = this.GetMessageDataFromDb(pra); if (dataInfo == null) { return null; @@ -562,7 +571,7 @@ //闂ㄩ攣涓婃姤 pra.Topic = "/Alarms/SendAlarmInform"; - dataInfo = await this.GetMessageDataFromDb(pra); + dataInfo = this.GetMessageDataFromDb(pra); if (dataInfo == null) { return null; @@ -571,7 +580,7 @@ //鎾ら槻 pra.Topic = "/Security/WithdrawMode_Respon"; - dataInfo = await this.GetMessageDataFromDb(pra); + dataInfo = this.GetMessageDataFromDb(pra); if (dataInfo == null) { return null; @@ -580,7 +589,7 @@ //甯冮槻 pra.Topic = "/Security/EnableMode_Respon"; - dataInfo = await this.GetMessageDataFromDb(pra); + dataInfo = this.GetMessageDataFromDb(pra); if (dataInfo == null) { return null; @@ -589,7 +598,7 @@ //閫昏緫瑙﹀彂涓婃姤 pra.Topic = "/Logic/Execute_Respon"; - dataInfo = await this.GetMessageDataFromDb(pra); + dataInfo = this.GetMessageDataFromDb(pra); if (dataInfo == null) { return null; @@ -598,7 +607,7 @@ //鍦烘櫙瑙﹀彂涓婃姤 pra.Topic = "/Scene/Exec_Respon"; - dataInfo = await this.GetMessageDataFromDb(pra); + dataInfo = this.GetMessageDataFromDb(pra); if (dataInfo == null) { return null; @@ -614,10 +623,10 @@ /// </summary> /// <param name="pra"></param> /// <returns></returns> - private async Task<List<MessageRecordInfo>> GetMessageDataFromDb(MessageInfoPra pra) + private List<MessageRecordInfo> GetMessageDataFromDb(MessageInfoPra pra) { - var result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra); - if (result == null) + var result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra); + if (string.IsNullOrEmpty(result) == true) { return null; } @@ -759,7 +768,8 @@ { recordInfo.IconPath = "Device/Sensor.png"; //娑堟伅绫诲瀷:浼犳劅鍣� - recordInfo.MsgObjectText = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId1200); + var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A402"); + recordInfo.MsgObjectText = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty; } else { @@ -776,19 +786,27 @@ if (info == null) { //闈炲湪鍐岀殑娑堟伅璁板綍 - recordInfo.MsgText = Language.StringByID(R.MyInternationalizationString.uSensorAlarmHadTriggered); + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uSensorAlarmHadTriggered)); + return true; } - else if (info.BatteryMsg != null) + + if (string.IsNullOrEmpty(info.AlarmMsg) == false) { - recordInfo.MsgText = info.BatteryMsg; + recordInfo.listMsg.Add(info.AlarmMsg); } - else if (info.DemolishmenMsg != null) + if (info.BatteryMsg != null) { - recordInfo.MsgText = info.DemolishmenMsg; + recordInfo.listMsg.Add(info.BatteryMsg); } - else + if (info.DemolishmenMsg != null) { - recordInfo.MsgText = string.IsNullOrEmpty(info.AlarmMsg) == false ? info.AlarmMsg : Language.StringByID(R.MyInternationalizationString.uSensorAlarmHadTriggered); + recordInfo.listMsg.Add(info.DemolishmenMsg); + } + + //瑙﹀彂浼犳劅鍣ㄦ姤璀� + if (recordInfo.listMsg.Count == 0) + { + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uSensorAlarmHadTriggered)); } return true; } @@ -809,7 +827,8 @@ { recordInfo.IconPath = "Device/IntelligentLocks.png"; //娑堟伅绫诲瀷:鏅鸿兘闂ㄩ攣 - recordInfo.MsgObjectText = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); + var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A405"); + recordInfo.MsgObjectText = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty; } else { @@ -822,7 +841,8 @@ } //娑堟伅 var msgInfo = HdlAlarmsLogic.Current.GetDoorLockAlarmInfo(receiveData); - recordInfo.MsgText = msgInfo != null ? msgInfo.AlarmMsg : Language.StringByID(R.MyInternationalizationString.uDoorLocksAlarmHadTriggered); + string MsgText = msgInfo != null ? msgInfo.AlarmMsg : Language.StringByID(R.MyInternationalizationString.uDoorLocksAlarmHadTriggered); + recordInfo.listMsg.Add(MsgText); } #endregion @@ -847,12 +867,12 @@ //绂诲甯冮槻 recordInfo.MsgObjectText = Language.StringByID(R.MyInternationalizationString.uRemoveHomeGarrison); //宸叉墽琛� - recordInfo.MsgText = Language.StringByID(R.MyInternationalizationString.uExecuted); + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uExecuted)); } else { //宸叉墽琛� - recordInfo.MsgText = Language.StringByID(R.MyInternationalizationString.uExecuted); + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uExecuted)); //娌℃湁鍐呴儴闃插尯 if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == false) { @@ -890,7 +910,7 @@ if (data.Result == 0) { //宸叉墽琛� - recordInfo.MsgText = Language.StringByID(R.MyInternationalizationString.uExecuted); + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uExecuted)); //鎾ら槻 recordInfo.MsgObjectText = Language.StringByID(R.MyInternationalizationString.uWithdrawGarrison); } @@ -916,7 +936,7 @@ //绫诲瀷:閫昏緫鍚嶅瓧 recordInfo.MsgObjectText = receiveData["Data"]["LogicName"].ToString(); //宸叉墽琛� - recordInfo.MsgText = Language.StringByID(R.MyInternationalizationString.uExecuted); + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uExecuted)); } #endregion @@ -934,7 +954,7 @@ //绫诲瀷:鍦烘櫙鍚嶅瓧 recordInfo.MsgObjectText = receiveData["Data"]["ScenesName"].ToString(); //宸叉墽琛� - recordInfo.MsgText = Language.StringByID(R.MyInternationalizationString.uExecuted); + recordInfo.listMsg.Add(Language.StringByID(R.MyInternationalizationString.uExecuted)); } #endregion @@ -946,7 +966,8 @@ /// </summary> public override void CloseFormBefore() { - if (UserCenterResourse.DicActionForm.ContainsKey("UserMainForm") == false) + var userPageForm = UserView.UserPage.Instance.GetNowActionForm(); + if (userPageForm != null && userPageForm.FormID == "UserMainForm") { Common.CommonPage.Instance.IsDrawerLockMode = false; } -- Gitblit v1.8.0