public SettingsPage() { this.InitializeComponent(); if (localSettings.Values["Token"] != null) { new Thread(a => { account = Modules.Account.GetAccountInfo((string)localSettings.Values["Token"]); Invoke(new Action(delegate { UserName.Text = account.RoleName; UserRealName.Text = account.UserName; UserId.Text = "Uid: " + account.Id; LogOut.Visibility = Visibility.Visible; var image = new BitmapImage(); image.UriSource = new Uri(account.Avatar); UserAvatar.ProfilePicture = image; })); }) { IsBackground = true }.Start(); } BuildVersion.Text = string.Format(Lang.ReadLangText("BuildVersion"), Tools.Version.VersionNum, Tools.Version.Build); }
private void Page_Loaded(object sender, RoutedEventArgs e) { if (localSettings.Values["Token"] != null) { new Thread(a => { try { account = Modules.Account.GetAccountInfo((string)localSettings.Values["Token"]); Invoke(new Action(delegate { // 显示信息 UserName.Text = account.RoleName; // 判断性别 switch (account.Sex) { case 0: SexText.Text = "可能是女孩子"; SexIcon.Foreground = new SolidColorBrush(Colors.Pink); SexIcon.Glyph = "\ue63a"; break; case 1: SexText.Text = "可能是男孩子"; SexIcon.Foreground = new SolidColorBrush(Colors.DeepSkyBlue); SexIcon.Glyph = "\ue639"; break; default: SexText.Text = "可能男女都不是"; break; } // 加载图片 var image = new BitmapImage(); image.UriSource = new Uri(account.Avatar); PersonPicture.ProfilePicture = image; })); } catch { Invoke(new Action(delegate { Frame.Navigate(typeof(Login)); })); } }) { IsBackground = true }.Start(); } else { Frame.Navigate(typeof(Login)); } }
public UserCenterPage() { this.InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Required; account = new Modules.Account(); }