| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="isStartCheckResidenceThread">是否开启住宅监听线程,没有住宅的时候别人扫码添加你为成员的时候调用</param> |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | |
| | | }; |
| | | bodyView.AddChidren(btnHomeName); |
| | | |
| | | |
| | | |
| | | //二维码 |
| | | int codeWidth = Application.GetRealWidth(266); |
| | | ImageView codeImage = new ImageView() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | Height = codeWidth, |
| | | Width = codeWidth, |
| | | ImageBytes = Scan.BytesFromText(Entity.DB_ResidenceData.Instance.CurrentRegion.deliverUrl,codeWidth, codeWidth), |
| | | }; |
| | | backView.AddChidren(codeImage); |
| | | |
| | | ////二维码中心头像 |
| | | //int imageWidth = Application.GetMinRealAverage(60); |
| | | //int imageX = codeImage.X + (codeWidth - imageWidth) / 2; |
| | | //int imageY = codeImage.Y + (codeWidth - imageWidth) / 2; |
| | | //ImageView headImage2 = new ImageView() |
| | | //{ |
| | | // X = imageX, |
| | | // Y = imageY, |
| | | // Width = imageWidth, |
| | | // Height = imageWidth, |
| | | // ImagePath = UserInfo.Current.headImagePagePath, |
| | | // BorderColor = CSS_Color.MainBackgroundColor, |
| | | // BorderWidth = (uint)Application.GetRealWidth(2), |
| | | // Radius = (uint)Application.GetMinRealAverage(30), |
| | | //}; |
| | | //backView.AddChidren(headImage2); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开启检测住宅是否已经添加了的线程 |
| | | /// </summary> |
| | | private void StartCheckResidenceThread() |
| | | { |
| | | //获取住宅列表的参数 |
| | | var requestJson = DAL.Server.HttpUtil.GetSignRequestJson(new DAL.Server.GetHomeListObj() { homeType = HomeTypeEnum.ALL.ToString() }); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (this.Parent != null) |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | System.Threading.Thread.Sleep(4000); |
| | | if (this.Parent == null) |
| | | var pack = Common.ApiUtlis.Ins.HttpRequest.GetHouseDeliveryUrl(); |
| | | if (pack != null) |
| | | { |
| | | break; |
| | | } |
| | | //访问云端获取列表 |
| | | var resultObj = DAL.Server.HttpUtil.RequestHttpsPost(DAL.Server.NewAPI.API_POST_Gethomepager, requestJson); |
| | | if (resultObj.Code == DAL.Server.StateCode.SUCCESS) |
| | | { |
| | | var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>>(resultObj.Data.ToString()); |
| | | if (homeList == null || homeList.Count == 0) |
| | | if (pack.Code == DAL.Server.StateCode.SUCCESS) |
| | | { |
| | | //如果还没有住宅的话,继续下一次检测 |
| | | continue; |
| | | var deliveryUrl = pack.Data.ToString(); |
| | | Application.RunOnMainThread(() => { |
| | | //二维码 |
| | | int codeWidth = Application.GetRealWidth(266); |
| | | ImageView codeImage = new ImageView() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | Height = codeWidth, |
| | | Width = codeWidth, |
| | | ImageBytes = Scan.BytesFromText(deliveryUrl, codeWidth, codeWidth), |
| | | }; |
| | | backView.AddChidren(codeImage); |
| | | }); |
| | | } |
| | | //调用On原来的方法,刷新住宅列表及其缓存 |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | pm.GetHomePager(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"获取住宅交付链接异常:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | if(waitPage!= null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (this.Parent == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //跳转页面---- |
| | | MainPage.GoUserPage(true, false, () => |
| | | { |
| | | //显示欢迎回家的弹窗界面 |
| | | var form = new WellcomToHomeForm(); |
| | | form.ShowForm(); |
| | | }); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |