using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Text;
|
using service.hdlcontrol.com_push;
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public class AccountView :FrameLayout
|
{
|
public AccountView ()
|
{
|
}
|
|
|
public void ShouwAccountView ()
|
{
|
|
#region 标题
|
var topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
AddChidren (topView);
|
|
Button NameButton = new Button () {
|
Width = Application.GetRealWidth (400),
|
TextID = R.MyInternationalizationString.Account,
|
TextColor = SkinStyle.Current.TextColor1,
|
Gravity = Gravity.CenterHorizontal,
|
TextAlignment = TextAlignment.Center,
|
TextSize = 20,
|
};
|
topView.AddChidren (NameButton);
|
|
var logo = new Button () {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
topView.AddChidren (logo);
|
var back = new Button () {
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
};
|
topView.AddChidren (back);
|
back.MouseUpEventHandler += (sender, e) => {
|
(Parent as PageLayout).PageIndex -= 1;
|
};
|
#endregion
|
|
FrameLayout topUserMsgView = new FrameLayout () {
|
Y = Application.GetRealHeight (126),
|
Height = Application.GetRealHeight (175),
|
BackgroundColor = SkinStyle.Current.ViewColor
|
};
|
AddChidren (topUserMsgView);
|
|
Button btnUserIcon = new Button () {
|
X = Application.GetRealWidth (27),
|
Width = Application.GetRealWidth (96),
|
Height = Application.GetRealHeight (96),
|
Gravity = Gravity.CenterVertical,
|
Radius = 5,
|
BorderColor = SkinStyle.Current.Transparent,
|
BorderWidth = 0,
|
UnSelectedImagePath = "AccountSettings/UserIcon.png",
|
};
|
topUserMsgView.AddChidren (btnUserIcon);
|
|
btnUserIcon.MouseLongEventHandler += (sender, e) => {
|
Alert alert = new Alert ("", Language.StringByID (R.MyInternationalizationString.TipDeleteAllFiles), Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim));
|
alert.ResultEventHandler += ( sender2, e2) => {
|
if (e2) {
|
|
MainPage.LoginUser.LastTime = DateTime.MinValue;
|
MainPage.LoginUser.SaveUserInfo ();
|
Room.Lists.Clear ();
|
new AccountLogin (MainPage.LoginUser.AccountString, "").Show ();
|
|
System.Threading.Tasks.Task.Run (() => {
|
WebServicePush webPush = new WebServicePush ();
|
webPush.DeleteToken_Push (UserConfig.Instance.tokenID);
|
if (string.IsNullOrEmpty (UserConfig.Instance.RemoteModeFile))
|
return;
|
});
|
CommonPage.IsRemote = false;
|
}
|
};
|
alert.Show ();
|
};
|
|
Button btnUserName = new Button () {
|
X = btnUserIcon.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (40),
|
Width = Application.GetRealWidth (400),
|
Height = Application.GetRealHeight (50),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = MainPage.LoginUser.Name == "" ? Language.StringByID (R.MyInternationalizationString.Account) : MainPage.LoginUser.Name,
|
};
|
topUserMsgView.AddChidren (btnUserName);
|
|
Button btnUserAccount = new Button () {
|
X = btnUserName.X,
|
Y = btnUserName.Bottom,
|
Width = btnUserName.Width,
|
Height = btnUserName.Height,
|
TextAlignment = TextAlignment.CenterLeft,
|
Text = "",
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
topUserMsgView.AddChidren (btnUserAccount);
|
if (MainPage.LoginUser != null) {
|
btnUserAccount.Text += MainPage.LoginUser.AccountString;
|
}
|
|
Button btTopNull = new Button () {
|
Y = topUserMsgView.Bottom,
|
BackgroundColor = SkinStyle.Current.MainColor,
|
Height = Application.GetRealHeight (50),
|
};
|
AddChidren (btTopNull);
|
|
var contentView = new VerticalScrolViewLayout () {
|
Y = btTopNull.Bottom,
|
Height = Application.GetRealHeight (1136 - 90) - btTopNull.Bottom,
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
//ScrollEnabled = false,
|
};
|
AddChidren (contentView);
|
|
#region PasswordView
|
var ModifyPasswordView = new FrameLayout () {
|
Height = Application.GetRealHeight (100),
|
};
|
contentView.AddChidren (ModifyPasswordView);
|
|
Button btnModifyPasswordTitle = new Button () {
|
X = Application.GetRealWidth (40),
|
TextID = R.MyInternationalizationString.ModifyPasswrod,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
ModifyPasswordView.AddChidren (btnModifyPasswordTitle);
|
|
Button btnModifyPasswordRight = new Button () {
|
X = Application.GetRealWidth (580),
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
ModifyPasswordView.AddChidren (btnModifyPasswordRight);
|
|
EventHandler<MouseEventArgs> modifyPasswordHandler = (sender, e) => {
|
AccountModifyPassword am = new AccountModifyPassword ();
|
UserMiddle.SettingPageView.AddChidren (am);
|
am.ShowAccountModifyPassword ();
|
UserMiddle.SettingPageView.PageIndex = UserMiddle.SettingPageView.ChildrenCount - 1;
|
};
|
ModifyPasswordView.MouseUpEventHandler += modifyPasswordHandler;
|
btnModifyPasswordTitle.MouseUpEventHandler += modifyPasswordHandler;
|
btnModifyPasswordRight.MouseUpEventHandler += modifyPasswordHandler;
|
|
Button btnModifyNullLine = new Button () {
|
Height = Application.GetRealHeight (5),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
contentView.AddChidren (btnModifyNullLine);
|
#endregion
|
|
#region 平台迁移
|
|
var moveToNewCloudView = new FrameLayout () {
|
Height = Application.GetRealHeight (100),
|
};
|
contentView.AddChidren (moveToNewCloudView);
|
|
Button btnTitle = new Button () {
|
X = Application.GetRealWidth (40),
|
Text = "Platform migration",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
moveToNewCloudView.AddChidren (btnTitle);
|
|
Button btnRight = new Button () {
|
X = Application.GetRealWidth (580),
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
moveToNewCloudView.AddChidren (btnRight);
|
|
EventHandler<MouseEventArgs> eHandler = (sender, e) => {
|
var bean = new MigrationServer ();
|
bean.ShowDialog ();
|
};
|
|
moveToNewCloudView.MouseUpEventHandler += eHandler;
|
btnTitle.MouseUpEventHandler += eHandler;
|
btnRight.MouseUpEventHandler += eHandler;
|
|
Button btnLine = new Button () {
|
Height = Application.GetRealHeight (5),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
contentView.AddChidren (btnLine);
|
#endregion
|
|
|
|
#region 手动升级
|
|
var manualUpgradeView = new FrameLayout () {
|
Height = Application.GetRealHeight (100),
|
};
|
contentView.AddChidren (manualUpgradeView);
|
|
Button btnmanualUpgradeTitle = new Button () {
|
X = Application.GetRealWidth (40),
|
Text = "Manual upgrade",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
manualUpgradeView.AddChidren (btnmanualUpgradeTitle);
|
|
Button btnmanualUpgradeRight = new Button () {
|
X = Application.GetRealWidth (580),
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
manualUpgradeView.AddChidren (btnmanualUpgradeRight);
|
|
EventHandler<MouseEventArgs> manualUpgradeHandler = (sender, e) => {
|
var bean = new ManualUpgradeDialog ();
|
bean.ShowDialog ();
|
};
|
|
manualUpgradeView.MouseUpEventHandler += manualUpgradeHandler;
|
btnmanualUpgradeTitle.MouseUpEventHandler += manualUpgradeHandler;
|
btnmanualUpgradeRight.MouseUpEventHandler += manualUpgradeHandler;
|
|
Button btnLine2 = new Button () {
|
Height = Application.GetRealHeight (5),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
contentView.AddChidren (btnLine2);
|
#endregion
|
|
|
|
|
|
|
|
Button btnLogout = new Button () {
|
Y = contentView.Bottom,
|
Height = Application.GetRealHeight (93),
|
TextColor = SkinStyle.Current.TextColor1,
|
BackgroundColor = SkinStyle.Current.MainColor,
|
TextID = R.MyInternationalizationString.LogoutAccount,
|
TextAlignment = TextAlignment.Center
|
};
|
AddChidren (btnLogout);
|
|
btnLogout.MouseUpEventHandler += (sender1, e1) => {
|
btnLogout.IsSelected = false;
|
if (MainPage.LoginUser == null) {
|
new AccountLogin ().Show ();
|
} else {
|
var alertDialog = new Dialog ();
|
|
var alertBodyView = new FrameLayout ();
|
alertDialog.AddChidren (alertBodyView);
|
alertBodyView.MouseUpEventHandler += (d, f) => {
|
alertDialog.Close ();
|
};
|
|
var tipView = new FrameLayout () {
|
Gravity = Gravity.Center,
|
Width = Application.GetRealWidth(500),
|
Height = Application.GetRealHeight(250),
|
BackgroundColor = 0xFF333333,
|
Radius = 5,
|
BorderColor = SkinStyle.Current.Transparent,
|
BorderWidth = 1,
|
};
|
alertBodyView.AddChidren (tipView);
|
|
var btnTipMsg = new TextView () {
|
X = Application.GetRealWidth (20),
|
Height = Application.GetRealHeight (130),
|
Width = Application.GetRealWidth (460),
|
IsMoreLines = true,
|
TextColor = SkinStyle.Current.TextColor2,
|
TextID = R.MyInternationalizationString.CloseYourAccount,
|
TextSize = 16
|
};
|
tipView.AddChidren (btnTipMsg);
|
|
var bottomView = new FrameLayout () {
|
Y = btnTipMsg.Bottom,
|
Height = Application.GetRealHeight (120),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
tipView.AddChidren (bottomView);
|
|
var btnYes = new Button () {
|
X= Application.GetRealWidth(40),
|
Y = Application.GetRealHeight(20),
|
Height =Application.GetRealHeight(70),
|
Width = Application.GetRealWidth(200),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextID = R.MyInternationalizationString.Yes,
|
TextAlignment = TextAlignment.Center,
|
Radius = 5,
|
BorderColor = SkinStyle.Current.Transparent,
|
BorderWidth = 1,
|
};
|
bottomView.AddChidren (btnYes);
|
|
|
var btnNo = new Button () {
|
X = btnYes.Right + Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (20),
|
Height = Application.GetRealHeight (70),
|
Width = Application.GetRealWidth (200),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextID = R.MyInternationalizationString.No,
|
TextAlignment = TextAlignment.Center,
|
Radius = 5,
|
BorderColor = SkinStyle.Current.Transparent,
|
BorderWidth = 1,
|
};
|
bottomView.AddChidren (btnNo);
|
|
btnYes.MouseUpEventHandler += (sdd, ff) => {
|
alertDialog.Close ();
|
IO.FileUtils.DeleteAllFile ();
|
foreach (var tempHome in UserConfig.Instance.HomeLists) {
|
IO.FileUtils.DeleteRegionFiles (IO.FileUtils.CreateRegionBackup (tempHome.RegionName));
|
}
|
MainPage.LoginUser.LastTime = DateTime.MinValue;
|
MainPage.LoginUser.SaveUserInfo ();
|
Room.Lists.Clear ();
|
new AccountLogin (MainPage.LoginUser.AccountString, "").Show ();
|
this.RemoveFromParent ();
|
SharedMethod.SharedMethod.CurPageLayout = null;
|
System.Threading.Tasks.Task.Run (() => {
|
var webPush = new WebServicePush ();
|
webPush.DeleteToken_Push (UserConfig.Instance.tokenID);
|
});
|
CommonPage.IsRemote = false;
|
};
|
|
btnNo.MouseUpEventHandler += (sdd, ff) => {
|
alertDialog.Close ();
|
MainPage.LoginUser.LastTime = DateTime.MinValue;
|
MainPage.LoginUser.SaveUserInfo ();
|
Room.Lists.Clear ();
|
new AccountLogin (MainPage.LoginUser.AccountString, "").Show ();
|
this.RemoveFromParent ();
|
System.Threading.Tasks.Task.Run (() => {
|
var webPush = new WebServicePush ();
|
webPush.DeleteToken_Push (UserConfig.Instance.tokenID);
|
});
|
CommonPage.IsRemote = false;
|
};
|
|
alertDialog.Show ();
|
//Alert alert = new Alert ("", Language.StringByID (R.MyInternationalizationString.CloseYourAccount), Language.StringByID (R.MyInternationalizationString.No), Language.StringByID (R.MyInternationalizationString.Yes));
|
//alert.Show ();
|
|
//alert.ResultEventHandler += (sender2, e2) => {
|
// if (e2) {
|
// IO.FileUtils.DeleteAllFile ();
|
// foreach (var tempHome in UserConfig.Instance.HomeLists) {
|
// IO.FileUtils.DeleteRegionFiles (IO.FileUtils.CreateRegionBackup (tempHome.RegionName));
|
// }
|
// }
|
// MainPage.LoginUser.LastTime = DateTime.MinValue;
|
// MainPage.LoginUser.SaveUserInfo ();
|
// Room.Lists.Clear ();
|
// new AccountLogin (MainPage.LoginUser.AccountString, "").Show ();
|
// this.RemoveFromParent ();
|
// System.Threading.Tasks.Task.Run (() => {
|
// var webPush = new WebServicePush ();
|
// webPush.DeleteToken_Push (UserConfig.Instance.tokenID);
|
// });
|
// CommonPage.IsRemote = false;
|
//};
|
|
|
}
|
};
|
|
}
|
|
void SubaccountListView ()
|
{
|
FrameLayout subAccView = new FrameLayout ();
|
UserMiddle.SettingPageView.AddChidren (subAccView);
|
UserMiddle.SettingPageView.PageIndex = UserMiddle.SettingPageView.ChildrenCount - 1;
|
}
|
|
}
|
}
|