void FetchGacContents() { HashSet <string> fullNames = new HashSet <string>(); UpdateProgressBar(pg => { pg.Visibility = System.Windows.Visibility.Visible; pg.IsIndeterminate = true; }); var list = GacInterop.GetGacAssemblyFullNames().TakeWhile(_ => !cancelFetchThread).ToList(); UpdateProgressBar(pg => { pg.IsIndeterminate = false; pg.Maximum = list.Count; }); foreach (var r in list) { if (cancelFetchThread) { break; } if (fullNames.Add(r.FullName)) // filter duplicates { var file = GacInterop.FindAssemblyInNetGac(r); if (file != null) { var entry = new GacEntry(r, file); UpdateProgressBar(pg => { pg.Value = pg.Value + 1; AddNewEntry(entry); }); } } } UpdateProgressBar(pg => { pg.Visibility = System.Windows.Visibility.Hidden; }); }
void FetchGacContents() { HashSet <string> fullNames = new HashSet <string>(); foreach (var r in GacInterop.GetGacAssemblyFullNames()) { if (cancelFetchThread) { return; } if (fullNames.Add(r.FullName)) // filter duplicates { var file = GacInterop.FindAssemblyInNetGac(r); if (file != null) { var entry = new GacEntry(r, file); Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action <GacEntry>(AddNewEntry), entry); } } } }