diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index ba8c748..d616520 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -234,9 +234,10 @@ + - + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index ba8c748..d616520 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -234,9 +234,10 @@ + - + diff --git a/Correlator/Model/AudioFile.cs b/Correlator/Model/AudioFile.cs new file mode 100644 index 0000000..ba50d34 --- /dev/null +++ b/Correlator/Model/AudioFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class AudioFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + + //是否正在播放 + public bool IsPlaying { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index ba8c748..d616520 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -234,9 +234,10 @@ + - + diff --git a/Correlator/Model/AudioFile.cs b/Correlator/Model/AudioFile.cs new file mode 100644 index 0000000..ba50d34 --- /dev/null +++ b/Correlator/Model/AudioFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class AudioFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + + //是否正在播放 + public bool IsPlaying { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/Model/FileInfo.cs b/Correlator/Model/FileInfo.cs deleted file mode 100644 index 6e0984c..0000000 --- a/Correlator/Model/FileInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Prism.Mvvm; - -namespace Correlator.Model -{ - public class FileInfo : BindableBase - { - // 序号 - public int Order { get; set; } - - // 文件名 - public string FileName { get; set; } - - // 负责人 - public string PersonLiable { get; set; } - - // 完整路径 - public string FullPath { get; set; } - - // 文件尺寸 - public string FileSize { get; set; } - - // 创建时间 - public string CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index ba8c748..d616520 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -234,9 +234,10 @@ + - + diff --git a/Correlator/Model/AudioFile.cs b/Correlator/Model/AudioFile.cs new file mode 100644 index 0000000..ba50d34 --- /dev/null +++ b/Correlator/Model/AudioFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class AudioFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + + //是否正在播放 + public bool IsPlaying { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/Model/FileInfo.cs b/Correlator/Model/FileInfo.cs deleted file mode 100644 index 6e0984c..0000000 --- a/Correlator/Model/FileInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Prism.Mvvm; - -namespace Correlator.Model -{ - public class FileInfo : BindableBase - { - // 序号 - public int Order { get; set; } - - // 文件名 - public string FileName { get; set; } - - // 负责人 - public string PersonLiable { get; set; } - - // 完整路径 - public string FullPath { get; set; } - - // 文件尺寸 - public string FileSize { get; set; } - - // 创建时间 - public string CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Correlator/Model/ImageResultFile.cs b/Correlator/Model/ImageResultFile.cs new file mode 100644 index 0000000..35cb25a --- /dev/null +++ b/Correlator/Model/ImageResultFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class ImageResultFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 负责人 + public string PersonLiable { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index ba8c748..d616520 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -234,9 +234,10 @@ + - + diff --git a/Correlator/Model/AudioFile.cs b/Correlator/Model/AudioFile.cs new file mode 100644 index 0000000..ba50d34 --- /dev/null +++ b/Correlator/Model/AudioFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class AudioFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + + //是否正在播放 + public bool IsPlaying { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/Model/FileInfo.cs b/Correlator/Model/FileInfo.cs deleted file mode 100644 index 6e0984c..0000000 --- a/Correlator/Model/FileInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Prism.Mvvm; - -namespace Correlator.Model -{ - public class FileInfo : BindableBase - { - // 序号 - public int Order { get; set; } - - // 文件名 - public string FileName { get; set; } - - // 负责人 - public string PersonLiable { get; set; } - - // 完整路径 - public string FullPath { get; set; } - - // 文件尺寸 - public string FileSize { get; set; } - - // 创建时间 - public string CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Correlator/Model/ImageResultFile.cs b/Correlator/Model/ImageResultFile.cs new file mode 100644 index 0000000..35cb25a --- /dev/null +++ b/Correlator/Model/ImageResultFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class ImageResultFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 负责人 + public string PersonLiable { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs index 375443e..9ee271d 100644 --- a/Correlator/ViewModels/AudioFileViewModel.cs +++ b/Correlator/ViewModels/AudioFileViewModel.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Windows; using System.Windows.Controls; +using Correlator.Model; using Correlator.Util; using HandyControl.Controls; using HandyControl.Data; @@ -11,7 +12,6 @@ using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; -using FileInfo = Correlator.Model.FileInfo; using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.ViewModels @@ -22,10 +22,10 @@ public string Title { get; private set; } = string.Empty; public event Action RequestClose; - private List _totalFiles; - private List _audioFiles; + private List _totalFiles; + private List _audioFiles; - public List AudioFiles + public List AudioFiles { get => _audioFiles; set @@ -72,7 +72,7 @@ #endregion - private FileInfo _selectedFile; + private AudioFile _selectedFile; private WaveOutEvent _waveOutEvent = new WaveOutEvent(); private AudioFileReader _audioFileReader; @@ -97,7 +97,7 @@ ItemSelectedCommand = new DelegateCommand(delegate(DataGrid dataGrid) { - _selectedFile = (FileInfo)dataGrid.SelectedItem; + _selectedFile = (AudioFile)dataGrid.SelectedItem; }); PlayAudioCommand = new DelegateCommand(delegate(string fullPath) @@ -155,20 +155,19 @@ AudioFiles = _totalFiles.Take(8).ToList(); } - private static List GetTotalAudioFiles() + private static List GetTotalAudioFiles() { var i = 1; return new DirectoryInfo(DirectoryManager.GetAudioDir()).GetFiles("*", SearchOption.AllDirectories).Select( - file => - new FileInfo - { - Order = i++, - FileName = file.Name, - PersonLiable = "", - FullPath = DirectoryManager.GetAudioDir() + "\\" + file.Name, - FileSize = file.Length.FormatFileSize(), - CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") - }).ToList(); + file => new AudioFile + { + Order = i++, + FileName = file.Name, + FullPath = DirectoryManager.GetAudioDir() + "\\" + file.Name, + FileSize = file.Length.FormatFileSize(), + CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"), + IsPlaying = false + }).ToList(); } } } \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index ba8c748..d616520 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -234,9 +234,10 @@ + - + diff --git a/Correlator/Model/AudioFile.cs b/Correlator/Model/AudioFile.cs new file mode 100644 index 0000000..ba50d34 --- /dev/null +++ b/Correlator/Model/AudioFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class AudioFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + + //是否正在播放 + public bool IsPlaying { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/Model/FileInfo.cs b/Correlator/Model/FileInfo.cs deleted file mode 100644 index 6e0984c..0000000 --- a/Correlator/Model/FileInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Prism.Mvvm; - -namespace Correlator.Model -{ - public class FileInfo : BindableBase - { - // 序号 - public int Order { get; set; } - - // 文件名 - public string FileName { get; set; } - - // 负责人 - public string PersonLiable { get; set; } - - // 完整路径 - public string FullPath { get; set; } - - // 文件尺寸 - public string FileSize { get; set; } - - // 创建时间 - public string CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Correlator/Model/ImageResultFile.cs b/Correlator/Model/ImageResultFile.cs new file mode 100644 index 0000000..35cb25a --- /dev/null +++ b/Correlator/Model/ImageResultFile.cs @@ -0,0 +1,25 @@ +using Prism.Mvvm; + +namespace Correlator.Model +{ + public class ImageResultFile : BindableBase + { + // 序号 + public int Order { get; set; } + + // 文件名 + public string FileName { get; set; } + + // 负责人 + public string PersonLiable { get; set; } + + // 完整路径 + public string FullPath { get; set; } + + // 文件尺寸 + public string FileSize { get; set; } + + // 创建时间 + public string CreationTime { get; set; } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs index 375443e..9ee271d 100644 --- a/Correlator/ViewModels/AudioFileViewModel.cs +++ b/Correlator/ViewModels/AudioFileViewModel.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Windows; using System.Windows.Controls; +using Correlator.Model; using Correlator.Util; using HandyControl.Controls; using HandyControl.Data; @@ -11,7 +12,6 @@ using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; -using FileInfo = Correlator.Model.FileInfo; using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.ViewModels @@ -22,10 +22,10 @@ public string Title { get; private set; } = string.Empty; public event Action RequestClose; - private List _totalFiles; - private List _audioFiles; + private List _totalFiles; + private List _audioFiles; - public List AudioFiles + public List AudioFiles { get => _audioFiles; set @@ -72,7 +72,7 @@ #endregion - private FileInfo _selectedFile; + private AudioFile _selectedFile; private WaveOutEvent _waveOutEvent = new WaveOutEvent(); private AudioFileReader _audioFileReader; @@ -97,7 +97,7 @@ ItemSelectedCommand = new DelegateCommand(delegate(DataGrid dataGrid) { - _selectedFile = (FileInfo)dataGrid.SelectedItem; + _selectedFile = (AudioFile)dataGrid.SelectedItem; }); PlayAudioCommand = new DelegateCommand(delegate(string fullPath) @@ -155,20 +155,19 @@ AudioFiles = _totalFiles.Take(8).ToList(); } - private static List GetTotalAudioFiles() + private static List GetTotalAudioFiles() { var i = 1; return new DirectoryInfo(DirectoryManager.GetAudioDir()).GetFiles("*", SearchOption.AllDirectories).Select( - file => - new FileInfo - { - Order = i++, - FileName = file.Name, - PersonLiable = "", - FullPath = DirectoryManager.GetAudioDir() + "\\" + file.Name, - FileSize = file.Length.FormatFileSize(), - CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") - }).ToList(); + file => new AudioFile + { + Order = i++, + FileName = file.Name, + FullPath = DirectoryManager.GetAudioDir() + "\\" + file.Name, + FileSize = file.Length.FormatFileSize(), + CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"), + IsPlaying = false + }).ToList(); } } } \ No newline at end of file diff --git a/Correlator/ViewModels/PictureFileViewModel.cs b/Correlator/ViewModels/PictureFileViewModel.cs index fe47a75..28a107b 100644 --- a/Correlator/ViewModels/PictureFileViewModel.cs +++ b/Correlator/ViewModels/PictureFileViewModel.cs @@ -3,13 +3,13 @@ using System.IO; using System.Linq; using System.Windows.Controls; +using Correlator.Model; using Correlator.Util; using HandyControl.Controls; using HandyControl.Data; using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; -using FileInfo = Correlator.Model.FileInfo; namespace Correlator.ViewModels { @@ -19,10 +19,10 @@ public string Title { get; private set; } = string.Empty; public event Action RequestClose; - private List _totalFiles; - private List _pictureFiles; + private List _totalFiles; + private List _pictureFiles; - public List PictureFiles + public List PictureFiles { get => _pictureFiles; set @@ -68,7 +68,7 @@ #endregion - private FileInfo _selectedFile; + private ImageResultFile _selectedFile; public PictureFileViewModel() { @@ -79,7 +79,7 @@ ItemSelectedCommand = new DelegateCommand(delegate(DataGrid dataGrid) { - _selectedFile = (FileInfo)dataGrid.SelectedItem; + _selectedFile = (ImageResultFile)dataGrid.SelectedItem; }); DeleteItemCommand = new DelegateCommand(() => @@ -129,20 +129,19 @@ PictureFiles = _totalFiles.Take(8).ToList(); } - private static List GetTotalPictureFiles() + private static List GetTotalPictureFiles() { var i = 1; return new DirectoryInfo(DirectoryManager.GetPictureDir()).GetFiles("*", SearchOption.AllDirectories) - .Select(file => - new FileInfo - { - Order = i++, - FileName = file.Name, - PersonLiable = "", - FullPath = DirectoryManager.GetPictureDir() + "\\" + file.Name, - FileSize = file.Length.FormatFileSize(), - CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") - }).ToList(); + .Select(file => new ImageResultFile + { + Order = i++, + FileName = file.Name, + PersonLiable = "", + FullPath = DirectoryManager.GetPictureDir() + "\\" + file.Name, + FileSize = file.Length.FormatFileSize(), + CreationTime = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") + }).ToList(); } } } \ No newline at end of file