UpdateUserInfo()添加异常捕获

croire 3 years ago
parent 59c75e3fdd
commit 73b2fa9739

@ -238,54 +238,62 @@ namespace DownKyi.ViewModels
return;
}
await Task.Run(new Action(() =>
try
{
// 获取用户信息
var userInfo = UserInfo.GetUserInfoForNavigation();
if (userInfo != null)
await Task.Run(new Action(() =>
{
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
// 获取用户信息
var userInfo = UserInfo.GetUserInfoForNavigation();
if (userInfo != null)
{
Mid = userInfo.Mid,
Name = userInfo.Name,
IsLogin = userInfo.IsLogin,
IsVip = userInfo.VipStatus == 1
});
}
else
{
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
{
Mid = userInfo.Mid,
Name = userInfo.Name,
IsLogin = userInfo.IsLogin,
IsVip = userInfo.VipStatus == 1
});
}
else
{
Mid = -1,
Name = "",
IsLogin = false,
IsVip = false
});
}
PropertyChangeAsync(new Action(() =>
{
LoginPanelVisibility = Visibility.Visible;
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
{
Mid = -1,
Name = "",
IsLogin = false,
IsVip = false
});
}
if (userInfo != null)
PropertyChangeAsync(new Action(() =>
{
if (userInfo.Face != null)
LoginPanelVisibility = Visibility.Visible;
if (userInfo != null)
{
Header = new StorageHeader().GetHeaderThumbnail(userInfo.Mid, userInfo.Name, userInfo.Face, 36, 36);
if (userInfo.Face != null)
{
Header = new StorageHeader().GetHeaderThumbnail(userInfo.Mid, userInfo.Name, userInfo.Face, 36, 36);
}
else
{
Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg"));
}
UserName = userInfo.Name;
}
else
{
Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg"));
UserName = null;
}
UserName = userInfo.Name;
}
else
{
Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg"));
UserName = null;
}
}));
}));
}));
}
catch (Exception e)
{
Core.Utils.Debugging.Console.PrintLine("UpdateUserInfo()发生异常: {0}", e);
LogManager.Error(Tag, e);
}
}
#endregion

Loading…
Cancel
Save