public void BuildCloud() { var words = wordsProcessor.HandleWords(); foreach (var word in words) { var rectangle = GetRectangle(word, word.Size); Console.WriteLine($"Height:{rectangle.Size.Height}{Environment.NewLine}Width:{rectangle.Size.Width}"); SizedWords.Add(new SizedWord(word, word.Size, word.Font, rectangle)); } }
public void BuildCloud() { var resultWords = wordsProcessor.HandleWords(); if (!resultWords.IsSuccess) { Console.WriteLine(resultWords.Error); return; } foreach (var word in resultWords.Value) { var resultRectangle = GetRectangle(word, word.Size).OnFail(Console.WriteLine); if (!resultRectangle.IsSuccess) { return; } SizedWords.Add(new SizedWord(word, word.Size, word.Font, resultRectangle.Value)); } var sizeResult = Result.Of(GetCloudSize).OnFail(Console.WriteLine); Size = sizeResult.IsSuccess ? sizeResult.Value : default; }