From f5268d43584a1f72cb7b19c17232645c24e2348b Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 17 十二月 2020 15:29:31 +0800 Subject: [PATCH] 20201217-3 --- HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs | 100 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 85 insertions(+), 15 deletions(-) diff --git a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs index 4ea4cbd..f130b5b 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,9 +113,28 @@ MenuButtonSelect(0); }; allMenuButton.SelectAction = allAction; - #endregion + //娴嬭瘯鎻愬墠褰撳墠鎺ㄩ�両D + allMenuButton.ImageButton.MouseLongEventHandler = (sender, e) => + { +#if DEBUG - #region 鍒嗕韩涓庡姛鑳� + CopyToClipboard("鎺ㄩ�両D锛�" + OnAppConfig.Instance.PushId); +#else + //妫�娴嬫槸鍚﹁幏鍙栨帹閫両D鎴愬姛锛屾彁绀烘帹閫佹敞鍐屾槸鍚︽甯� + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) + { + Utlis.ShowTip(Language.StringByID(StringId.PushException)); + } + else + { + Utlis.ShowTip(Language.StringByID(StringId.PushNormal)); + } +#endif + + }; +#endregion + +#region 鍒嗕韩涓庡姛鑳� shareMenuButton = new MenuButton() { X = allMenuButton.Right, @@ -116,9 +149,9 @@ MenuButtonSelect(1); }; shareMenuButton.SelectAction = shateAction; - #endregion +#endregion - #region 鎶ヨ绫� +#region 鎶ヨ绫� alarmMenuButton = new MenuButton() { X = shareMenuButton.Right, @@ -133,9 +166,9 @@ MenuButtonSelect(2); }; alarmMenuButton.SelectAction = alarmAction; - #endregion +#endregion - #region 绯荤粺淇℃伅 +#region 绯荤粺淇℃伅 systemMenuButton = new MenuButton() { X = alarmMenuButton.Right, @@ -150,7 +183,7 @@ MenuButtonSelect(3); }; systemMenuButton.SelectAction = systemAction; - #endregion +#endregion } @@ -323,7 +356,7 @@ { new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); }; - + rowView.MouseUpEventHandler = eventHandler; btnTilte.MouseUpEventHandler = eventHandler; btnSubtitle.MouseUpEventHandler = eventHandler; } @@ -426,7 +459,8 @@ bodyScrolView.RemoveAll(); PushMessageInfoList.Clear(); YearMark = "";//鏍囪娓呯┖ - if (string.IsNullOrEmpty(UserInfo.Current.PushId)) { + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) + { AddEmptyTipView(); return; } @@ -510,7 +544,7 @@ } } - #region 娴嬭瘯 +#region 娴嬭瘯 #if DEBUG /// <summary> /// @@ -585,12 +619,13 @@ #endif - #endregion +#endregion /// <summary> /// 鏍囪鎵�鏈夋帹閫佹秷鎭凡璇� /// </summary> - void PushSerivceMarkAllMessageRead() { + void PushSerivceMarkAllMessageRead() + { new Thread(() => { var result = new HttpServerRequest().PushSerivceMarkAllMessageRead(); @@ -608,6 +643,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