| | |
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalFrameControl listView = null;
|
| | | private VerticalFrameRefreshControl listView = null;
|
| | | /// <summary>
|
| | | /// 全部的行
|
| | | /// </summary>
|
| | |
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uMessageCenter));
|
| | |
|
| | | listView = new VerticalFrameControl(35);
|
| | | listView.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | //初始化右上角菜单
|
| | | this.InitTopRightMenu();
|
| | |
|
| | | listView = new VerticalFrameRefreshControl(35);
|
| | | listView.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //初始化中部信息
|
| | | this.InitMiddleData(false);
|
| | | });
|
| | | };
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleData();
|
| | | this.InitMiddleData(true);
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private async void InitMiddleData()
|
| | | private async void InitMiddleData(bool showReload)
|
| | | {
|
| | | this.dicAllRow = new Dictionary<string, RowLayoutControl>();
|
| | |
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetPushMessageRecord", false, "");
|
| | | if (result == null)
|
| | | //获取数据
|
| | | var dicData = await this.GetMessageData();
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(dicData == null && showReload == true ? ShowReLoadMode.YES : ShowReLoadMode.NO);
|
| | | |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | //关闭刷新特效
|
| | | listView?.EndHeaderRefreshing();
|
| | | });
|
| | | if (dicData == null)
|
| | | {
|
| | | //数据异常
|
| | | return;
|
| | | }
|
| | | var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MessageRecordInfo>>(result);
|
| | | //合并数据
|
| | | var dicData = this.MergeMessageRecordData(dataInfo);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | |
| | | HdlThreadLogic.Current.RunMainInThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame(dicData);
|
| | |
| | | /// <param name="dicData"></param>
|
| | | private void InitMiddleFrame(Dictionary<string, List<MessageRecordInfo>> dicData)
|
| | | {
|
| | | //清空
|
| | | listView.RemoveAll();
|
| | |
|
| | | int index = 0;
|
| | | foreach (var keys in dicData.Keys)
|
| | | {
|
| | | var listData = dicData[keys];
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | index++;
|
| | | //容器
|
| | | var framBack = new FrameListControl(23);
|
| | | framBack.Name = index.ToString();
|
| | | framBack.Height = Application.GetRealHeight(100);
|
| | | framBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | listView.AddChidrenFrame(framBack);
|
| | |
|
| | | //日期
|
| | | string strMonth = Language.StringByID(R.MyInternationalizationString.Month);
|
| | | string strDate = Language.StringByID(R.MyInternationalizationString.Day);
|
| | | var frameDate = new FrameLayout();
|
| | | frameDate.Height = Application.GetRealHeight(118);
|
| | | framBack.AddChidren(frameDate);
|
| | | var btnDate = new NormalViewControl(500, 60, true);
|
| | | btnDate.TextSize = 15;
|
| | | btnDate.X = ControlCommonResourse.XXLeft;
|
| | | btnDate.Y = Application.GetRealHeight(35);
|
| | | btnDate.Text = Convert.ToDateTime(listData[0].MsgTime).ToString("MM" + strMonth + "dd" + strDate);
|
| | | frameDate.AddChidren(btnDate);
|
| | |
|
| | | for (int i = 0; i < listData.Count; i++)
|
| | | {
|
| | | index++;
|
| | | //容器
|
| | | var framBack = new FrameListControl(23);
|
| | | framBack.Name = index.ToString();
|
| | | framBack.Height = Application.GetRealHeight(100);
|
| | | framBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | listView.AddChidrenFrame(framBack);
|
| | |
|
| | | //日期
|
| | | string strMonth = Language.StringByID(R.MyInternationalizationString.Month);
|
| | | string strDate = Language.StringByID(R.MyInternationalizationString.Day);
|
| | | var frameDate = new FrameLayout();
|
| | | frameDate.Height = Application.GetRealHeight(118);
|
| | | framBack.AddChidren(frameDate);
|
| | | var btnDate = new NormalViewControl(500, 60, true);
|
| | | btnDate.TextSize = 15;
|
| | | btnDate.X = ControlCommonResourse.XXLeft;
|
| | | btnDate.Y = Application.GetRealHeight(35);
|
| | | btnDate.Text = Convert.ToDateTime(listData[0].MsgTime).ToString("MM" + strMonth + "dd" + strDate);
|
| | | frameDate.AddChidren(btnDate);
|
| | |
|
| | | for (int i = 0; i < listData.Count; i++)
|
| | | {
|
| | | //添加信息行
|
| | | this.AddMsgRowControl(framBack, listData[i], i != listData.Count - 1);
|
| | | }
|
| | | //调整高度
|
| | | listView.AdjustChidrenFrameHeight(framBack, Application.GetRealHeight(23));
|
| | | if (index == dicData.Count)
|
| | | {
|
| | | listView.AdjustTableHeight();
|
| | | }
|
| | | });
|
| | | //添加信息行
|
| | | this.AddMsgRowControl(framBack, listData[i], i != listData.Count - 1);
|
| | | }
|
| | | //调整高度
|
| | | listView.AdjustChidrenFrameHeight(framBack, Application.GetRealHeight(23));
|
| | | if (index == dicData.Count)
|
| | | {
|
| | | listView.AdjustTableHeight();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | btnIcon.UnSelectedImagePath = "Item/Safety.png";
|
| | |
|
| | | //消息类型
|
| | | var btnMsgObject = rowControl.frameTable.AddLeftCaption("测试:消息类型", 600);
|
| | | var btnMsgObject = rowControl.frameTable.AddLeftCaption("报警消息", 600);
|
| | | PicViewControl btnNewTip = null;
|
| | | if (recordInfo.IsRead == 0)
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | | }
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | bodyFrameLayout.RemoveAll();
|
| | | listView = new VerticalFrameControl(35);
|
| | | listView.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //初始化中部信息
|
| | | this.InitMiddleData();
|
| | | });
|
| | | });
|
| | | //初始化中部信息
|
| | | this.InitMiddleData(true);
|
| | | });
|
| | | });
|
| | | }
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 合并数据___________________________
|
| | | #region ■ 获取数据___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取消息记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async System.Threading.Tasks.Task<Dictionary<string, List<MessageRecordInfo>>> GetMessageData()
|
| | | {
|
| | | this.dicAllRow = new Dictionary<string, RowLayoutControl>();
|
| | |
|
| | | var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetPushMessageRecord", false, "");
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MessageRecordInfo>>(result);
|
| | | //合并数据
|
| | | return this.MergeMessageRecordData(dataInfo);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 合并数据
|
| | |
| | | }
|
| | | }
|
| | | return dicData;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 信息结果
|
| | | /// </summary>
|
| | | private class MessageRecordInfo
|
| | | {
|
| | | /// <summary>
|
| | | /// 主键
|
| | | /// </summary>
|
| | | public string RegId = string.Empty;
|
| | | /// <summary>
|
| | | /// 消息内容
|
| | | /// </summary>
|
| | | public string MsgContent = string.Empty;
|
| | | /// <summary>
|
| | | /// MsgType
|
| | | /// </summary>
|
| | | public string MsgType = string.Empty;
|
| | | /// <summary>
|
| | | /// 是否已读
|
| | | /// </summary>
|
| | | public int IsRead = 0;
|
| | | /// <summary>
|
| | | /// 时间 2019-09-10 13:11:55
|
| | | /// </summary>
|
| | | public string MsgTime = string.Empty;
|
| | | }
|
| | |
|
| | | #endregion
|