Пример #1
0
        private async void GetAwardsByFilters()
        {
            var rawSelectedCategories = (
                _categories.Where(category => category.Selected).Select(
                    category => category.Category)).ToArray();

            if (rawSelectedCategories.Count() == 0)
            {
                return;
            }
            string[] selectedCategories = rawSelectedCategories.ToArray();
            var      unsortedAwards     = await Award.GetAwardsByFilters(
                SelectedYear, selectedCategories);

            var sortedAwards = from award in unsortedAwards
                               orderby award.Category
                               group award by award.Category into awardsGroup
                               select new AwardsGroup <string, Award>(
                awardsGroup.Key, awardsGroup);

            var oldAwards = new ObservableCollection <AwardsGroup <string, Award> >();

            foreach (var item in sortedAwards)
            {
                oldAwards.Add(item);
            }
            Awards = oldAwards;
            await((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync(new FilteredAwardsView());
        }