private void RefreshList() { string log; using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (StreamReader reader = new StreamReader(fileStream)) { log = reader.ReadToEnd(); } var patterns = File.ReadAllText("patterns.txt"); list = logParser.ParseLog(log, patternsParser.GetPatterns(patterns)); lstLog.ItemsSource = Filter(list, txtSearch.Text); }