黄学彪
2020-12-17 6c0c799c1f5da2d215ec8d9df9b92b3d1948dc14
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
using System;
using HDL_ON.DAL.Server;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class AddMemberScanPage
    {
 
        void LoadEventList()
        {
            LoadEvent_BindMember();
            Action<string> action = (str) => {
                Application.RunOnMainThread(() => {
                    etMemberAccount.Text = str;
                });
            };
            OpenScen(action);
        }
 
        void LoadEvent_BindMember()
        {
            btnAddMember.MouseUpEventHandler = (sender, e) => {
                var memberAccount = etMemberAccount.Text.Trim();
                if(string.IsNullOrEmpty(memberAccount))
                {
                    TipDivMsg(Language.StringByID(StringId.PlsEntryAccount));
                    return;
                }
                BindMember(memberAccount);
            };
        }
 
        /// <summary>
        /// 绑定账号
        /// </summary>
        /// <param name="memberAccount"></param>
        void BindMember(string memberAccount)
        {
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
 
            new System.Threading.Thread(() =>
            {
                try
                {
                    var result = new HttpServerRequest().BindResidenceMemberAccount(memberAccount, memberAccount);
                    if (result.Code == StateCode.SUCCESS)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            backAction?.Invoke();
                            this.RemoveFromParent();
                            var page = new OperationResultDisPalyPage();
                            page.Show();
                            page.LoadPage(true, Language.StringByID(StringId.AddMember), Language.StringByID(StringId.WelcomeNewMmember), "");
                        });
                    }
                    else
                    {
                        IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
                    }
 
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
 
 
 
        void OpenScen(Action<string> action)
        {
            btnScan.MouseUpEventHandler = (sender, e) =>
            {
                Scan.OpenScan((scanString) =>
                {
                    action(scanString);
                });
            };
        }
 
 
    }
}