diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 3bb069d..b9856ff 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -456,10 +456,12 @@ public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } public DelegateCommand DetectNoiseCommand { private set; get; } - public DelegateCommand SettingsCommand { private set; get; } + public DelegateCommand ExtensionsCommand { private set; get; } public DelegateCommand SoundSpeedCommand { private set; get; } + public DelegateCommand ImportDataCommand { private set; get; } + public DelegateCommand HelpCenterCommand { private set; get; } + public DelegateCommand ShowLogCommand { private set; get; } public DelegateCommand ShowApplicationInfoCommand { private set; get; } - public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } public DelegateCommand ResetParamCommand { private set; get; } public DelegateCommand SnapShotCommand { private set; get; } @@ -779,8 +781,8 @@ _dialogService.Show("DetectNoiseDialog", null, delegate { }); }); - //设置 - SettingsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + //扩展 + ExtensionsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); //声速 SoundSpeedCommand = new DelegateCommand(delegate(Popup popup) @@ -800,15 +802,8 @@ popup.IsOpen = false; }); - //查看软件、协议版本 - ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) - { - _dialogService.Show("ApplicationInfoDialog", null, delegate { }); - popup.IsOpen = false; - }); - - //导入数据 - ImportDataCommand = new DelegateCommand(delegate + //导入水听器数据 + ImportDataCommand = new DelegateCommand(delegate(Popup popup) { if (RuntimeCache.IsHydrophone) { @@ -845,6 +840,41 @@ { ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } + + popup.IsOpen = false; + }); + + //设置 + HelpCenterCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + + //查看日志 + ShowLogCommand = new DelegateCommand(delegate(Popup popup) + { + var file = new DirectoryInfo(DirectoryManager.LogDirPath) + .GetFiles("*.log", SearchOption.AllDirectories) + .OrderBy(f => f.LastWriteTime) + .Reverse() + .First(); + if (file == null) + { + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "暂时没有日志生成,请稍后再试"); + return; + } + + _dialogService.Show("ApplicationLogView", new DialogParameters + { + { "LogFullName", file.FullName } + }, + delegate { } + ); + popup.IsOpen = false; + }); + + //查看软件、协议版本 + ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) + { + _dialogService.Show("ApplicationInfoDialog", null, delegate { }); + popup.IsOpen = false; }); //打开Matlab波形 diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 3bb069d..b9856ff 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -456,10 +456,12 @@ public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } public DelegateCommand DetectNoiseCommand { private set; get; } - public DelegateCommand SettingsCommand { private set; get; } + public DelegateCommand ExtensionsCommand { private set; get; } public DelegateCommand SoundSpeedCommand { private set; get; } + public DelegateCommand ImportDataCommand { private set; get; } + public DelegateCommand HelpCenterCommand { private set; get; } + public DelegateCommand ShowLogCommand { private set; get; } public DelegateCommand ShowApplicationInfoCommand { private set; get; } - public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } public DelegateCommand ResetParamCommand { private set; get; } public DelegateCommand SnapShotCommand { private set; get; } @@ -779,8 +781,8 @@ _dialogService.Show("DetectNoiseDialog", null, delegate { }); }); - //设置 - SettingsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + //扩展 + ExtensionsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); //声速 SoundSpeedCommand = new DelegateCommand(delegate(Popup popup) @@ -800,15 +802,8 @@ popup.IsOpen = false; }); - //查看软件、协议版本 - ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) - { - _dialogService.Show("ApplicationInfoDialog", null, delegate { }); - popup.IsOpen = false; - }); - - //导入数据 - ImportDataCommand = new DelegateCommand(delegate + //导入水听器数据 + ImportDataCommand = new DelegateCommand(delegate(Popup popup) { if (RuntimeCache.IsHydrophone) { @@ -845,6 +840,41 @@ { ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } + + popup.IsOpen = false; + }); + + //设置 + HelpCenterCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + + //查看日志 + ShowLogCommand = new DelegateCommand(delegate(Popup popup) + { + var file = new DirectoryInfo(DirectoryManager.LogDirPath) + .GetFiles("*.log", SearchOption.AllDirectories) + .OrderBy(f => f.LastWriteTime) + .Reverse() + .First(); + if (file == null) + { + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "暂时没有日志生成,请稍后再试"); + return; + } + + _dialogService.Show("ApplicationLogView", new DialogParameters + { + { "LogFullName", file.FullName } + }, + delegate { } + ); + popup.IsOpen = false; + }); + + //查看软件、协议版本 + ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) + { + _dialogService.Show("ApplicationInfoDialog", null, delegate { }); + popup.IsOpen = false; }); //打开Matlab波形 diff --git a/Correlator/ViewModels/NoiseWaveViewViewModel.cs b/Correlator/ViewModels/NoiseWaveViewViewModel.cs index 685f712..c319c4b 100644 --- a/Correlator/ViewModels/NoiseWaveViewViewModel.cs +++ b/Correlator/ViewModels/NoiseWaveViewViewModel.cs @@ -1,5 +1,4 @@ using System; -using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -7,7 +6,14 @@ { public class NoiseWaveViewViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM @@ -15,20 +21,6 @@ #endregion - #region DelegateCommand - - public DelegateCommand GoBackCommand { get; set; } - - #endregion - - public NoiseWaveViewViewModel() - { - GoBackCommand = new DelegateCommand(delegate - { - RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); - }); - } - public bool CanCloseDialog() { return true; diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 3bb069d..b9856ff 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -456,10 +456,12 @@ public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } public DelegateCommand DetectNoiseCommand { private set; get; } - public DelegateCommand SettingsCommand { private set; get; } + public DelegateCommand ExtensionsCommand { private set; get; } public DelegateCommand SoundSpeedCommand { private set; get; } + public DelegateCommand ImportDataCommand { private set; get; } + public DelegateCommand HelpCenterCommand { private set; get; } + public DelegateCommand ShowLogCommand { private set; get; } public DelegateCommand ShowApplicationInfoCommand { private set; get; } - public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } public DelegateCommand ResetParamCommand { private set; get; } public DelegateCommand SnapShotCommand { private set; get; } @@ -779,8 +781,8 @@ _dialogService.Show("DetectNoiseDialog", null, delegate { }); }); - //设置 - SettingsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + //扩展 + ExtensionsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); //声速 SoundSpeedCommand = new DelegateCommand(delegate(Popup popup) @@ -800,15 +802,8 @@ popup.IsOpen = false; }); - //查看软件、协议版本 - ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) - { - _dialogService.Show("ApplicationInfoDialog", null, delegate { }); - popup.IsOpen = false; - }); - - //导入数据 - ImportDataCommand = new DelegateCommand(delegate + //导入水听器数据 + ImportDataCommand = new DelegateCommand(delegate(Popup popup) { if (RuntimeCache.IsHydrophone) { @@ -845,6 +840,41 @@ { ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } + + popup.IsOpen = false; + }); + + //设置 + HelpCenterCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + + //查看日志 + ShowLogCommand = new DelegateCommand(delegate(Popup popup) + { + var file = new DirectoryInfo(DirectoryManager.LogDirPath) + .GetFiles("*.log", SearchOption.AllDirectories) + .OrderBy(f => f.LastWriteTime) + .Reverse() + .First(); + if (file == null) + { + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "暂时没有日志生成,请稍后再试"); + return; + } + + _dialogService.Show("ApplicationLogView", new DialogParameters + { + { "LogFullName", file.FullName } + }, + delegate { } + ); + popup.IsOpen = false; + }); + + //查看软件、协议版本 + ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) + { + _dialogService.Show("ApplicationInfoDialog", null, delegate { }); + popup.IsOpen = false; }); //打开Matlab波形 diff --git a/Correlator/ViewModels/NoiseWaveViewViewModel.cs b/Correlator/ViewModels/NoiseWaveViewViewModel.cs index 685f712..c319c4b 100644 --- a/Correlator/ViewModels/NoiseWaveViewViewModel.cs +++ b/Correlator/ViewModels/NoiseWaveViewViewModel.cs @@ -1,5 +1,4 @@ using System; -using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -7,7 +6,14 @@ { public class NoiseWaveViewViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM @@ -15,20 +21,6 @@ #endregion - #region DelegateCommand - - public DelegateCommand GoBackCommand { get; set; } - - #endregion - - public NoiseWaveViewViewModel() - { - GoBackCommand = new DelegateCommand(delegate - { - RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); - }); - } - public bool CanCloseDialog() { return true; diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 2f7d3a9..12f59c6 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -13,11 +13,18 @@ { public class NumericKeypadDialogViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM - public string Title { get; private set; } = "数字键盘"; + public string Title => "数字键盘"; private string _inputNumber = string.Empty; diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 3bb069d..b9856ff 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -456,10 +456,12 @@ public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } public DelegateCommand DetectNoiseCommand { private set; get; } - public DelegateCommand SettingsCommand { private set; get; } + public DelegateCommand ExtensionsCommand { private set; get; } public DelegateCommand SoundSpeedCommand { private set; get; } + public DelegateCommand ImportDataCommand { private set; get; } + public DelegateCommand HelpCenterCommand { private set; get; } + public DelegateCommand ShowLogCommand { private set; get; } public DelegateCommand ShowApplicationInfoCommand { private set; get; } - public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } public DelegateCommand ResetParamCommand { private set; get; } public DelegateCommand SnapShotCommand { private set; get; } @@ -779,8 +781,8 @@ _dialogService.Show("DetectNoiseDialog", null, delegate { }); }); - //设置 - SettingsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + //扩展 + ExtensionsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); //声速 SoundSpeedCommand = new DelegateCommand(delegate(Popup popup) @@ -800,15 +802,8 @@ popup.IsOpen = false; }); - //查看软件、协议版本 - ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) - { - _dialogService.Show("ApplicationInfoDialog", null, delegate { }); - popup.IsOpen = false; - }); - - //导入数据 - ImportDataCommand = new DelegateCommand(delegate + //导入水听器数据 + ImportDataCommand = new DelegateCommand(delegate(Popup popup) { if (RuntimeCache.IsHydrophone) { @@ -845,6 +840,41 @@ { ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } + + popup.IsOpen = false; + }); + + //设置 + HelpCenterCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + + //查看日志 + ShowLogCommand = new DelegateCommand(delegate(Popup popup) + { + var file = new DirectoryInfo(DirectoryManager.LogDirPath) + .GetFiles("*.log", SearchOption.AllDirectories) + .OrderBy(f => f.LastWriteTime) + .Reverse() + .First(); + if (file == null) + { + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "暂时没有日志生成,请稍后再试"); + return; + } + + _dialogService.Show("ApplicationLogView", new DialogParameters + { + { "LogFullName", file.FullName } + }, + delegate { } + ); + popup.IsOpen = false; + }); + + //查看软件、协议版本 + ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) + { + _dialogService.Show("ApplicationInfoDialog", null, delegate { }); + popup.IsOpen = false; }); //打开Matlab波形 diff --git a/Correlator/ViewModels/NoiseWaveViewViewModel.cs b/Correlator/ViewModels/NoiseWaveViewViewModel.cs index 685f712..c319c4b 100644 --- a/Correlator/ViewModels/NoiseWaveViewViewModel.cs +++ b/Correlator/ViewModels/NoiseWaveViewViewModel.cs @@ -1,5 +1,4 @@ using System; -using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -7,7 +6,14 @@ { public class NoiseWaveViewViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM @@ -15,20 +21,6 @@ #endregion - #region DelegateCommand - - public DelegateCommand GoBackCommand { get; set; } - - #endregion - - public NoiseWaveViewViewModel() - { - GoBackCommand = new DelegateCommand(delegate - { - RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); - }); - } - public bool CanCloseDialog() { return true; diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 2f7d3a9..12f59c6 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -13,11 +13,18 @@ { public class NumericKeypadDialogViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM - public string Title { get; private set; } = "数字键盘"; + public string Title => "数字键盘"; private string _inputNumber = string.Empty; diff --git a/Correlator/Views/ApplicationLogView.xaml b/Correlator/Views/ApplicationLogView.xaml new file mode 100644 index 0000000..636bbc0 --- /dev/null +++ b/Correlator/Views/ApplicationLogView.xaml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 3bb069d..b9856ff 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -456,10 +456,12 @@ public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } public DelegateCommand DetectNoiseCommand { private set; get; } - public DelegateCommand SettingsCommand { private set; get; } + public DelegateCommand ExtensionsCommand { private set; get; } public DelegateCommand SoundSpeedCommand { private set; get; } + public DelegateCommand ImportDataCommand { private set; get; } + public DelegateCommand HelpCenterCommand { private set; get; } + public DelegateCommand ShowLogCommand { private set; get; } public DelegateCommand ShowApplicationInfoCommand { private set; get; } - public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } public DelegateCommand ResetParamCommand { private set; get; } public DelegateCommand SnapShotCommand { private set; get; } @@ -779,8 +781,8 @@ _dialogService.Show("DetectNoiseDialog", null, delegate { }); }); - //设置 - SettingsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + //扩展 + ExtensionsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); //声速 SoundSpeedCommand = new DelegateCommand(delegate(Popup popup) @@ -800,15 +802,8 @@ popup.IsOpen = false; }); - //查看软件、协议版本 - ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) - { - _dialogService.Show("ApplicationInfoDialog", null, delegate { }); - popup.IsOpen = false; - }); - - //导入数据 - ImportDataCommand = new DelegateCommand(delegate + //导入水听器数据 + ImportDataCommand = new DelegateCommand(delegate(Popup popup) { if (RuntimeCache.IsHydrophone) { @@ -845,6 +840,41 @@ { ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } + + popup.IsOpen = false; + }); + + //设置 + HelpCenterCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + + //查看日志 + ShowLogCommand = new DelegateCommand(delegate(Popup popup) + { + var file = new DirectoryInfo(DirectoryManager.LogDirPath) + .GetFiles("*.log", SearchOption.AllDirectories) + .OrderBy(f => f.LastWriteTime) + .Reverse() + .First(); + if (file == null) + { + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "暂时没有日志生成,请稍后再试"); + return; + } + + _dialogService.Show("ApplicationLogView", new DialogParameters + { + { "LogFullName", file.FullName } + }, + delegate { } + ); + popup.IsOpen = false; + }); + + //查看软件、协议版本 + ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) + { + _dialogService.Show("ApplicationInfoDialog", null, delegate { }); + popup.IsOpen = false; }); //打开Matlab波形 diff --git a/Correlator/ViewModels/NoiseWaveViewViewModel.cs b/Correlator/ViewModels/NoiseWaveViewViewModel.cs index 685f712..c319c4b 100644 --- a/Correlator/ViewModels/NoiseWaveViewViewModel.cs +++ b/Correlator/ViewModels/NoiseWaveViewViewModel.cs @@ -1,5 +1,4 @@ using System; -using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -7,7 +6,14 @@ { public class NoiseWaveViewViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM @@ -15,20 +21,6 @@ #endregion - #region DelegateCommand - - public DelegateCommand GoBackCommand { get; set; } - - #endregion - - public NoiseWaveViewViewModel() - { - GoBackCommand = new DelegateCommand(delegate - { - RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); - }); - } - public bool CanCloseDialog() { return true; diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 2f7d3a9..12f59c6 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -13,11 +13,18 @@ { public class NumericKeypadDialogViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM - public string Title { get; private set; } = "数字键盘"; + public string Title => "数字键盘"; private string _inputNumber = string.Empty; diff --git a/Correlator/Views/ApplicationLogView.xaml b/Correlator/Views/ApplicationLogView.xaml new file mode 100644 index 0000000..636bbc0 --- /dev/null +++ b/Correlator/Views/ApplicationLogView.xaml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/Correlator/Views/ApplicationLogView.xaml.cs b/Correlator/Views/ApplicationLogView.xaml.cs new file mode 100644 index 0000000..c23b9d9 --- /dev/null +++ b/Correlator/Views/ApplicationLogView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace Correlator.Views +{ + public partial class ApplicationLogView : UserControl + { + public ApplicationLogView() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/Correlator/App.config b/Correlator/App.config index 27e82bf..8657eae 100644 --- a/Correlator/App.config +++ b/Correlator/App.config @@ -36,7 +36,6 @@ - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index b6d70ca..5c9dd37 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -104,6 +104,7 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); + containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 53b113f..da299ba 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -249,6 +249,10 @@ LoadingDialog.xaml + + + ApplicationLogView.xaml + NoiseWaveView.xaml @@ -345,6 +349,7 @@ MSBuild:Compile + Designer diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index b7c1ecd..ccfb9c8 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Util/DirectoryManager.cs b/Correlator/Util/DirectoryManager.cs index 73f64c7..b22e50b 100644 --- a/Correlator/Util/DirectoryManager.cs +++ b/Correlator/Util/DirectoryManager.cs @@ -5,6 +5,7 @@ { public static class DirectoryManager { + public const string LogDirPath = "C:\\Users\\相关仪日志\\Log\\Info\\"; private static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private static string CreateDir(string s) diff --git a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs index c7afc56..0f62e5f 100644 --- a/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs +++ b/Correlator/ViewModels/ApplicationInfoDialogViewModel.cs @@ -8,8 +8,16 @@ { public class ApplicationInfoDialogViewModel : BindableBase, IDialogAware { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + public string Title => "软件信息"; - public event Action RequestClose; #region VM diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs new file mode 100644 index 0000000..ee359b1 --- /dev/null +++ b/Correlator/ViewModels/ApplicationLogViewModel.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Prism.Mvvm; +using Prism.Services.Dialogs; + +namespace Correlator.ViewModels +{ + public class ApplicationLogViewModel : BindableBase, IDialogAware + { + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } + + #region VM + + public string Title => "相关仪运行日志"; + + private string _contentText = string.Empty; + + public string ContentText + { + get => _contentText; + set + { + _contentText = value; + RaisePropertyChanged(); + } + } + + #endregion + + public ApplicationLogViewModel() + { + + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + } + + public void OnDialogOpened(IDialogParameters parameters) + { + var logFullName = parameters.GetValue("LogFullName"); + ContentText = File.ReadAllText(logFullName); + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 3bb069d..b9856ff 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -456,10 +456,12 @@ public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } public DelegateCommand DetectNoiseCommand { private set; get; } - public DelegateCommand SettingsCommand { private set; get; } + public DelegateCommand ExtensionsCommand { private set; get; } public DelegateCommand SoundSpeedCommand { private set; get; } + public DelegateCommand ImportDataCommand { private set; get; } + public DelegateCommand HelpCenterCommand { private set; get; } + public DelegateCommand ShowLogCommand { private set; get; } public DelegateCommand ShowApplicationInfoCommand { private set; get; } - public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } public DelegateCommand ResetParamCommand { private set; get; } public DelegateCommand SnapShotCommand { private set; get; } @@ -779,8 +781,8 @@ _dialogService.Show("DetectNoiseDialog", null, delegate { }); }); - //设置 - SettingsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + //扩展 + ExtensionsCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); //声速 SoundSpeedCommand = new DelegateCommand(delegate(Popup popup) @@ -800,15 +802,8 @@ popup.IsOpen = false; }); - //查看软件、协议版本 - ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) - { - _dialogService.Show("ApplicationInfoDialog", null, delegate { }); - popup.IsOpen = false; - }); - - //导入数据 - ImportDataCommand = new DelegateCommand(delegate + //导入水听器数据 + ImportDataCommand = new DelegateCommand(delegate(Popup popup) { if (RuntimeCache.IsHydrophone) { @@ -845,6 +840,41 @@ { ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } + + popup.IsOpen = false; + }); + + //设置 + HelpCenterCommand = new DelegateCommand(delegate(Popup popup) { popup.IsOpen = true; }); + + //查看日志 + ShowLogCommand = new DelegateCommand(delegate(Popup popup) + { + var file = new DirectoryInfo(DirectoryManager.LogDirPath) + .GetFiles("*.log", SearchOption.AllDirectories) + .OrderBy(f => f.LastWriteTime) + .Reverse() + .First(); + if (file == null) + { + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "暂时没有日志生成,请稍后再试"); + return; + } + + _dialogService.Show("ApplicationLogView", new DialogParameters + { + { "LogFullName", file.FullName } + }, + delegate { } + ); + popup.IsOpen = false; + }); + + //查看软件、协议版本 + ShowApplicationInfoCommand = new DelegateCommand(delegate(Popup popup) + { + _dialogService.Show("ApplicationInfoDialog", null, delegate { }); + popup.IsOpen = false; }); //打开Matlab波形 diff --git a/Correlator/ViewModels/NoiseWaveViewViewModel.cs b/Correlator/ViewModels/NoiseWaveViewViewModel.cs index 685f712..c319c4b 100644 --- a/Correlator/ViewModels/NoiseWaveViewViewModel.cs +++ b/Correlator/ViewModels/NoiseWaveViewViewModel.cs @@ -1,5 +1,4 @@ using System; -using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -7,7 +6,14 @@ { public class NoiseWaveViewViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM @@ -15,20 +21,6 @@ #endregion - #region DelegateCommand - - public DelegateCommand GoBackCommand { get; set; } - - #endregion - - public NoiseWaveViewViewModel() - { - GoBackCommand = new DelegateCommand(delegate - { - RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); - }); - } - public bool CanCloseDialog() { return true; diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 2f7d3a9..12f59c6 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -13,11 +13,18 @@ { public class NumericKeypadDialogViewModel : BindableBase, IDialogAware { - public event Action RequestClose; + /// + /// 空实现 + /// + public event Action RequestClose + { + add { } + remove { } + } #region VM - public string Title { get; private set; } = "数字键盘"; + public string Title => "数字键盘"; private string _inputNumber = string.Empty; diff --git a/Correlator/Views/ApplicationLogView.xaml b/Correlator/Views/ApplicationLogView.xaml new file mode 100644 index 0000000..636bbc0 --- /dev/null +++ b/Correlator/Views/ApplicationLogView.xaml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/Correlator/Views/ApplicationLogView.xaml.cs b/Correlator/Views/ApplicationLogView.xaml.cs new file mode 100644 index 0000000..c23b9d9 --- /dev/null +++ b/Correlator/Views/ApplicationLogView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace Correlator.Views +{ + public partial class ApplicationLogView : UserControl + { + public ApplicationLogView() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/Correlator/Views/MainWindow.xaml b/Correlator/Views/MainWindow.xaml index 16ed6f0..14a5824 100644 --- a/Correlator/Views/MainWindow.xaml +++ b/Correlator/Views/MainWindow.xaml @@ -157,9 +157,11 @@ @@ -210,11 +212,11 @@ @@ -311,11 +313,11 @@ + CommandParameter="{Binding ElementName=ExtensionsButtonPop}"> + + + + + + + + + + + + + + + + + + @@ -210,11 +212,11 @@ @@ -311,11 +313,11 @@ + CommandParameter="{Binding ElementName=ExtensionsButtonPop}"> + + + + + + + + + + + + + + + + + +