private void LoadFindData(string keyword = "") { if (this.Model.ViewLogViewer.RecordCount > 1 && string.IsNullOrEmpty(keyword)) { return; } Model.ViewLogViewer.Clear(); Model.ViewLogViewer.Locked = false; Model.ViewLogViewer.ClearCache(); var log = LogFiles.LoadLog(); var log2 = log.OrderByDescending(i => i.LastWriteTime).ToList(); foreach (FileInfo fileInfo in log2) { if (fileInfo.Name.Contains("All.log")) { if (fileInfo.LastWriteTime.Date < DateTime.Now.AddDays(-7)) { continue; //只显示最近7天文件 } var viewLog = Model.ViewLogViewer.AddNewUIRecord(); viewLog.FileName = fileInfo.Name; viewLog.Modified = fileInfo.LastWriteTime; viewLog.FileSize = GetFileSize(fileInfo.Length); if (!string.IsNullOrEmpty(keyword)) { if (LogFiles.ReadFile(fileInfo.Name).IndexOf(keyword, StringComparison.Ordinal) != -1) { viewLog.IsHave = true; } } } } }