JLChen
2020-05-28 04bd96cbf5d12a4e4b116d2b05fd0d05ea81ee23
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
using Shared.SimpleControl.Phone;
using System;
 
namespace Shared.SimpleControl.Pad
{
    public class ForgotPassword : Dialog
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public ForgotPassword ()
        {
            ForgotPasswordShow ();
        }
 
        void ForgotPasswordShow ()
        {
            FrameLayout BodyView = new FrameLayout () { 
            };
            BodyView.MouseUpEventHandler += (sender, e) => {
                this.Close ();
                new Register ().Show ();
            };
            AddChidren (BodyView);
            #region BOTTOM
            var FrameLayoutView = new FrameLayout () {
                Width = Application.GetRealWidth(860),
                Height = Application.GetRealHeight (860),
                BackgroundColor = SkinStyle.Current.MainColor,
                Gravity = Gravity.Center
            };
            BodyView.AddChidren (FrameLayoutView);
 
            Button TopButton = new Button () {
                Height = Application.GetRealHeight (120),
                TextID = R.MyInternationalizationString.ForgotPassword,
                TextAlignment = TextAlignment.Center,
                BackgroundColor = 0xFF333333,
                TextSize = 20
            };
            FrameLayoutView.AddChidren (TopButton);
 
            EditText Register_Email_Address = new EditText () {
                Width = Application.GetRealWidth (700),
                Height = Application.GetRealHeight (100),
                X = Application.GetRealWidth (70),
                Y = Application.GetRealHeight (300),
                UnSelectedImagePath = "Register/Register_Email_Address.png",
                //SelectedImagePath = "Register/Register_Email_Address_on.png",
                PlaceholderText = Language.StringByID (R.MyInternationalizationString.EmailAddress ),
                PlaceholderTextColor = 0xFF333333,
                TextAlignment = TextAlignment.Center,
                Radius = (uint)Application.GetRealHeight (0),
            };
            Register_Email_Address.MouseUpEventHandler += (sender, e) => {
                //Register_Email_Address.IsSelected = !Register_Email_Address.IsSelected;
            };
            FrameLayoutView.AddChidren (Register_Email_Address);
 
            Button Register_Send = new Button () {
                Width = Application.GetRealWidth (700),
                Height = Application.GetRealHeight (100),
                X = Register_Email_Address.X,
                Y = Register_Email_Address.Bottom + Application.GetRealHeight (210),            
                BackgroundColor = 0xFF2f2f2f,
                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
                TextID = R.MyInternationalizationString.Send ,
                TextAlignment = TextAlignment.Center,
                TextSize = 20,
            };
            FrameLayoutView.AddChidren (Register_Send);
            Register_Send.MouseDownEventHandler += (sender, e) => {
                Register_Send.IsSelected = true;
            };
           
            Register_Send.MouseUpEventHandler += (sender, e) => {
                try {
                    Register_Send.IsSelected = false;
 
                    WebServiceLogin Forgot_password = new WebServiceLogin ();
                    var result = Forgot_password.ForgetPassword (Register_Email_Address .Text .Trim (),0); 
                        /// <summary>
                        /// 0:发送成功
                        /// 1:发送失败
                        /// </summary>
                        if (result == 1) {
                            new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.SendEmaiFailed ),
                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                        } else {
                            new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.CheckMailbox  ),
                                         Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                        }
                    
                } catch(Exception ex) {
                    new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.CheckInternet),
                               Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                    string mess = ex.Message;
                }
            };
            #endregion
 
        }
    }
}