示例#1
0
        public ObservableCollection <Dish> GetMenu()
        {
            ObservableCollection <Dish>      dishes = new ObservableCollection <Dish>();
            List <lab1_restaurant.core.Dish> dds    = _model.getMenu(DateTime.Parse(closetime)).Dishes;

            dds.ForEach(a => dishes.Add(parseOldDish(a)));
            return(dishes);
        }
        private void OnRefreshMenu(object sender, EventArgs e)
        {
            string   closeTime = "23:30";
            DateTime time      = DateTime.Parse(closeTime);

            _view.Menu = _model.getMenu(time);
            _model.check();
            _view.RefreshMenu();
        }
        private int msgParser(string msg, DateTime time, MenuExplorer menu)
        {
            int num = int.Parse(msg);

            if (num > menu.getMenu(time).Dishes.Count || num < 0)
            {
                throw new ArgumentException();
            }
            else
            {
                return(num);
            }
        }
        public void callMenu(DateTime time, MenuExplorer menu)
        {
            Console.WriteLine("Menu");
            int iter = 1;

            Menu = menu.getMenu(time);
            foreach (Dish dish in Menu.Dishes)
            {
                Console.WriteLine($"{iter}. {dish}");
                iter++;
            }
            Console.WriteLine("0. Refresh");
        }