Пример #1
0
        private void SortLogFiles()
        {
            var key = CurrentFile?.FullPath;

            LogFiles.Clear();

            LogFiles.AddRange(GetAllLogs(_folderFullPath));
            if (key != null)
            {
                CurrentFile = LogFiles.Single(l => l.FullPath.Equals(key));
            }
        }
Пример #2
0
        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;
            }
        }