コード例 #1
0
ファイル: MenuHandler.cs プロジェクト: jirkaceska/C_sharp
        private void Display(Func <DayMenu, bool> customFilter)
        {
            for (int i = 0; i < Scrapper.RestaurantsCount; i++)
            {
                if (selectedRestaurant.HasFlag((Restaurants)(1 << i)))
                {
                    try
                    {
                        Restaurant restaurant = scrapper[i];

                        var dayMenus = restaurant.
                                       Where((menu) => selectedDay.HasFlag(menu.Day.FlagDayOfWeek())).
                                       Where(customFilter);

                        if (dayMenus.Count() > 0)
                        {
                            PrintRestaurant(restaurant);
                        }
                        foreach (DayMenu menu in dayMenus)
                        {
                            Console.WriteLine(menu);
                        }
                    }
                    catch (WebException e)
                    {
                        PrintLine();
                        Console.WriteLine(e.Message);
                        Console.WriteLine("Zkontrolujte své připojení k internetu. Poté zkuste zobrazit menu znovu.");
                    }
                    catch (WeekendEmptyException e)
                    {
                        PrintLine();
                        Console.WriteLine(e.Message);
                    }
                }
            }
            Init();
        }