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 LoadFromScope() { try { if (!File.Exists(pathScopeFile)) { return("Scope file not yet defined."); } var names = File.ReadAllLines(pathScopeFile); if (!names.Any()) { return("Scope file is empty."); } BatchJobGroups.Clear(); foreach (var name in names) { var bjg = new BatchJobGroup(name); BatchJobGroups.Add(bjg); } return(""); } catch (Exception ex) { return(ex.Message); } }