Пример #1
0
        /// <summary>
        /// Sets the list of specials by a particular day
        /// </summary>
        /// <param name="day">Day.</param>
        Task <bool> SetByDay(DayOfWeek day)
        {
            var tcs = new TaskCompletionSource <bool>();

            _sortedSpecs = _allSpecs.Where(x => x.DaysOfWeek.Contains(day));
            _listSpecs   = _sortedSpecs.Take(offset);
            lvUpcomingSpecs.ItemsSource = new ObservableCollection <FoodSpecial>(_listSpecs);
            _specSort = SpecSort.ByDay;
            tcs.SetResult(true);
            return(tcs.Task);
        }
Пример #2
0
        /// <summary>
        /// Sets the list to the upcoming specials
        /// </summary>
        Task <bool> SetUpcoming()
        {
            var tcs = new TaskCompletionSource <bool>();

            _sortedSpecs = _allSpecs.Where(x => x.StartTime.HasValue &&
                                           x.StartTime > DateTime.Now.TimeOfDay &&
                                           x.DaysOfWeek.Contains(DateTime.Now.DayOfWeek))
                           .OrderBy(x => x.StartTime).ToList();

            _listSpecs = _sortedSpecs.Take(offset);
            lvUpcomingSpecs.ItemsSource = new ObservableCollection <FoodSpecial>(_listSpecs);
            _specSort = SpecSort.Upcoming;
            tcs.SetResult(true);
            return(tcs.Task);
        }