private Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup BuildKeyboardFromMessage(MessageWithButtons message) { var buttonLayout = new Telegram.Bot.Types.InlineKeyboardButtons.InlineKeyboardButton[message.Buttons.Count][]; int i = 0; for (i = 0; i < message.Buttons.Count; ++i) { buttonLayout[i] = new[] { new Telegram.Bot.Types.InlineKeyboardButtons.InlineKeyboardCallbackButton(message.Buttons[i].Text, message.Buttons[i].Callback) }; } return(new Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup(buttonLayout)); }
private Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup GetPreviewKeyboard(Int32 messageCount, Int32 blockSize) { Int32 pagesCount = messageCount / blockSize; if (messageCount % blockSize != 0) { pagesCount++; } var buttonLayout = new Telegram.Bot.Types.InlineKeyboardButtons.InlineKeyboardButton[pagesCount + 1][]; int i = 0; for (i = 0; i < pagesCount; ++i) { buttonLayout[i] = new[] { new Telegram.Bot.Types.InlineKeyboardButtons.InlineKeyboardCallbackButton(i.ToString(), "ListCallBack:" + i.ToString()) }; } buttonLayout[i] = new[] { new Telegram.Bot.Types.InlineKeyboardButtons.InlineKeyboardCallbackButton("В начало!", "StartSearchMessage") }; return(new Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup(buttonLayout)); }