wxr
2020-04-14 06696e6f225733a60b03eea4a7c6374053d92c1d
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
using System;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class PersonalDataPage
    {
        /// <summary>
        /// 加载事件列表
        /// </summary>
        void LoadEventList()
        {
            LoadEvent_ChangeHeadImageView();
            LoadEvent_Logout();
        }
 
        /// <summary>
        /// 加载选择头像选项view
        /// </summary>
        void LoadEvent_ChangeHeadImageView()
        {
            userHeadImageView.MouseUpEventHandler = (sender, e) => {
                LoadPictureOptionView();
            };
        }
 
        /// <summary>
        /// 退出账号登录事件
        /// </summary>
        void LoadEvent_Logout()
        {
            btnLogout.MouseUpEventHandler += (sender, e) => {
                MainPage.LoginUser.lastTime = DateTime.MinValue;
                MainPage.LoginUser.SaveUserInfo();
                MainPage.GoLoginPage(MainPage.LoginUser.accountString);
            };
        }
 
 
        /// <summary>
        /// 加载背景图选择区域事件列表
        /// </summary>
        void LoadEvent_PictureOptionViewEventList()
        {
            pictureOptionView.MouseUpEventHandler = (sender, e) =>
            {
                pictureOptionView.RemoveFromParent();
            };
 
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                pictureOptionView.RemoveFromParent();
            };
 
            btnTakePicture.MouseUpEventHandler = (sender, e) =>
            {
                var pid = Guid.NewGuid();
                CropImage.TakePicture((Action<string>)((imagePath) =>
                {
                    if (imagePath != null)
                    {
                        MainPage.LoginUser.headImagePagePath = imagePath.ToString();
                        userHeadImageView.ImagePath = imagePath.ToString();
                        updataHeadImage();
                        new System.Threading.Thread(() =>
                        {
                            new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath);
                        })
                        { IsBackground = true }.Start();
                        MainPage.LoginUser.SaveUserInfo();
                        MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath);
                    }
                }), pid.ToString(), 1, 1);
                pictureOptionView.RemoveFromParent();
            };
 
            btnAlbum.MouseUpEventHandler = (sender, e) =>
            {
                var pid = Guid.NewGuid();
                CropImage.SelectPicture((imagePath) =>
                {
                    if (imagePath != null)
                    {
                        MainPage.LoginUser.headImagePagePath = imagePath.ToString();
                        userHeadImageView.ImagePath = imagePath.ToString();
                        updataHeadImage();
 
                        new System.Threading.Thread(() =>
                        {
                            new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath);
                        })
                        { IsBackground = true }.Start(); MainPage.LoginUser.SaveUserInfo();
                        MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath);
                    }
                }, pid.ToString(), 1, 1);
                pictureOptionView.RemoveFromParent();
            };
        }
 
 
    }
}