wei
2020-11-27 70f708ee367f1ac5fa4399de035b91bebdd7078f
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
107
108
109
110
111
112
113
114
115
116
117
using System;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 我的二维码页面
    /// </summary>
    public class MyQRCodePage : FrameLayout
    {
        FrameLayout bodyView;
 
        public MyQRCodePage()
        {
            bodyView = this;
        }
 
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.MyQRcode)).LoadTopView();
 
            int backViewHeight = Application.GetRealHeight(132) + Application.GetRealWidth(266);
            FrameLayout backView = new FrameLayout()
            {
                Y = Application.GetRealHeight(144),
                X = Application.GetRealWidth(20),
                Height = backViewHeight,
                Width = Application.GetRealWidth(335),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(8),
            };
            bodyView.AddChidren(backView);
 
            #region 头像、昵称、帐号
            FrameLayout headView = new FrameLayout()
            {
                Y = Application.GetRealHeight(16),
                Height = Application.GetRealHeight(60),
            };
            backView.AddChidren(headView);
 
            ImageView headImage = new ImageView()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetMinRealAverage(60),
                Height = Application.GetMinRealAverage(60),
                Radius = (uint)Application.GetMinRealAverage(30),
                ImagePath = UserInfo.Current.headImagePagePath,
            };
            headView.AddChidren(headImage);
 
            //用户名称
            var btnUserName = new Button()
            {
                X = headImage.Right + Application.GetRealWidth(12),
                Width = Application.GetRealWidth(200),
                Height = Application.GetRealHeight(30),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.UsersWhoNameIsEmpty,
                IsBold = true
            };
            headView.AddChidren(btnUserName);
 
            if (!string.IsNullOrEmpty(UserInfo.Current.userName))
            {
                btnUserName.Text = UserInfo.Current.userName;
            }
 
            //用户帐号
            var btnEmail = new Button()
            {
                X = headImage.Right + Application.GetRealWidth(12),
                Y = btnUserName.Bottom,
                Height = Application.GetRealHeight(30),
                TextAlignment = TextAlignment.TopLeft,
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = UserInfo.Current.AccountString
            };
            headView.AddChidren(btnEmail);
            #endregion
 
            //二维码
            int codeWidth = Application.GetRealWidth(266);
            ImageView codeImage = new ImageView()
            {
                X = Application.GetRealWidth(35),
                Y = Application.GetRealHeight(104),
                Height = codeWidth,
                Width = codeWidth,
                ImageBytes = Scan.BytesFromText(UserInfo.Current.AccountString, 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);
        }
    }
}