private void addItem() { String line; if ((line = sr.ReadLine()) != null) { var array = line.ToString().Split('\t'); List <string> data = new List <string>(); foreach (string item in array) { if (item != "\n") { data.Add(item); } } LR1TableItem temp = new LR1TableItem(data); ItemList.Add(temp); TableView.Dispatcher.BeginInvoke(DispatcherPriority.Background, new AddItemDelegate(addItem)); } else { sr.Close(); MainWindow temp = (MainWindow)Application.Current.MainWindow; temp.Semantic.IsEnabled = true; } }
private List <LR1TableItem> ReadTable() { string sourceFolder = Storage.getStoragePath("Source"); string tableFilePath = Path.Combine(sourceFolder, "lr(1).table"); StreamReader sr = new StreamReader(tableFilePath, Encoding.Default); sr.ReadLine(); string line; while ((line = sr.ReadLine()) != null) { var array = line.ToString().Split('\t'); List <string> data = new List <string>(); foreach (string item in array) { if (item != "\n") { data.Add(item); } } LR1TableItem temp = new LR1TableItem(data); ItemList.Add(temp); } sr.Close(); return(ItemList); }