wei
2021-09-23 a3b92962f31cb3bbebaba37475b3a8417831520f
HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs
@@ -140,7 +140,7 @@
#endif
            };
#endregion
            #endregion
            #region 分享与功能
            shareMenuButton = new MenuButton()
@@ -160,7 +160,7 @@
            shareMenuButton.SelectAction = shateAction;
            #endregion
#region 报警类
            #region 报警类
            alarmMenuButton = new MenuButton()
            {
                X = shareMenuButton.Right,
@@ -175,9 +175,9 @@
                MenuButtonSelect(2);
            };
            alarmMenuButton.SelectAction = alarmAction;
#endregion
            #endregion
#region 系统信息
            #region 系统信息
            systemMenuButton = new MenuButton()
            {
                X = alarmMenuButton.Right,
@@ -194,16 +194,17 @@
            systemMenuButton.SelectAction = systemAction;
            #endregion
            #region 物业通知
            #region 物业通知 2021-09-15增加
            propertyMenuButton = new MenuButton()
            {
                X = systemMenuButton.Right,
                Y = Application.GetRealWidth(16),
            };
            //menuView.AddChidren(propertyMenuButton); //先屏蔽
            propertyMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/SystemOn.png";
            propertyMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/System.png";
            propertyMenuButton.TextButton.TextID = StringId.SystemMessage;
            menuView.AddChidren(propertyMenuButton);
            propertyMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/PropertyOn.png";
            propertyMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/Property.png";
            propertyMenuButton.TextButton.TextID = StringId.Propertynotice;
            propertyMenuButton.TextButton.IsMoreLines = true;
            Action propertyAction = () =>
            {
                MenuButtonSelect(4);
@@ -211,12 +212,12 @@
            propertyMenuButton.SelectAction = propertyAction;
            #endregion
            //先屏蔽
            ////右paddingView
            //menuView.AddChidren(new Button() {
            //    Width = Application.GetRealWidth(15),
            //    BackgroundColor = CSS_Color.viewTranslucence
            //});
            //右paddingView
            menuView.AddChidren(new Button()
            {
                Width = Application.GetRealWidth(15),
                BackgroundColor = CSS_Color.viewTranslucence
            });
        }
@@ -295,6 +296,8 @@
                propertyMenuButton.IsSelected = true;
            }
            menuView.ScrollToX(selectId * Application.GetRealWidth(40));
            GetPushMessageList(showMesType);
        }
@@ -404,16 +407,17 @@
            btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime);
            //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;
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                OnClickPushMessageInfo(pushMessageInfo);
                //new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show();
            };
            rowView.MouseUpEventHandler = eventHandler;
            btnTilte.MouseUpEventHandler = eventHandler;
            btnSubtitle.MouseUpEventHandler = eventHandler;
        }
        /// <summary>
