From 1e7173619acfe1d670d68c23795079377ebc6863 Mon Sep 17 00:00:00 2001 From: dathlin Date: Thu, 13 Jul 2017 22:44:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E7=9A=84=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E4=B8=8B=E8=BD=BD=E7=B1=BB=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 软件系统客户端Wpf/MainWindow.xaml.cs | 8 ++++++-- 软件系统客户端模版/FormMainWindow.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/软件系统客户端Wpf/MainWindow.xaml.cs b/软件系统客户端Wpf/MainWindow.xaml.cs index c58c01e..717d1f7 100644 --- a/软件系统客户端Wpf/MainWindow.xaml.cs +++ b/软件系统客户端Wpf/MainWindow.xaml.cs @@ -575,12 +575,16 @@ namespace 软件系统客户端Wpf { SoftUserPortrait = new UserPortrait(AppDomain.CurrentDomain.BaseDirectory + @"\Portrait\" + UserClient.UserAccount.UserName, m => { + byte[] content = System.IO.File.ReadAllBytes(m); BitmapImage bi = new BitmapImage(); bi.BeginInit(); - bi.UriSource = new Uri(m, UriKind.RelativeOrAbsolute); + bi.StreamSource = new System.IO.MemoryStream(content); bi.EndInit(); - bi.Freeze(); AccountPortrait.Source = bi; + }, + ()=> + { + AccountPortrait.Source = null; }); } diff --git a/软件系统客户端模版/FormMainWindow.cs b/软件系统客户端模版/FormMainWindow.cs index e97c250..5147205 100644 --- a/软件系统客户端模版/FormMainWindow.cs +++ b/软件系统客户端模版/FormMainWindow.cs @@ -630,7 +630,7 @@ namespace 软件系统客户端模版 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); }