/// <summary> /// Searches the online feed selected for the specified search term /// in uxSearchText. /// </summary> /// <typeparam></typeparam> /// <param></param> /// <returns></returns> private void Search() { uxPackages.Items.Clear(); uxPackages.Items.Add("Searching..."); var task = Task.Factory.StartNew(() => { string search = uxSearchText.Text; IQueryable <IPackage> results = packages.Repo.Search(search, false); var query = from item in results where item.IsLatestVersion == true select item; return(query.ToList()); }); task.ContinueWith(t => { Add.AddPackages(t.Result, uxPackages, currentPageNumber); if (uxPackages.Items.Count == 0) { uxPackages.Items.Add("No packages matching your search terms were found."); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
public void DisplayPackages(ListView listview, int pagenumber, TabPage tab, AppManager App) { ResetButtons(tab); listview.Items.Clear(); listview.Items.Add("Loading..."); Task <PackageList> task = GetPackages(pagenumber); task.ContinueWith(t => { listview.Items.Clear(); if (t.Result == null) { listview.Items.Add("No packages could be retrieved for the selected feed."); listview.Items.Add("Try again later or Select another feed."); } else { var packs = from pack in t.Result.packages where App.GetExtension(pack.Id) == null select pack; var localPacks = packages.Manager.LocalRepository.GetPackages(); packs = from pack in packs where !localPacks.Where(p => p.Id == pack.Id).Any() select pack; add.AddPackages(packs.ToArray(), listview, pagenumber); CreateButtons(t.Result.TotalPackageCount); AddButtons(tab); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
private void RefreshUpdateList() { IEnumerable <IPackage> localPackages = GetPackagesFromExtensions(App.Extensions); if (localPackages.Count() > 0) { IEnumerable <IPackage> list = packages.Repo.GetUpdates(localPackages, false, false); if (uxUpdatePackages.InvokeRequired) { uxUpdatePackages.Invoke((Action)(() => { Add.AddPackages(list, uxUpdatePackages); })); } else { Add.AddPackages(list, uxUpdatePackages); } } }
public void DisplayPackages(ListView listview) { listview.Items.Clear(); listview.Items.Add("Loading..."); Task <NuGet.IPackage[]> task = GetAllPackages(); task.ContinueWith(t => { add.AddPackages(t.Result, listview); }, TaskScheduler.FromCurrentSynchronizationContext()); }
//Using the class variable 'list' to refresh the packages that are eligble for update. private void setListView() { int Count = list.Count(); try { if (listview.InvokeRequired) { listview.Invoke((Action)(() => { listview.Clear(); Add.AddPackages(list, listview, 0); tab.Text = String.Format("Updates ({0})", Count); if (Count == 0) { listview.Clear(); listview.Items.Add("No updates available for the selected feed."); } })); } else { listview.Clear(); Add.AddPackages(list, listview, 0); tab.Text = String.Format("Updates ({0})", Count); if (Count == 0) { listview.Clear(); listview.Items.Add("No updates available for the selected feed."); } } } catch { //do nothing } }
public void DisplayPackages(ListView listview, int pagenumber, TabPage tab) { ResetButtons(tab); listview.Items.Clear(); listview.Items.Add("Loading..."); Task <PackageList> task = GetPackages(pagenumber); task.ContinueWith(t => { listview.Items.Clear(); if (t.Result == null) { listview.Items.Add("No packages could be retrieved for the selected feed."); listview.Items.Add("Try again later or Select another feed."); } else { add.AddPackages(t.Result.packages, listview, pagenumber); CreateButtons(t.Result.TotalPackageCount); AddButtons(tab); } }, TaskScheduler.FromCurrentSynchronizationContext()); }