From d72ca686a3e262693f8a6e45e747e8e8da43335b Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 06 七月 2021 09:39:03 +0800 Subject: [PATCH] 2021-07-06 1.更新 --- HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs | 152 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 120 insertions(+), 32 deletions(-) diff --git a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs index 4ea4cbd..05cabc6 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, @@ -111,14 +144,15 @@ shareMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/ShareOn.png"; shareMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/Share.png"; shareMenuButton.TextButton.TextID = StringId.SharingAndFunctionality; + shareMenuButton.TextButton.IsMoreLines = true; Action shateAction = () => { MenuButtonSelect(1); }; shareMenuButton.SelectAction = shateAction; - #endregion +#endregion - #region 鎶ヨ绫� +#region 鎶ヨ绫� alarmMenuButton = new MenuButton() { X = shareMenuButton.Right, @@ -133,9 +167,9 @@ MenuButtonSelect(2); }; alarmMenuButton.SelectAction = alarmAction; - #endregion +#endregion - #region 绯荤粺淇℃伅 +#region 绯荤粺淇℃伅 systemMenuButton = new MenuButton() { X = alarmMenuButton.Right, @@ -150,7 +184,7 @@ MenuButtonSelect(3); }; systemMenuButton.SelectAction = systemAction; - #endregion +#endregion } @@ -188,9 +222,9 @@ if (selectId == 0) { allMenuButton.IsSelected = true; - shareMenuButton.IsSelected = false; - alarmMenuButton.IsSelected = false; - systemMenuButton.IsSelected = false; + shareMenuButton.IsSelected = true; + alarmMenuButton.IsSelected = true; + systemMenuButton.IsSelected = true; } else if (selectId == 1) @@ -260,21 +294,27 @@ VerticalScrolViewMiddle.AddChidren(rowView); //鏍囬 - var btnTilte = new Button() + var btnTilte = new TextButton() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(12), - Width = Application.GetRealWidth(320), - Height = Application.GetRealHeight(20), + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(20), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, - Text = pushMessageInfo.messageTitle + Text = pushMessageInfo.messageContent, + //IsMoreLines = true, }; rowView.AddChidren(btnTilte); + // + var needHeight = btnTilte.GetMoreLineNeedHeight(); + btnTilte.IsMoreLines = true; + btnTilte.Height = needHeight; + rowView.Height = Application.GetRealHeight(45) + needHeight; //鍓爣棰� - var btnSubtitle = new Button() + var btnSubtitle = new TextButton() { X = Application.GetRealWidth(16), Y = btnTilte.Bottom + Application.GetRealHeight(4), @@ -283,7 +323,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = pushMessageInfo.messageContent + Text = pushMessageInfo.messageTitle }; rowView.AddChidren(btnSubtitle); @@ -319,13 +359,16 @@ btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime); - EventHandler<MouseEventArgs> eventHandler = (sender, e) => - { - new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); - }; + //2020-12-23 鍘绘帀鐐瑰嚮寮圭獥浜嬩欢 + //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; - btnTilte.MouseUpEventHandler = eventHandler; - btnSubtitle.MouseUpEventHandler = eventHandler; + } /// <summary> @@ -402,7 +445,7 @@ }; VerticalScrolViewMiddle.AddChidren(bgView); - var yearBtn = new Button() + var yearBtn = new TextButton() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(16), @@ -412,9 +455,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, IsBold = true, - Text = yearStr }; bgView.AddChidren(yearBtn); + yearBtn.Text = yearStr + Language.StringByID(StringId.Years); } /// <summary> @@ -424,9 +467,18 @@ void GetPushMessageList(int queryType = 0) { bodyScrolView.RemoveAll(); - PushMessageInfoList.Clear(); + if(PushMessageInfoList == null) + { + PushMessageInfoList = new List<PushMessageInfo>(); + } + else + { + PushMessageInfoList.Clear(); + } + YearMark = "";//鏍囪娓呯┖ - if (string.IsNullOrEmpty(UserInfo.Current.PushId)) { + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) + { AddEmptyTipView(); return; } @@ -510,7 +562,7 @@ } } - #region 娴嬭瘯 +#region 娴嬭瘯 #if DEBUG /// <summary> /// @@ -585,12 +637,13 @@ #endif - #endregion +#endregion /// <summary> /// 鏍囪鎵�鏈夋帹閫佹秷鎭凡璇� /// </summary> - void PushSerivceMarkAllMessageRead() { + void PushSerivceMarkAllMessageRead() + { new Thread(() => { var result = new HttpServerRequest().PushSerivceMarkAllMessageRead(); @@ -608,6 +661,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