| | |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | | #if DEBUG |
| | | using Xamarin.Essentials; |
| | | #endif |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 内容为空提示View |
| | | /// </summary> |
| | | EmptyTipView emptyTipView; |
| | | FrameLayout emptyTipView; |
| | | |
| | | /// <summary> |
| | | /// menuView |
| | | /// </summary> |
| | | FrameLayout menuView; |
| | | HorizontalScrolViewLayout menuView;//2021-08-27 增加多了一个菜单按钮所以改为滚动控件 |
| | | MenuButton allMenuButton; |
| | | MenuButton shareMenuButton; |
| | | MenuButton alarmMenuButton; |
| | | MenuButton systemMenuButton; |
| | | MenuButton propertyMenuButton;//增加物业通知按钮 |
| | | FrameLayout messageView; |
| | | |
| | | /// <summary> |
| | | /// 显示的消息类型 |
| | | /// 1全部 2分享与功能 3报警类 4系统信息 |
| | | /// 0全部 1分享与功能 2报警类 3系统信息 4物业公告 |
| | | /// </summary> |
| | | int showMesType = 1; |
| | | int showMesType = 0; |
| | | /// <summary> |
| | | /// 推送消息列表 |
| | | /// </summary> |
| | | List<PushMessageInfo> PushMessageInfoList = new List<PushMessageInfo>(); |
| | | |
| | | /// <summary> |
| | | /// 页面关闭时间 |
| | | /// </summary> |
| | | Action backAction; |
| | | |
| | | public override void RemoveFromParent() |
| | | { |
| | | UnregisterGetPushMessageAction(); |
| | | base.RemoveFromParent(); |
| | | backAction?.Invoke(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void LoadPage() |
| | | /// <param name="backAction"></param> |
| | | public void LoadPage(Action backAction) |
| | | { |
| | | this.backAction = backAction; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.MessageCenter)).LoadTopView(); |
| | | |
| | | AddTopMenuView(); |
| | | AddMessageView(); |
| | | MenuButtonSelect(1); |
| | | MenuButtonSelect(showMesType); |
| | | RegisterGetPushMessageAction(); |
| | | //测试代码 |
| | | //AddEmptyTipView(); |
| | | //TestLoad(); |
| | | GetPushMessageList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | void AddTopMenuView() |
| | | { |
| | | |
| | | menuView = new FrameLayout() |
| | | menuView = new HorizontalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealWidth(117), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | HorizontalScrollBarEnabled = false//隐藏滚动条 |
| | | }; |
| | | bodyView.AddChidren(menuView); |
| | | |
| | | //左padding View |
| | | menuView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(15), |
| | | BackgroundColor = CSS_Color.viewTranslucence |
| | | }); |
| | | |
| | | #region 全部按钮 |
| | | allMenuButton = new MenuButton() |
| | |
| | | allMenuButton.TextButton.TextID = StringId.All; |
| | | Action allAction = () => |
| | | { |
| | | MenuButtonSelect(1); |
| | | MenuButtonSelect(0); |
| | | }; |
| | | allMenuButton.SelectAction = allAction; |
| | | //测试提前当前推送ID |
| | | allMenuButton.ImageButton.MouseLongEventHandler = (sender, e) => |
| | | { |
| | | #if DEBUG |
| | | |
| | | CopyToClipboard("推送ID:" + OnAppConfig.Instance.PushId); |
| | | #else |
| | | //检测是否获取推送ID成功,提示推送注册是否正常 |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) |
| | | { |
| | | Utlis.ShowTip(Language.StringByID(StringId.PushException)); |
| | | } |
| | | else |
| | | { |
| | | Utlis.ShowTip(Language.StringByID(StringId.PushNormal)); |
| | | } |
| | | #endif |
| | | |
| | | }; |
| | | #endregion |
| | | |
| | | #region 分享与功能 |
| | |
| | | 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(2); |
| | | MenuButtonSelect(1); |
| | | }; |
| | | shareMenuButton.SelectAction = shateAction; |
| | | #endregion |
| | |
| | | alarmMenuButton.TextButton.TextID = StringId.AlarmType; |
| | | Action alarmAction = () => |
| | | { |
| | | MenuButtonSelect(3); |
| | | MenuButtonSelect(2); |
| | | }; |
| | | alarmMenuButton.SelectAction = alarmAction; |
| | | #endregion |
| | |
| | | systemMenuButton.TextButton.TextID = StringId.SystemMessage; |
| | | Action systemAction = () => |
| | | { |
| | | MenuButtonSelect(4); |
| | | MenuButtonSelect(3); |
| | | }; |
| | | systemMenuButton.SelectAction = systemAction; |
| | | #endregion |
| | | |
| | | #region 物业通知 2021-09-15增加 |
| | | propertyMenuButton = new MenuButton() |
| | | { |
| | | X = systemMenuButton.Right, |
| | | Y = Application.GetRealWidth(16), |
| | | }; |
| | | 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); |
| | | }; |
| | | propertyMenuButton.SelectAction = propertyAction; |
| | | #endregion |
| | | |
| | | //右paddingView |
| | | menuView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(15), |
| | | BackgroundColor = CSS_Color.viewTranslucence |
| | | }); |
| | | |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="selectId">1全部 2分享与功能 3报警类 4系统信息</param> |
| | | /// <param name="selectId">0全部 1分享与功能 2报警类 3系统信息 4物业通知</param> |
| | | void MenuButtonSelect(int selectId) |
| | | { |
| | | showMesType = selectId; |
| | | |
| | | if (selectId == 1) |
| | | if (selectId == 0) |
| | | { |
| | | allMenuButton.IsSelected = true; |
| | | shareMenuButton.IsSelected = false; |
| | | alarmMenuButton.IsSelected = false; |
| | | systemMenuButton.IsSelected = false; |
| | | shareMenuButton.IsSelected = true; |
| | | alarmMenuButton.IsSelected = true; |
| | | systemMenuButton.IsSelected = true; |
| | | propertyMenuButton.IsSelected = true; |
| | | |
| | | } |
| | | else if (selectId == 2) |
| | | else if (selectId == 1) |
| | | { |
| | | allMenuButton.IsSelected = false; |
| | | shareMenuButton.IsSelected = true; |
| | | alarmMenuButton.IsSelected = false; |
| | | systemMenuButton.IsSelected = false; |
| | | propertyMenuButton.IsSelected = false; |
| | | |
| | | } |
| | | else if (selectId == 3) |
| | | else if (selectId == 2) |
| | | { |
| | | allMenuButton.IsSelected = false; |
| | | shareMenuButton.IsSelected = false; |
| | | alarmMenuButton.IsSelected = true; |
| | | systemMenuButton.IsSelected = false; |
| | | propertyMenuButton.IsSelected = false; |
| | | } |
| | | else if (selectId == 3) |
| | | { |
| | | allMenuButton.IsSelected = false; |
| | | shareMenuButton.IsSelected = false; |
| | | alarmMenuButton.IsSelected = false; |
| | | systemMenuButton.IsSelected = true; |
| | | propertyMenuButton.IsSelected = false; |
| | | |
| | | } |
| | | else if (selectId == 4) |
| | | { |
| | | allMenuButton.IsSelected = false; |
| | | shareMenuButton.IsSelected = false; |
| | | alarmMenuButton.IsSelected = false; |
| | | systemMenuButton.IsSelected = true; |
| | | systemMenuButton.IsSelected = false; |
| | | propertyMenuButton.IsSelected = true; |
| | | |
| | | } |
| | | |
| | | menuView.ScrollToX(selectId * Application.GetRealWidth(40)); |
| | | |
| | | GetPushMessageList(showMesType); |
| | | } |
| | | |
| | | |
| | |
| | | /// </summary> |
| | | void AddEmptyTipView() |
| | | { |
| | | emptyTipView = new EmptyTipView() |
| | | emptyTipView = new FrameLayout() |
| | | { |
| | | Height = bodyScrolView.Height, |
| | | Width = bodyScrolView.Width, |
| | | }; |
| | | bodyScrolView.AddChidren(emptyTipView); |
| | | |
| | | var tipView = new EmptyTipView() |
| | | { |
| | | Gravity = Gravity.Center |
| | | }; |
| | | messageView.AddChidren(emptyTipView); |
| | | emptyTipView.AddChidren(tipView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 年份标记 |
| | | /// </summary> |
| | | string YearMark = ""; |
| | | /// <summary> |
| | | /// 加载报警信息RowView |
| | | /// </summary> |
| | |
| | | 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), |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = pushMessageInfo.messageContent |
| | | Text = pushMessageInfo.messageTitle |
| | | }; |
| | | rowView.AddChidren(btnSubtitle); |
| | | |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = pushMessageInfo.createTime |
| | | }; |
| | | rowView.AddChidren(btnDatetime); |
| | | |
| | | var lineView = new LineView(rowView.Height); |
| | | var lineView = new LineView(rowView.Height - Application.GetRealHeight(1)); |
| | | rowView.AddChidren(lineView); |
| | | |
| | | //删除按钮 |
| | |
| | | rowView.AddRightView(deleteBtn); |
| | | deleteBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | rowView.RemoveFromParent(); |
| | | DeleteThePush(pushMessageInfo, rowView); |
| | | }; |
| | | |
| | | //EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | //{ |
| | | //}; |
| | | |
| | | //btnTilte.MouseUpEventHandler = eventHandler; |
| | | //btnSubtitle.MouseUpEventHandler = eventHandler; |
| | | btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime); |
| | | |
| | | 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="time">毫秒时间戳</param> |
| | | /// <returns></returns> |
| | | string GetUnixToDateTime(long time) |
| | | { |
| | | try |
| | | { |
| | | return Utlis.UnixToDateTimeWithFormatMS(time, "MM/dd HH:mm"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除推送消息 |
| | | /// <param name="pushMessageInfo"></param> |
| | | /// <param name="rowView"></param> |
| | | void DeleteThePush(PushMessageInfo pushMessageInfo, RowLayout rowView) |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var delPush = new PushMsgIdObj() |
| | | { |
| | | msgId = pushMessageInfo.id, |
| | | pushType = pushMessageInfo.pushType |
| | | }; |
| | | |
| | | var result = new HttpServerRequest().PushSerivceDeleteMessage(delPush); |
| | | if (result) |
| | | { |
| | | PushMessageInfoList.Remove(pushMessageInfo); |
| | | //删除成功 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | rowView.RemoveFromParent(); |
| | | }); |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | }; |
| | | VerticalScrolViewMiddle.AddChidren(bgView); |
| | | |
| | | var yearBtn = new Button() |
| | | var yearBtn = new TextButton() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(16), |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | IsBold = true, |
| | | Text = yearStr |
| | | }; |
| | | bgView.AddChidren(yearBtn); |
| | | yearBtn.Text = yearStr + Language.StringByID(StringId.Years); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// 查询推送记录 |
| | | /// </summary> |
| | | void GetPushMessageList() |
| | | /// <param name="queryType"></param> |
| | | void GetPushMessageList(int queryType = 0) |
| | | { |
| | | var waitPage = new Loading(); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | bodyScrolView.RemoveAll(); |
| | | PushMessageInfoList.Clear(); |
| | | if (PushMessageInfoList == null) |
| | | { |
| | | PushMessageInfoList = new List<PushMessageInfo>(); |
| | | } |
| | | else |
| | | { |
| | | PushMessageInfoList.Clear(); |
| | | } |
| | | |
| | | YearMark = "";//标记清空 |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) |
| | | { |
| | | AddEmptyTipView(); |
| | | return; |
| | | } |
| | | |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var result = new HttpServerRequest().PushSerivceGetPushmessagelist(); |
| | | var result = new HttpServerRequest().PushSerivceGetPushmessagelist(queryType); |
| | | if (result.Code == StateCode.SUCCESS) |
| | | { |
| | | PushMessageInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PushMessageInfo>>(result.Data.ToString()); |
| | | //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) |
| | | { |
| | | PushMessageInfoList = mPushMesList.list; |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (PushMessageInfoList != null && PushMessageInfoList.Count > 0) |
| | | { |
| | | |
| | | ParseAndDisplayPushList(); |
| | | PushSerivceMarkAllMessageRead(); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | AddEmptyTipView(); |
| | | }); |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result.Code); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | void ParseAndDisplayPushList() |
| | | { |
| | | // |
| | | if (showMesType == 1) |
| | | foreach (var info in PushMessageInfoList) |
| | | { |
| | | //年份解析 判断是否需要添加年份标题 |
| | | var mesYear = Utlis.UnixToDateTimeYearMS(info.createTime); |
| | | if (string.IsNullOrEmpty(YearMark)) |
| | | { |
| | | //刚开始YearMark标记为空,添加第一个年份标题 |
| | | YearMark = mesYear; |
| | | AddYearRowView(bodyScrolView, YearMark); |
| | | } |
| | | else if (YearMark != mesYear) |
| | | { |
| | | //当前信息年份和之前的不一样,重新添加一个年份标题 |
| | | YearMark = mesYear; |
| | | AddYearRowView(bodyScrolView, YearMark); |
| | | } |
| | | |
| | | AddRowView(bodyScrolView, info); |
| | | } |
| | | } |
| | | |
| | | /// <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> |
| | |
| | | { |
| | | messageTitle = "报警信息", |
| | | messageContent = "门锁被打开", |
| | | createTime = "11月30 10:50", |
| | | createTime = 1606900275, |
| | | }); |
| | | |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | messageTitle = "报警信息1", |
| | | messageContent = "门锁被打开", |
| | | createTime = "11月30 11:50", |
| | | createTime = 1606895454, |
| | | }); |
| | | |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | messageTitle = "报警信息2", |
| | | messageContent = "门锁被打开", |
| | | createTime = "11月30 12:50", |
| | | createTime = 1606895454, |
| | | }); |
| | | |
| | | AddYearRowView(bodyScrolView, "2020年"); |
| | | foreach (var info in PushMessageInfoList) |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | AddRowView(bodyScrolView, info); |
| | | } |
| | | messageTitle = "报警信息2019", |
| | | messageContent = "门锁被打开", |
| | | createTime = 1575277874, |
| | | }); |
| | | |
| | | AddYearRowView(bodyScrolView, "2019年"); |
| | | foreach (var info in PushMessageInfoList) |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | AddRowView(bodyScrolView, info); |
| | | } |
| | | messageTitle = "报警信息2019", |
| | | messageContent = "门锁被打开", |
| | | createTime = 1572685874, |
| | | }); |
| | | |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | messageTitle = "报警信息2018", |
| | | messageContent = "门锁被打开", |
| | | createTime = 1541149874, |
| | | }); |
| | | |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | messageTitle = "报警信息2017", |
| | | messageContent = "门锁被打开", |
| | | createTime = 1509613874, |
| | | }); |
| | | |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | messageTitle = "报警信息2017", |
| | | messageContent = "门锁被打开", |
| | | createTime = 1509613874, |
| | | }); |
| | | |
| | | PushMessageInfoList.Add(new PushMessageInfo() |
| | | { |
| | | messageTitle = "报警信息2017", |
| | | messageContent = "门锁被打开", |
| | | createTime = 1506935474, |
| | | }); |
| | | |
| | | ParseAndDisplayPushList(); |
| | | } |
| | | |
| | | #endif |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 标记所有推送消息已读 |
| | | /// </summary> |
| | | void PushSerivceMarkAllMessageRead() |
| | | { |
| | | new Thread(() => |
| | | { |
| | | var result = new HttpServerRequest().PushSerivceMarkAllMessageRead(); |
| | | if (result) |
| | | { |
| | | Utlis.WriteLine("标记成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("标记失败"); |
| | | } |
| | | |
| | | |
| | | }) |
| | | { 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 |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 推送消息类型 |
| | | /// 推送消息类型详情 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class PushMessageInfo |
| | | { |
| | | /// <summary> |
| | | /// 记录Id |
| | | /// 记录id |
| | | /// </summary> |
| | | public string id; |
| | | /// <summary> |
| | | /// 是否已读 |
| | | /// 推送Token记录Id |
| | | /// </summary> |
| | | public bool isRead; |
| | | public string pushId; |
| | | /// <summary> |
| | | /// 云端定义 推送类型;0:默认;1:报警;2:提示;3:新闻;4:推荐; |
| | | /// |
| | | /// Default:分享与功能;Alarm:报警类;Prompt:系统消息 |
| | | /// </summary> |
| | | public string pushType; |
| | | /// <summary> |
| | | /// 消息主题 |
| | | /// </summary> |
| | | public string messageTitle; |
| | | /// <summary> |
| | | /// 消息内容 |
| | | /// </summary> |
| | |
| | | /// 扩展数据 |
| | | /// </summary> |
| | | public string messageExpand; |
| | | ///// <summary> |
| | | ///// 消息类型;0:提示;1:报警;2:丰林可是对讲呼叫;3:强制下线推送 |
| | | ///// </summary> |
| | | //public string messageType; |
| | | /// <summary> |
| | | /// 消息主题 |
| | | /// 是否已读 |
| | | /// </summary> |
| | | public string messageTitle; |
| | | /// <summary> |
| | | /// 消息类型;0:提示;1:报警;2:丰林可是对讲呼叫;3:强制下线推送 |
| | | /// </summary> |
| | | public string messageType; |
| | | /// <summary> |
| | | /// 推送Token记录Id |
| | | /// </summary> |
| | | public string pushId; |
| | | /// <summary> |
| | | /// 推送类型;0:默认;1:报警;2:提示;3:新闻;4:推荐; |
| | | /// </summary> |
| | | public string pushType; |
| | | public bool isRead; |
| | | /// <summary> |
| | | /// 推送时间 |
| | | /// </summary> |
| | | public string createTime; |
| | | public long createTime; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | // 推送消息分页对象 |
| | | /// </summary> |
| | | public class PushMessageInfoList : BasePagingObj |
| | | { |
| | | public List<PushMessageInfo> list = new List<PushMessageInfo>(); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <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; |
| | | |
| | | } |
| | | |
| | | |
| | | } |