From 2329732182ae47512297241cb1defe0e0d69a908 Mon Sep 17 00:00:00 2001 From: fyf Date: Sat, 14 May 2022 10:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.Helper/logHelper.cs | 4 ++-- BPASmartClient.ViewModel/LogViewModel.cs | 14 +++++++++++++- BPASmartClient/Control/LogView.xaml | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/BPASmartClient.Helper/logHelper.cs b/BPASmartClient.Helper/logHelper.cs index 8938429f..60291612 100644 --- a/BPASmartClient.Helper/logHelper.cs +++ b/BPASmartClient.Helper/logHelper.cs @@ -31,8 +31,8 @@ namespace BPASmartClient.Helper /// 日志显示委托 /// public Action InfoNotify { get; set; } - private ILog directLogger = null; - private log4net.Appender.RollingFileAppender directRollfileAppender = null; + public ILog directLogger = null; + public log4net.Appender.RollingFileAppender directRollfileAppender = null; ILoggerRepository logRepos = null; private static bool m_isInitDirectLog = false; //是否初始化了直接写入日志文件 private static Int32 directFileSize = 50; diff --git a/BPASmartClient.ViewModel/LogViewModel.cs b/BPASmartClient.ViewModel/LogViewModel.cs index 77cff3f5..bb6522ff 100644 --- a/BPASmartClient.ViewModel/LogViewModel.cs +++ b/BPASmartClient.ViewModel/LogViewModel.cs @@ -100,6 +100,18 @@ namespace BPASmartClient.ViewModel ExcellOrder(); }); + OpenCommand = new RelayCommand(() => + { + string msg = string.Format("已找到日志文件,是否打开! \n 1.如选中不打开,则弹出日志文件夹目录。\n 2.打开,则弹出日志文件夹目录,并打开文件。"); + if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) + { + System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); + OpenFile(logHelper.GetLogConfigInstance().directRollfileAppender.File); + }else + System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); + + }); + dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += delegate { @@ -246,7 +258,7 @@ namespace BPASmartClient.ViewModel } public RelayCommand ExcelCommand { get; set; } - + public RelayCommand OpenCommand { get; set; } } public class LogModel : ObservableObject diff --git a/BPASmartClient/Control/LogView.xaml b/BPASmartClient/Control/LogView.xaml index 0f50aa06..886b0319 100644 --- a/BPASmartClient/Control/LogView.xaml +++ b/BPASmartClient/Control/LogView.xaml @@ -28,6 +28,7 @@ +