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>
@@ -43,6 +45,12 @@
        List<PushMessageInfo> PushMessageInfoList = new List<PushMessageInfo>();
        public override void RemoveFromParent()
        {
            UnregisterGetPushMessageAction();
            base.RemoveFromParent();
        }
        /// <summary>
        /// 
        /// </summary>
@@ -63,7 +71,7 @@
            AddTopMenuView();
            AddMessageView();
            MenuButtonSelect(showMesType);
            RegisterGetPushMessageAction();
            //测试代码
            //AddEmptyTipView();
            //TestLoad();
@@ -99,6 +107,14 @@
                MenuButtonSelect(0);
            };
            allMenuButton.SelectAction = allAction;
#if DEBUG
            //测试提前当前推送ID
            allMenuButton.ImageButton.MouseLongEventHandler = (sender, e) =>
            {
                CopyToClipboard("推送ID:" + OnAppConfig.Instance.PushId);
            };
#endif
            #endregion
            #region 分享与功能
@@ -426,7 +442,8 @@
            bodyScrolView.RemoveAll();
            PushMessageInfoList.Clear();
            YearMark = "";//标记清空
            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) {
            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId))
            {
                AddEmptyTipView();
                return;
            }
@@ -590,7 +607,8 @@
        /// <summary>
        /// 标记所有推送消息已读
        /// </summary>
        void PushSerivceMarkAllMessageRead() {
        void PushSerivceMarkAllMessageRead()
        {
            new Thread(() =>
            {
                var result = new HttpServerRequest().PushSerivceMarkAllMessageRead();
@@ -608,6 +626,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
    }