wxr
2020-06-08 b71dfb3ca100340005d56e1298292807da82322d
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
using System;
using HDL_ON.Entity;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class PersonalCenterPage
    {
 
 
        /// <summary>
        /// 加载事件列表
        /// </summary>
        void LoadEventList()
        {
            LoadEvent_SwitchHome();
            LoadEvent_GoPersonalDataPage();
            if (MainPage.LoginUser.accountType == 0)
            {
                LoadEvent_SkipResdentialManagePage();
            }
 
            LoadEvent_GoMemberManagement();
        }
 
        #region 切换住宅
        /// <summary>
        /// 住宅列表点击事件
        /// </summary>
        void LoadEvent_SwitchHome()
        {
#if DEBUG
            btnUserTypeName.MouseUpEventHandler = (sender, e) =>
            {
                var pm = new HDL_ON.DAL.Server.HttpServerRequest();
                var iddd = pm.GetRegionLastBackupId();
                Dialog dialog = new Dialog();
 
                FrameLayout bodyView = new FrameLayout();
                dialog.AddChidren(bodyView);
                bodyView.MouseUpEventHandler = (sender3, e3) => {
                    dialog.Close();
                };
                
                FrameLayout frame = new FrameLayout()
                {
                    Gravity = Gravity.Center,
                    Width = Application.GetRealWidth(280),
                    Height =Application.GetRealHeight(300),
                    BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealWidth(16),
                };
                dialog.AddChidren(frame);
 
                Button btnTitleDialog = new Button()
                {
                    Height = Application.GetRealHeight(60),
                    TextAlignment = TextAlignment.Center,
                    Text = "数据恢复",
                    TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                    TextColor = CSS.CSS_Color.SecondLevelTitleColor,
                    BackgroundColor = CSS.CSS_Color.PromptingColor2,
                };
                frame.AddChidren(btnTitleDialog);
 
                VerticalScrolViewLayout view = new VerticalScrolViewLayout()
                {
                    Y = Application.GetRealHeight(60),
                    Height = Application.GetRealHeight(240),
                };
                frame.AddChidren(view);
 
                foreach(var dd in iddd)
                {
                    Button btn = new Button()
                    {
                        Height = Application.GetRealHeight(50),
                        TextAlignment = TextAlignment.Center,
                        TextSize = CSS.CSS_FontSize.TextFontSize,
                        TextColor = CSS.CSS_Color.TextualColor,
                        Text = dd.Value,
                    };
                    view.AddChidren(btn);
 
                    btn.MouseUpEventHandler = (sender1, e1) =>
                    {
                        dialog.Close();
                        pm.GetBackupFileList(dd.Key);
                    };
 
                    view.AddChidren(new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS.CSS_Color.BackgroundColor
                    });
                }
 
                dialog.Show();
 
            };
#endif
 
 
            btnCurResidenceName.MouseUpEventHandler += (sender, e) => {
                var dialog = new Dialog();
                var dialogBody = new FrameLayout();
                dialog.AddChidren(dialogBody);
                dialogBody.MouseUpEventHandler += (sender1, e1) => {
                    dialog.Close();
                };
 
                var dispalyView = new FrameLayout()
                {
                    X = Application.GetRealWidth(22),
                    Y = Application.GetRealHeight(268),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(198),
                    BackgroundImagePath = "PersonalCenter/HomeListbg.png",
                };
                dialogBody.AddChidren(dispalyView);
 
                var contentView = new VerticalScrolViewLayout() {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(15),
                    Width = Application.GetRealWidth(150),
                    Height = Application.GetRealHeight(45*4),
                };
                dispalyView.AddChidren(contentView);
 
                foreach(var home in MainPage.LoginUser.regionList)
                {
                    var btnHomeName = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(44),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                        SelectedTextColor = CSS.CSS_Color.MainColor,
                        Text = home.Name,
                        TextSize = home.Name.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize,
                        IsSelected = DB_ResidenceData.residenceData.residecenInfo.RegionID == home.RegionID,
                        IsMoreLines = true,
                        Tag = MainPage.LoginUser.regionList.IndexOf(home)
                    };
                    contentView.AddChidren(btnHomeName);
                    //if(btnHomeName)
 
                    if (MainPage.LoginUser.regionList.IndexOf(home) < MainPage.LoginUser.regionList.Count - 1)
                    {
                        contentView.AddChidren(new Button()
                        {
                            Gravity = Gravity.CenterHorizontal,
                            Width = Application.GetRealWidth(112),
                            Height = Application.GetRealHeight(1),
                            BackgroundColor = CSS.CSS_Color.BackgroundColor
                        });
                    }
 
                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
                    {
                        var regionIndex = (int)btnHomeName.Tag;
                        dialog.Close();
 
                        DB_ResidenceData.residenceData.CurReginIndex = regionIndex;
                        btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name;
                        OnAppConfig.Instance.SaveUserConfig();
                    };
                }
 
                dialog.Show();
            };
        }
 
        #endregion
 
        #region 住宅管理
        void LoadEvent_SkipResdentialManagePage()
        {
            if (MainPage.LoginUser.accountType == 0)
            {
                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                {
                    Action updateResidenceName = () => {
                        btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name;
                    };
                    var residentialManagePage = new ResidentialManagePage(updateResidenceName);
                    MainPage.BasePageView.AddChidren(residentialManagePage);
                    residentialManagePage.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                btnResidenceManageIcon.MouseUpEventHandler = eventHandler;
                btnResidenceManageText.MouseUpEventHandler = eventHandler;
            }
        }
        #endregion
 
        #region 个人中心
        void LoadEvent_GoPersonalDataPage()
        {
            userHeadImageView.MouseUpEventHandler += (sender, e) => {
                Action updataHeadImage = () => {
                    userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath;
                };
                Action updataUserName = () => {
                    btnUserName.Text = MainPage.LoginUser.userName;
                };
 
                var personalDataView = new PersonalDataPage(updataHeadImage,updataUserName);
                MainPage.BasePageView.AddChidren(personalDataView);
                personalDataView.LoadView();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        #endregion
 
        #region 成员管理
        void LoadEvent_GoMemberManagement()
        {
 
            EventHandler<MouseEventArgs> eHandler = (sender, e) => {
            //};
            //residenceMemberView.MouseUpEventHandler = (sender, e) => {
                //Action updataHeadImage = () => {
                //    userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath;
                //};
                //Action updataUserName = () => {
                //    btnUserName.Text = MainPage.LoginUser.userName;
                //};
 
                var mmp = new MemberManagementPage();
                MainPage.BasePageView.AddChidren(mmp);
                mmp.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            btnResidenceMemberIcon.MouseUpEventHandler = eHandler;
            btnResidenceMemberText.MouseUpEventHandler = eHandler;
        }
 
        #endregion
    }
}