diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 81ab608..bd73932 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -413,7 +413,6 @@ - diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 81ab608..bd73932 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -413,7 +413,6 @@ - diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index ccfb9c8..395515a 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 81ab608..bd73932 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -413,7 +413,6 @@ - diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index ccfb9c8..395515a 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Image/close3.png b/Correlator/Image/close3.png deleted file mode 100644 index b5e6fed..0000000 --- a/Correlator/Image/close3.png +++ /dev/null Binary files differ diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 81ab608..bd73932 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -413,7 +413,6 @@ - diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index ccfb9c8..395515a 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Image/close3.png b/Correlator/Image/close3.png deleted file mode 100644 index b5e6fed..0000000 --- a/Correlator/Image/close3.png +++ /dev/null Binary files differ diff --git a/Correlator/ViewModels/BigPictureViewModel.cs b/Correlator/ViewModels/BigPictureViewModel.cs index d77dab8..7f1a055 100644 --- a/Correlator/ViewModels/BigPictureViewModel.cs +++ b/Correlator/ViewModels/BigPictureViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Windows.Media.Imaging; using Prism.Commands; using Prism.Mvvm; @@ -9,15 +8,15 @@ { public class BigPictureViewModel : BindableBase, IDialogAware { - public string Title { get; private set; } = string.Empty; - private BitmapFrame _bigImageFrame; + public string Title => string.Empty; + private BitmapImage _bigPictureBitmapImage; - public BitmapFrame BigImageFrame + public BitmapImage BigPictureBitmapImage { - get => _bigImageFrame; + get => _bigPictureBitmapImage; set { - _bigImageFrame = value; + _bigPictureBitmapImage = value; RaisePropertyChanged(); } } @@ -47,21 +46,7 @@ public void OnDialogOpened(IDialogParameters parameters) { var imageFullPath = parameters.GetValue("ImageFullPath"); - - //解决图片打开然后关闭之后,显示文件被占用无法删除的问题 - using (var reader = new BinaryReader(File.Open(imageFullPath, FileMode.Open))) - { - var fi = new FileInfo(imageFullPath); - var bytes = reader.ReadBytes((int)fi.Length); - reader.Close(); - - var bitmapImage = new BitmapImage(); - bitmapImage.BeginInit(); - bitmapImage.CacheOption = BitmapCacheOption.OnLoad; - bitmapImage.StreamSource = new MemoryStream(bytes); - bitmapImage.EndInit(); - BigImageFrame = BitmapFrame.Create(bitmapImage); - } + BigPictureBitmapImage = new BitmapImage(new Uri(imageFullPath, UriKind.Absolute)); } } } \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 81ab608..bd73932 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -413,7 +413,6 @@ - diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index ccfb9c8..395515a 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Image/close3.png b/Correlator/Image/close3.png deleted file mode 100644 index b5e6fed..0000000 --- a/Correlator/Image/close3.png +++ /dev/null Binary files differ diff --git a/Correlator/ViewModels/BigPictureViewModel.cs b/Correlator/ViewModels/BigPictureViewModel.cs index d77dab8..7f1a055 100644 --- a/Correlator/ViewModels/BigPictureViewModel.cs +++ b/Correlator/ViewModels/BigPictureViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Windows.Media.Imaging; using Prism.Commands; using Prism.Mvvm; @@ -9,15 +8,15 @@ { public class BigPictureViewModel : BindableBase, IDialogAware { - public string Title { get; private set; } = string.Empty; - private BitmapFrame _bigImageFrame; + public string Title => string.Empty; + private BitmapImage _bigPictureBitmapImage; - public BitmapFrame BigImageFrame + public BitmapImage BigPictureBitmapImage { - get => _bigImageFrame; + get => _bigPictureBitmapImage; set { - _bigImageFrame = value; + _bigPictureBitmapImage = value; RaisePropertyChanged(); } } @@ -47,21 +46,7 @@ public void OnDialogOpened(IDialogParameters parameters) { var imageFullPath = parameters.GetValue("ImageFullPath"); - - //解决图片打开然后关闭之后,显示文件被占用无法删除的问题 - using (var reader = new BinaryReader(File.Open(imageFullPath, FileMode.Open))) - { - var fi = new FileInfo(imageFullPath); - var bytes = reader.ReadBytes((int)fi.Length); - reader.Close(); - - var bitmapImage = new BitmapImage(); - bitmapImage.BeginInit(); - bitmapImage.CacheOption = BitmapCacheOption.OnLoad; - bitmapImage.StreamSource = new MemoryStream(bytes); - bitmapImage.EndInit(); - BigImageFrame = BitmapFrame.Create(bitmapImage); - } + BigPictureBitmapImage = new BitmapImage(new Uri(imageFullPath, UriKind.Absolute)); } } } \ No newline at end of file diff --git a/Correlator/Views/BigPictureView.xaml b/Correlator/Views/BigPictureView.xaml index 9ef1f9a..530cfe0 100644 --- a/Correlator/Views/BigPictureView.xaml +++ b/Correlator/Views/BigPictureView.xaml @@ -18,24 +18,32 @@ - - + + Command="{Binding CloseWindowCommand}" + Content="" + FontFamily="/Correlator;component/Fonts/#iconfont" + FontSize="50" + Foreground="White" + Style="{StaticResource ButtonCustom}" /> \ No newline at end of file