| | |
| | | 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"; |
| | | 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 = () => |
| | |
| | | propertyMenuButton.SelectAction = propertyAction; |
| | | #endregion |
| | | |
| | | //先屏蔽 |
| | | //右paddingView |
| | | menuView.AddChidren(new Button() |
| | | { |
| | |
| | | |
| | | |
| | | 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> |
| | | /// 获取物业通知详情 |
| | | /// </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> |
| | |
| | | /// 消息内容 |
| | | /// </summary> |
| | | public string messageContent; |
| | | ///// <summary> |
| | | ///// 扩展数据 |
| | | ///// </summary> |
| | | //public string messageExpand; |
| | | /// <summary> |
| | | /// 扩展数据 |
| | | /// </summary> |
| | | public string messageExpand; |
| | | ///// <summary> |
| | | ///// 消息类型;0:提示;1:报警;2:丰林可是对讲呼叫;3:强制下线推送 |
| | | ///// </summary> |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <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; |
| | | |
| | | } |
| | | |
| | | |
| | | } |