| | |
| | | this.SelectedImagePath = "Item/MessageManagementSelected.png";
|
| | | this.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //点击后,清空状态
|
| | | this.IsSelected = false;
|
| | | ControlCommonResourse.HadNewMessage = false;
|
| | |
|
| | | var form = new UserMain.MessageManagementForm();
|
| | | form.AddForm();
|
| | | };
|
| | | //添加缓存
|
| | | ControlCommonResourse.listMessageManaContr.Add(this);
|
| | | //刷新状态
|
| | | this.RefreshStatu();
|
| | | }
|
| | |
| | | /// </summary>
|
| | | public void RefreshStatu()
|
| | | {
|
| | | //暂时测试
|
| | | this.IsSelected = true;
|
| | | if (ControlCommonResourse.HadNewMessage == true)
|
| | | {
|
| | | //如果已经有新消息过来了,就不用读了
|
| | | ControlCommonResourse.ReadMessageAgain = false;
|
| | | this.IsSelected = true;
|
| | | return;
|
| | | }
|
| | | if (ControlCommonResourse.ReadMessageAgain == false)
|
| | | {
|
| | | //无需再次读取
|
| | | return;
|
| | | }
|
| | | ControlCommonResourse.ReadMessageAgain = false;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | string nowHomeId = Common.Config.Instance.Home.Id;
|
| | | var result = await UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetPushMessageRecord", false, "", new List<string>() { "NotSetAgain" });
|
| | | if (result == null)
|
| | | {
|
| | | //出错,需要重新读取
|
| | | ControlCommonResourse.ReadMessageAgain = true;
|
| | | return;
|
| | | }
|
| | | if (nowHomeId != Common.Config.Instance.Home.Id)
|
| | | {
|
| | | //检测:切换了住宅??
|
| | | return;
|
| | | }
|
| | | var strdata = System.Text.Encoding.UTF8.GetString(result);
|
| | | var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(strdata);
|
| | | var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MessageRecordInfo>>(revertObj.ResponseData.ToString());
|
| | | |
| | | for (int i = 0; i < dataInfo.Count; i++)
|
| | | {
|
| | | if (dataInfo[i].IsRead == 0)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //有新消息
|
| | | this.IsSelected = true;
|
| | | });
|
| | | break;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 控件移除
|
| | | /// </summary>
|
| | | public override void RemoveFromParent()
|
| | | {
|
| | | ControlCommonResourse.listMessageManaContr.Remove(this);
|
| | |
|
| | | base.RemoveFromParent();
|
| | | }
|
| | | }
|
| | | }
|