예제 #1
0
        /// <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());
        }
예제 #2
0
파일: Paging.cs 프로젝트: qingqibing/aa
        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());
        }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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());
        }
예제 #5
0
        //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
            }
        }
예제 #6
0
        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());
        }