@@ -447,7 +451,13 @@
            {
                try
                {
                    var result = new HttpServerRequest().PushSerivceDeleteMessage(pushMessageInfo.id);
                    var delPush = new PushMsgIdObj()
                    {
                        msgId = pushMessageInfo.id,
                        pushType = pushMessageInfo.pushType
                    };
                    var result = new HttpServerRequest().PushSerivceDeleteMessage(delPush);
                    if (result)
                    {
                        PushMessageInfoList.Remove(pushMessageInfo);
@@ -512,7 +522,7 @@
        void GetPushMessageList(int queryType = 0)
        {
            bodyScrolView.RemoveAll();
            if(PushMessageInfoList == null)
            if (PushMessageInfoList == null)
            {
                PushMessageInfoList = new List<PushMessageInfo>();
            }
@@ -520,7 +530,7 @@
            {
                PushMessageInfoList.Clear();
            }
            YearMark = "";//标记清空
            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId))
            {
@@ -542,7 +552,8 @@
                        //PushMessageInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PushMessageInfo>>(result.Data.ToString());
                        //2021-08-28 改为分页接口
                        var mPushMesList = Newtonsoft.Json.JsonConvert.DeserializeObject<PushMessageInfoList>(result.Data.ToString());
                        if(mPushMesList != null) {
                        if (mPushMesList != null)
                        {
                            PushMessageInfoList = mPushMesList.list;
                        }
@@ -613,7 +624,107 @@
            }
        }
#region 测试
        /// <summary>
        /// 获取物业通知详情
        /// </summary>
        /// <param name="noticeId"></param>
        void GetPropertyNoticeDetails(string noticeId)
        {
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            new Thread(() =>
            {
                try
                {
                    var result = new HttpServerRequest().GetPropertyNoticeDetails(noticeId);
                    if (result.Code == StateCode.SUCCESS)
                    {
                        var mPushNoticeInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<PushNoticeInfo>(result.Data.ToString());
                        if (mPushNoticeInfo != null)
                        {
                            Application.RunOnMainThread(() =>
                            {
                                new WebViewDialog().LoadPageWithHtmlStr(mPushNoticeInfo.title, mPushNoticeInfo.content);
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 通知信息点击事件
        /// </summary>
        /// <param name="pushMessageInfo"></param>
        void OnClickPushMessageInfo(PushMessageInfo pushMessageInfo)
        {
            if (pushMessageInfo.pushType == PushType.Notice.ToString())
            {
                //Utlis.WriteLine("物业通知");
                string noticeId = GetNoticeId(pushMessageInfo.messageExpand);
                if (!string.IsNullOrEmpty(noticeId))
                {
                    GetPropertyNoticeDetails(noticeId);
                }
                else
                {
                    Utlis.WriteLine("noticeId null");
                }
            }
            else
            {
                Utlis.WriteLine("其它通知类型");
            }
        }
        /// <summary>
        /// 解析messageExpand 提取targetId
        /// </summary>
        /// <param name="messageExpand"></param>
        /// <returns></returns>
        string GetNoticeId(string messageExpand)
        {
            try
            {
                if (!string.IsNullOrEmpty(messageExpand))
                {
                    var mMessageExpandInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageExpandInfo>(messageExpand);
                    if (mMessageExpandInfo != null)
                    {
                        var mExpantContentInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpantContentInfo>(mMessageExpandInfo.expantContent);
                        if(mExpantContentInfo != null)
                        {
                            return mExpantContentInfo.targetId;
                        }
                    }
                }
                return null;
            }
            catch
            {
                return null;
            }
        }
        #region 测试
#if DEBUG
        /// <summary>
        /// 
@@ -688,7 +799,7 @@
#endif
#endregion
        #endregion
        /// <summary>
        /// 标记所有推送消息已读
@@ -778,10 +889,10 @@
        /// 消息内容
        /// </summary>
        public string messageContent;
        ///// <summary>
        ///// 扩展数据
        ///// </summary>
        //public string messageExpand;
        /// <summary>
        /// 扩展数据
        /// </summary>
        public string messageExpand;
        ///// <summary>
        ///// 消息类型;0:提示;1:报警;2:丰林可是对讲呼叫;3:强制下线推送
        ///// </summary>
@@ -806,4 +917,56 @@
    }
    /// <summary>
    /// 物业公告详情
    /// </summary>
    [System.Serializable]
    public class PushNoticeInfo
    {
        /// <summary>
        /// 消息ID
        /// </summary>
        public string noticeId;
        /// <summary>
        /// 消息标题
        /// </summary>
        public string title;
        /// <summary>
        /// 富文本内容
        /// </summary>
        public string content;
    }
    /// <summary>
    /// 推送扩展信息
    /// </summary>
    [System.Serializable]
    public class MessageExpandInfo
    {
        /// <summary>
        /// expantContent
        /// </summary>
        public string expantContent;
    }
    /// <summary>
    /// 推送扩展信息
    /// </summary>
    [System.Serializable]
    public class ExpantContentInfo
    {
        /// <summary>
        /// targetId
        /// </summary>
        public string targetId;
        /// <summary>
        /// messageType
        /// </summary>
        public string messageType;
    }
}