Przeglądaj źródła

增加日志保存

样式分支
fyf 2 lat temu
rodzic
commit
2329732182
3 zmienionych plików z 16 dodań i 3 usunięć
  1. +2
    -2
      BPASmartClient.Helper/logHelper.cs
  2. +13
    -1
      BPASmartClient.ViewModel/LogViewModel.cs
  3. +1
    -0
      BPASmartClient/Control/LogView.xaml

+ 2
- 2
BPASmartClient.Helper/logHelper.cs Wyświetl plik

@@ -31,8 +31,8 @@ namespace BPASmartClient.Helper
/// 日志显示委托
/// </summary>
public Action<string> 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;


+ 13
- 1
BPASmartClient.ViewModel/LogViewModel.cs Wyświetl plik

@@ -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


+ 1
- 0
BPASmartClient/Control/LogView.xaml Wyświetl plik

@@ -28,6 +28,7 @@
<!--<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox>
<CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox>-->
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}">导出日志</Button>
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding OpenCommand}">打开文件</Button>
</StackPanel>

<!--表格栏-->


Ładowanie…
Anuluj
Zapisz