wxr
2023-04-21 62d6c4bf6c30da21ccd8245199234c5004117d56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.Collections.Generic;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 我的二维码页面
    /// </summary>
    public class DeliveryQrCodePage : FrameLayout
    {
        FrameLayout bodyView;
 
        public DeliveryQrCodePage()
        {
            bodyView = this;
        }
 
        /// <summary>
        /// 
        /// </summary>
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.ResidentialDelivery)).LoadTopView();
 
            int backViewHeight = Application.GetRealHeight(132) + Application.GetRealWidth(266);
            FrameLayout backView = new FrameLayout()
            {
                Y = Application.GetRealHeight(144),
                Gravity = Gravity.CenterHorizontal,
                Height = Application.GetRealWidth(288),
                Width = Application.GetRealWidth(288),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(8),
            };
            bodyView.AddChidren(backView);
 
          
 
            var btnHomeName = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = backView.Bottom + Application.GetRealWidth(12),
                Width = Application.GetRealWidth(300),
                Height = Application.GetRealHeight(60),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = Entity.DB_ResidenceData.Instance.CurrentRegion.homeName,
                IsBold = true,
                IsMoreLines = true,
 
            };
            bodyView.AddChidren(btnHomeName);
 
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start("");
            new System.Threading.Thread(() => {
                try
                {
                    var pack = Common.ApiUtlis.Ins.HttpRequest.GetHouseDeliveryUrl();
                    if (pack != null)
                    {
                        if (pack.Code == DAL.Server.StateCode.SUCCESS)
                        {
                            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);
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log($"获取住宅交付链接异常:{ex.Message}");
                }
                finally
                {
                    if(waitPage!= null)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            waitPage.RemoveFromParent();
                        });
                    }
                }
            })
            { IsBackground = true }.Start();
 
      
        }
        
    }
}