public void InsertFromClipBoard(int index) { var text = Clipboard.GetText(); var data = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); foreach (var item in data) { var firstCol = item.Split('\t')[0]; bool isExists = BatchJobGroups.Any(i => i.Name == firstCol); if (isExists) { Error?.Invoke("Duplicate item(s) deleted.", null); } if (firstCol != "" && !isExists) { var bjg = new BatchJobGroup(firstCol); if (index < BatchJobGroups.Count) { BatchJobGroups.RemoveAt(index); BatchJobGroups.Insert(index, bjg); } else { BatchJobGroups.Add(bjg); } index++; } } }
public string SaveAsScope() { try { if (!BatchJobGroups.Any()) { return("Nothing to save."); } File.WriteAllLines(pathScopeFile, BatchJobGroups.Select(item => item.Name)); return(""); } catch (Exception ex) { return(ex.Message); } }