using System;
using Shared;
namespace HDL_ON.UI
{
public partial class PersonalDataPage
{
///
/// 加载事件列表
///
void LoadEventList()
{
LoadEvent_ChangeHeadImageView();
LoadEvent_Logout();
}
///
/// 加载选择头像选项view
///
void LoadEvent_ChangeHeadImageView()
{
userHeadImageView.MouseUpEventHandler = (sender, e) => {
LoadPictureOptionView();
};
}
///
/// 退出账号登录事件
///
void LoadEvent_Logout()
{
btnLogout.MouseUpEventHandler += (sender, e) => {
MainPage.LoginUser.lastTime = DateTime.MinValue;
MainPage.LoginUser.SaveUserInfo();
MainPage.GoLoginPage(MainPage.LoginUser.accountString);
};
}
///
/// 加载背景图选择区域事件列表
///
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)((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();
};
}
}
}