| | |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | | #if DEBUG |
| | | using Xamarin.Essentials; |
| | | #endif |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | List<PushMessageInfo> PushMessageInfoList = new List<PushMessageInfo>(); |
| | | |
| | | /// <summary> |
| | | /// 页面关闭时间 |
| | | /// </summary> |
| | | Action backAction; |
| | | |
| | | public override void RemoveFromParent() |
| | | { |
| | | UnregisterGetPushMessageAction(); |
| | | base.RemoveFromParent(); |
| | | backAction?.Invoke(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | /// <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(); |
| | | //测试代码 |
| | | //AddEmptyTipView(); |
| | | //TestLoad(); |
| | |
| | | MenuButtonSelect(0); |
| | | }; |
| | | allMenuButton.SelectAction = allAction; |
| | | |
| | | #if DEBUG |
| | | //测试提前当前推送ID |
| | | allMenuButton.ImageButton.MouseLongEventHandler = (sender, e) => |
| | | { |
| | | CopyToClipboard("推送ID:" + OnAppConfig.Instance.PushId); |
| | | }; |
| | | #endif |
| | | #endregion |
| | | |
| | | #region 分享与功能 |
| | |
| | | }; |
| | | rowView.AddChidren(btnDatetime); |
| | | |
| | | var lineView = new LineView(rowView.Height); |
| | | var lineView = new LineView(rowView.Height - Application.GetRealHeight(1)); |
| | | rowView.AddChidren(lineView); |
| | | |
| | | //删除按钮 |
| | |
| | | |
| | | |
| | | 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> |
| | |
| | | bodyScrolView.RemoveAll(); |
| | | PushMessageInfoList.Clear(); |
| | | YearMark = "";//标记清空 |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) { |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) |
| | | { |
| | | AddEmptyTipView(); |
| | | return; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 标记所有推送消息已读 |
| | | /// </summary> |
| | | void PushSerivceMarkAllMessageRead() { |
| | | void PushSerivceMarkAllMessageRead() |
| | | { |
| | | new Thread(() => |
| | | { |
| | | var result = new HttpServerRequest().PushSerivceMarkAllMessageRead(); |
| | |
| | | { 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 |
| | | |
| | | } |
| | | |