适配新的头像下载类机制

This commit is contained in:
dathlin
2017-07-13 22:44:03 +08:00
parent a3356dc6e1
commit 1e7173619a
2 changed files with 7 additions and 3 deletions

View File

@@ -575,12 +575,16 @@ namespace 软件系统客户端Wpf
{ {
SoftUserPortrait = new UserPortrait(AppDomain.CurrentDomain.BaseDirectory + @"\Portrait\" + UserClient.UserAccount.UserName, SoftUserPortrait = new UserPortrait(AppDomain.CurrentDomain.BaseDirectory + @"\Portrait\" + UserClient.UserAccount.UserName,
m => { m => {
byte[] content = System.IO.File.ReadAllBytes(m);
BitmapImage bi = new BitmapImage(); BitmapImage bi = new BitmapImage();
bi.BeginInit(); bi.BeginInit();
bi.UriSource = new Uri(m, UriKind.RelativeOrAbsolute); bi.StreamSource = new System.IO.MemoryStream(content);
bi.EndInit(); bi.EndInit();
bi.Freeze();
AccountPortrait.Source = bi; AccountPortrait.Source = bi;
},
()=>
{
AccountPortrait.Source = null;
}); });
} }

View File

@@ -630,7 +630,7 @@ namespace 软件系统客户端模版
private void SoftUserPortraitInitialization() private void SoftUserPortraitInitialization()
{ {
SoftUserPortrait = new UserPortrait(Application.StartupPath + @"\Portrait\" + UserClient.UserAccount.UserName, m => pictureBox1.LoadAsync(m)); SoftUserPortrait = new UserPortrait(Application.StartupPath + @"\Portrait\" + UserClient.UserAccount.UserName, m => pictureBox1.LoadAsync(m),null);
} }