diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs index 3cd57b9..94c385d 100644 --- a/Correlator/ViewModels/AudioFileViewModel.cs +++ b/Correlator/ViewModels/AudioFileViewModel.cs @@ -155,9 +155,7 @@ { if (_selectedFile == null) { - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "音频文件路径错误,无法播放" } }, @@ -187,9 +185,7 @@ { DisposeResource("未播放"); - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "音频文件已损坏,无法播放" } }, @@ -209,9 +205,7 @@ if (audioService.Wave.PlaybackState == PlaybackState.Playing) { - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "音频播放中,请勿删除" } }, @@ -273,7 +267,10 @@ var audioFiles = new List(); var i = 1; //筛选大于50K的音频文件 - var files = new DirectoryInfo(DirectoryManager.GetAudioDir()).GetFiles("*", SearchOption.AllDirectories); + var files = new DirectoryInfo(DirectoryManager.GetAudioDir()) + .GetFiles("*", SearchOption.AllDirectories) + .OrderBy(file => file.CreationTime) + .Reverse(); foreach (var file in files) { if (file.Length < 1024 * 50) diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs index 3cd57b9..94c385d 100644 --- a/Correlator/ViewModels/AudioFileViewModel.cs +++ b/Correlator/ViewModels/AudioFileViewModel.cs @@ -155,9 +155,7 @@ { if (_selectedFile == null) { - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "音频文件路径错误,无法播放" } }, @@ -187,9 +185,7 @@ { DisposeResource("未播放"); - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "音频文件已损坏,无法播放" } }, @@ -209,9 +205,7 @@ if (audioService.Wave.PlaybackState == PlaybackState.Playing) { - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "音频播放中,请勿删除" } }, @@ -273,7 +267,10 @@ var audioFiles = new List(); var i = 1; //筛选大于50K的音频文件 - var files = new DirectoryInfo(DirectoryManager.GetAudioDir()).GetFiles("*", SearchOption.AllDirectories); + var files = new DirectoryInfo(DirectoryManager.GetAudioDir()) + .GetFiles("*", SearchOption.AllDirectories) + .OrderBy(file => file.CreationTime) + .Reverse(); foreach (var file in files) { if (file.Length < 1024 * 50) diff --git a/Correlator/ViewModels/PictureFileViewModel.cs b/Correlator/ViewModels/PictureFileViewModel.cs index 897753b..f1c7e1f 100644 --- a/Correlator/ViewModels/PictureFileViewModel.cs +++ b/Correlator/ViewModels/PictureFileViewModel.cs @@ -85,19 +85,20 @@ { if (_selectedFile == null) { - dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters + dialogService.ShowDialog("AlertMessageDialog", new DialogParameters { { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "图片文件路径错误,无法查看" } - }, + }, delegate { } ); return; } - - dialogService.ShowDialog("BigPictureView", - new DialogParameters { { "ImageFullPath", _selectedFile.FullPath } }, delegate { }); + + dialogService.ShowDialog("BigPictureView", new DialogParameters + { + { "ImageFullPath", _selectedFile.FullPath } + }, + delegate { }); }); DeletePictureCommand = new DelegateCommand(() => @@ -152,7 +153,8 @@ private static List GetTotalPictureFiles() { var i = 1; - return new DirectoryInfo(DirectoryManager.GetPictureDir()).GetFiles("*", SearchOption.AllDirectories) + var files = new DirectoryInfo(DirectoryManager.GetPictureDir()) + .GetFiles("*", SearchOption.AllDirectories) .Select(file => new ImageFile { Order = i++, @@ -161,7 +163,10 @@ FullPath = DirectoryManager.GetPictureDir() + "\\" + file.Name, FileSize = file.Length.FormatFileSize(), CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") - }).ToList(); + }) + .OrderBy(file => file.CreationTime) + .Reverse(); + return files.ToList(); } } } \ No newline at end of file