using System.Diagnostics; using Telegram.Bot.Types.ReplyMarkups; namespace TelegramBotBase.Form { [DebuggerDisplay("{Text}, {Value}")] /// /// Base class for button handling /// public class ButtonBase { public virtual string Text { get; set; } public string Value { get; set; } public string Url { get; set; } public ButtonBase() { } public ButtonBase(string text, string value, string url = null) { this.Text = text; this.Value = value; this.Url = url; } /// /// Returns an inline Button /// /// /// public virtual InlineKeyboardButton ToInlineButton(ButtonForm form) { var id = (form.DependencyControl != null ? form.DependencyControl.ControlId + "_" : ""); if (Url == null) { return InlineKeyboardButton.WithCallbackData(Text, id + Value); } var ikb = new InlineKeyboardButton(Text) { //ikb.Text = this.Text; Url = Url }; return ikb; } /// /// Returns a KeyBoardButton /// /// /// public virtual KeyboardButton ToKeyboardButton(ButtonForm form) { return new KeyboardButton(Text); } } }