From 5eeafe3af80bfd88306bd8ad9e76c8f4b51ca35f Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 14:16:20 +0800 Subject: [PATCH] 增加本地发送的重发机制 --- HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs | 84 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 72 insertions(+), 12 deletions(-) diff --git a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs index 517fce4..87d2684 100644 --- a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs @@ -4,7 +4,9 @@ using System.Collections.Generic; using System.Threading; using HDL_ON.DAL.Server; - +#if DEBUG +using Xamarin.Essentials; +#endif namespace HDL_ON.UI { /// <summary> @@ -42,6 +44,17 @@ /// </summary> List<PushMessageInfo> PushMessageInfoList = new List<PushMessageInfo>(); + /// <summary> + /// 椤甸潰鍏抽棴鏃堕棿 + /// </summary> + Action backAction; + + public override void RemoveFromParent() + { + UnregisterGetPushMessageAction(); + base.RemoveFromParent(); + backAction?.Invoke(); + } /// <summary> /// @@ -58,12 +71,13 @@ /// <param name="backAction"></param> public void LoadPage(Action backAction) { - new TopViewDiv(bodyView, Language.StringByID(StringId.MessageCenter)).LoadTopView(backAction); + this.backAction = backAction; + new TopViewDiv(bodyView, Language.StringByID(StringId.MessageCenter)).LoadTopView(); AddTopMenuView(); AddMessageView(); MenuButtonSelect(showMesType); - + RegisterGetPushMessageAction(); //娴嬭瘯浠g爜 //AddEmptyTipView(); //TestLoad(); @@ -99,6 +113,14 @@ MenuButtonSelect(0); }; allMenuButton.SelectAction = allAction; + +#if DEBUG + //娴嬭瘯鎻愬墠褰撳墠鎺ㄩ�両D + allMenuButton.ImageButton.MouseLongEventHandler = (sender, e) => + { + CopyToClipboard("鎺ㄩ�両D锛�" + OnAppConfig.Instance.PushId); + }; +#endif #endregion #region 鍒嗕韩涓庡姛鑳� @@ -300,7 +322,7 @@ }; rowView.AddChidren(btnDatetime); - var lineView = new LineView(rowView.Height); + var lineView = new LineView(rowView.Height - Application.GetRealHeight(1)); rowView.AddChidren(lineView); //鍒犻櫎鎸夐挳 @@ -319,12 +341,13 @@ btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime); - //EventHandler<MouseEventArgs> eventHandler = (sender, e) => - //{ - //}; - - //btnTilte.MouseUpEventHandler = eventHandler; - //btnSubtitle.MouseUpEventHandler = eventHandler; + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); + }; + rowView.MouseUpEventHandler = eventHandler; + btnTilte.MouseUpEventHandler = eventHandler; + btnSubtitle.MouseUpEventHandler = eventHandler; } /// <summary> @@ -425,7 +448,8 @@ bodyScrolView.RemoveAll(); PushMessageInfoList.Clear(); YearMark = "";//鏍囪娓呯┖ - if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) { + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) + { AddEmptyTipView(); return; } @@ -589,7 +613,8 @@ /// <summary> /// 鏍囪鎵�鏈夋帹閫佹秷鎭凡璇� /// </summary> - void PushSerivceMarkAllMessageRead() { + void PushSerivceMarkAllMessageRead() + { new Thread(() => { var result = new HttpServerRequest().PushSerivceMarkAllMessageRead(); @@ -607,6 +632,41 @@ { IsBackground = true }.Start(); } + /// <summary> + /// 娉ㄥ唽鏀跺埌鎺ㄩ�佺洃鍚� + /// </summary> + void RegisterGetPushMessageAction() + { + HDLCommon.GetPushMessageAction = () => + { + if (bodyView != null) + { + //Utlis.WriteLine("GetPushMessageAction M鏀跺埌鎺ㄩ��"); + GetPushMessageList(showMesType); + } + }; + } + + /// <summary> + /// 鍙栨秷鏀跺埌鎺ㄩ�佺洃鍚� + /// </summary> + void UnregisterGetPushMessageAction() + { + HDLCommon.GetPushMessageAction = null; + } + +#if DEBUG + + /// <summary> + /// 澶嶅埗鍒板壀鍒囨澘 + /// </summary> + /// <param name="text"></param> + void CopyToClipboard(string text) + { + Clipboard.SetTextAsync(text); + Utlis.ShowTip(text + "\n" + Language.StringByID(StringId.CopySuccess)); + } +#endif } -- Gitblit v1.8.0