public void Write([NotNull] string text, [NotNull] RichTextLabel label) { Ensure.Any.IsNotNull(text, nameof(text)); Ensure.Any.IsNotNull(label, nameof(label)); if (Color.HasValue) { label.PushColor(Color.Value); } if (Underline) { label.PushUnderline(); } if (Bold || Italics) { var sb = new StringBuilder(text.Length + 7 * 2); if (Bold) { sb.Append("[b]"); } if (Italics) { sb.Append("[i]"); } sb.Append(text); if (Italics) { sb.Append("[/i]"); } if (Bold) { sb.Append("[/b]"); } label.AppendBbcode(sb.ToString()); } else { label.AddText(text); } if (Color.HasValue || Underline) { label.Pop(); } }
private void AddCateogryTitle(string Category) { DisplayLabel.PushCell(); DisplayLabel.PushColor(Colors.White); DisplayLabel.PushBold(); DisplayLabel.PushUnderline(); DisplayLabel.AppendBbcode(Category); DisplayLabel.Pop(); DisplayLabel.Pop(); DisplayLabel.Pop(); DisplayLabel.Pop(); DisplayLabel.PushCell(); DisplayLabel.Pop(); }
public void Write(string text, RichTextLabel label) { Ensure.That(text, nameof(text)).IsNotNull(); Ensure.That(label, nameof(label)).IsNotNull(); Color.Iter(label.PushColor); if (Underline) { label.PushUnderline(); } if (Bold || Italics) { var sb = new StringBuilder(text.Length + 7 * 2); if (Bold) { sb.Append("[b]"); } if (Italics) { sb.Append("[i]"); } sb.Append(text); if (Italics) { sb.Append("[/i]"); } if (Bold) { sb.Append("[/b]"); } label.AppendBbcode(sb.ToString()); } else { label.AddText(text); } if (Color.IsSome || Underline) { label.Pop(); } }