private void SortLogFiles() { var key = CurrentFile?.FullPath; LogFiles.Clear(); LogFiles.AddRange(GetAllLogs(_folderFullPath)); if (key != null) { CurrentFile = LogFiles.Single(l => l.FullPath.Equals(key)); } }
public void StartWatching(string folder) { if (folder == null) { throw new ArgumentNullException(nameof(folder)); } if (!Directory.Exists(folder)) { return; } _folderFullPath = folder; LogFiles.AddRange(GetAllLogs(folder)); if (!string.IsNullOrEmpty(folder)) { _fileSystemWatcher.Path = folder; _fileSystemWatcher.EnableRaisingEvents = true; } }