private static async Task ShowWords(WordsOptions options, ITheasurusService service) { var take = options.PageSize; uint?skip = 0; do { var result = await service.GetWordsAsync(take, skip.Value); skip = result.NextSkip; var totalPages = Math.Ceiling((double)result.TotalResults / options.PageSize); var currentPage = skip.HasValue ? (int)(skip / options.PageSize) : totalPages; if (result.Words.Any()) { Console.WriteLine($"********** Page {currentPage} out of {totalPages} **********"); foreach (var word in result.Words) { Console.WriteLine(word); } } else { Console.WriteLine("The dictionary is empty. Check \"add --help\" to learn how to add new words and synonyms."); } }while (skip.HasValue); }
private static async Task ShowSynonyms(SynonymsOptions options, ITheasurusService service) { Console.WriteLine($"Synonyms of the word \"{options.Word}\":"); foreach (var synonym in await service.GetSynonymsAsync(options.Word)) { Console.WriteLine(synonym); } }