static void Main(string[] args) { var grill = new Grill(GrillLength, GrillWidth, MeatChooserStrategy, MaxRectangle); using (var client = new GrillMenuClient(new AnonymousCredentials())) { var results = client.GetAll(); grill.AddMenus(results); Console.WriteLine($"Number of menus: {results.Count}, Grill size: {grill.CurrentRound.GrillSurfaceArea}, All meat size: {grill.AllMeatsSurfaceArea}, Best fit number of rounds: {Math.Floor((decimal)grill.AllMeatsSurfaceArea / grill.CurrentRound.GrillSurfaceArea)}"); do { grill.FillCurrentRound(); Console.Write($"Round {grill.CurrentRound.RoundNumber} menus ({grill.CurrentRound.GrillSurfaceArea}/{grill.CurrentRound.GrillUsedArea}): "); grill.TimeElapsed(TimeElapsedFixedForAllMeals); var roundMenus = grill.GetFinishedMenus(); if (roundMenus.Count > 0) { foreach (var menu in roundMenus) { Console.Write($"{menu.Name},"); } } else { Console.Write("-"); } Console.WriteLine(); grill.CreateNewRound(); } while (grill.IsMenuOnWait); Console.Write("To end application press ant key..."); Console.ReadKey(); } }
/// <summary> /// Retrieves menus from API /// </summary> /// <returns></returns> public IList <GrillMenuModel> GetMenus() { //Note: This should be replaced by a call to a Repository / Data handle layer that also //handles cache. Omitted for simplicity. GrillMenuClient client = new GrillMenuClient(new AnonymousCredentials()); return(client.GetAll()); }