private void Add(FileSystemEventArgs e, ChangeItem.ChangeType type) { if (Directory.Exists(e.FullPath)) { return; } var rel = IOHelper.RelFolderOf(e.FullPath, SolnFol); if (rel.ContainsAny(@"bin\", @"obj\", FolRoot)) { return; } var itm = new ChangeItem { Change = type, FileName = e.Name, RelPath = rel }; if (Items.AnyIs(itm)) { return; } Window.AddItem(itm); Items.Add(itm); IOHelper.SaveTo(Items, RootFol); }
public LvwItem(ChangeItem item, ListViewGroup grp) { Text = item.FileName; SubItems.AddRange(new string[] { item.RelPath, "todo", "todo", item.Change.ToString() }); Group = grp; }
private ListViewGroup GroupOf(ChangeItem item) { if (item.Changelist == null) { return null; } return lvwItems.Groups.Cast<ListViewGroup>().FirstOrDefault(x => x.Name == item.Changelist) ?? lvwItems.Groups.Add(item.Changelist, item.Changelist); }
public static bool AnyIs(this IEnumerable<ChangeItem> list, ChangeItem item) { return list.Any(x => x.RelPath.Equals(item.RelPath, StringComparison.OrdinalIgnoreCase) && x.FileName.Equals(item.FileName, StringComparison.OrdinalIgnoreCase)); }
void IWindowUI.AddItem(ChangeItem x) { lvwItems.Items.Add(new LvwItem(x, GroupOf(x))); }