wxr
2022-01-12 1b40f1180fa2f7b9e4f6ded651cf66699c7e5db7
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using System;
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.Stan;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 过户输入账号界面
    /// </summary>
    public class TransferInputPage : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //过户
            base.SetTitleText(Language.StringByID(StringId.Transfer));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            //白色背景
            var frameBack = new FrameLayout();
            frameBack.Y = Application.GetRealHeight(8);
            frameBack.BackgroundColor = CSS_Color.MainBackgroundColor;
            bodyFrameLayout.AddChidren(frameBack);
 
            //请输入接收方账号
            var rowInput = new FrameRowControl();
            rowInput.Height = Application.GetRealHeight(50);
            frameBack.AddChidren(rowInput);
            //图标
            rowInput.AddLeftIcon(24, "LoginIcon/AccountIcon.png");
            //输入框
            var txtInput = rowInput.AddLeftInput(string.Empty, 300);
            txtInput.PlaceholderText = Language.StringByID(StringId.PleaseInputReceiverAccount);
            //底线
            rowInput.AddBottomLine();
            //变更容器高度
            frameBack.Height = rowInput.Bottom + Application.GetRealHeight(10);
 
            //过户
            var btnMigrate = new BottomClickButton(220);
            btnMigrate.TextID = StringId.Transfer;
            btnMigrate.Y = frameBack.Bottom + Application.GetRealHeight(79);
            bodyFrameLayout.AddChidren(btnMigrate);
            btnMigrate.ButtonClickEvent += (sender, e) =>
            {
                string account = txtInput.Text.Trim();
                if (account == string.Empty)
                {
                    return;
                }
                if (account == UserInfo.Current.userEmailInfo || account == UserInfo.Current.userMobileInfo)
                {
                    //不能自己过户给自己
                    HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.YouCannotTransferOwnershipToYourself));
                    return;
                }
                //搜索账号信息
                var accountInfo = this.SearchAccountInfoByAccount(account);
                if (accountInfo == null)
                {
                    return;
                }
 
                this.CloseForm();
 
                var form = new TransferUserConfirmPage();
                form.AddForm(accountInfo);
            };
 
            //扫描二维码
            var btnQrcode = new NormalViewControl(220, 32, true);
            btnQrcode.Y = btnMigrate.Bottom + Application.GetRealWidth(6);
            btnQrcode.TextColor = CSS_Color.MainColor;
            btnQrcode.Gravity = Gravity.CenterHorizontal;
            btnQrcode.TextAlignment = TextAlignment.Center;
            btnQrcode.TextID = StringId.ScanQRCoden;
            bodyFrameLayout.AddChidren(btnQrcode);
            btnQrcode.ButtonClickEvent += (sender, e) =>
            {
                Scan.Ins.OpenScan((scanString) =>
                {
                    if (string.IsNullOrEmpty(scanString) == true)
                    {
                        return;
                    }
                    if (scanString == UserInfo.Current.userEmailInfo || scanString == UserInfo.Current.userMobileInfo)
                    {
                        //不能自己过户给自己
                        HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.YouCannotTransferOwnershipToYourself));
                        return;
                    }
                    //搜索账号信息
                    var accountInfo = this.SearchAccountInfoByAccount(scanString);
                    if (accountInfo == null)
                    {
                        return;
                    }
                    this.CloseForm();
 
                    var form = new TransferUserConfirmPage();
                    form.AddForm(accountInfo);
                });
            };
        }
 
        #endregion
 
        #region ■ 搜索账号___________________________
 
        /// <summary>
        /// 搜索账号信息
        /// </summary>
        /// <param name="i_account">搜索的账号</param>
        /// <returns></returns>
        private AccountInfoResult SearchAccountInfoByAccount(string i_account)
        {
            var result = new DAL.Server.HttpServerRequest().GetMemberInfoByAccount(i_account);
            if (result.Code == DAL.Server.StateCode.ACCOUNT_NOT_EXIST)
            {
                //目标账号并不存在
                HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.TargetAcountDoesNotExist));
                return null;
            }
            if (result.Code != DAL.Server.StateCode.SUCCESS)
            {
                DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
                return null;
            }
            var accountInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(result.Data.ToString());
            accountInfo.Account = i_account;
            if (accountInfo.MemberName == string.Empty)
            {
                accountInfo.MemberName = accountInfo.Account;
            }
            return accountInfo;
        }
 
        #endregion
    }
}