Example #1
0
        private static async Task GetPageResults(PagedListResult <StarShip> pagedList)
        {
            /// start at 2 as we already have the first paged results
            for (var i = 2; i <= pagedList.Pages; i++)
            {
                ConsoleViewUtil.WriteFullLine(" Load more ?  (type y or yes to continue)", "green");

                var res = Console.ReadLine();

                if (res == "y" || res == "yes" || res == "Y" || res == "YES")
                {
                    //getting the next paged result
                    var temp = await _swDataService.GetStarShipsAsync(i);

                    _swDataService.CalculateSupplyStops(ref temp, MGLT);

                    PrintResults(temp.Results);
                }
                else
                {
                    /// end paging for loop
                    i = pagedList.Pages;
                }
            }
        }
Example #2
0
        static async Task Main(string[] args)
        {
            ///Starting Header
            ConsoleViewUtil.WriteFullLine("StarWars Starship Planet Stop Calculator", "yellow");

            GetUserInput();

            ConsoleViewUtil.WriteFullLine("Loading Ships to Bay", "green");

            await GetStarShipCalculation();

            ConsoleViewUtil.WriteFullLine("All Ships Loaded ", "green");
        }
Example #3
0
        private static void PrintResults(List <StarShip> starShips)
        {
            foreach (var item in starShips)
            {
                ConsoleViewUtil.WriteFullLine("------------------------------------", "blue");

                ConsoleViewUtil.WriteFullLine("Ship name: " + item.Name, "yellow");

                ConsoleViewUtil.WriteFullLine("Stops: " + item.PlanetStops, "yellow");

                ConsoleViewUtil.WriteFullLine("Flight Speed: " + item.MGLT, "yellow");

                ConsoleViewUtil.WriteFullLine("Resupply limit: " + item.Consumables, "yellow");

                ConsoleViewUtil.WriteFullLine("Time of Travel: " + item.MGLTTime, "yellow");
            }
        }