private InlineKeyboardMarkup getWeekDaysKeyboard(WeekDays wd) { List <IEnumerable <InlineKeyboardButton> > buttons = new List <IEnumerable <InlineKeyboardButton> >(); List <InlineKeyboardButton> daysButtonsRow = new List <InlineKeyboardButton>(); foreach (WeekDays day in Enum.GetValues(typeof(WeekDays))) { string dayName = Enum.GetName(typeof(WeekDays), day); bool dayChecked = (wd & day) > 0; string buttonText = (dayChecked ? "+" : "-") + dayName; daysButtonsRow.Add(new InlineKeyboardButton() { Text = buttonText, CallbackData = dayName }); } buttons.Add(daysButtonsRow); buttons.Add(new List <InlineKeyboardButton>() { new InlineKeyboardButton() { Text = "Done", CallbackData = SelectDaysDone } }); buttons.Add(TelegramHelper.GetHomeButton()); return(new InlineKeyboardMarkup(buttons)); }
public async Task Initialize(ITelegramBotClient client, Update update) { long chatId = update.GetChatId(); List <IEnumerable <InlineKeyboardButton> > buttons = new List <IEnumerable <InlineKeyboardButton> >(); Repository.Model.Chat chat; if (Program.RemindersRepository.TryGetChat(chatId, out chat)) { foreach (Reminder reminder in chat.Reminders.OrderBy(r => r.DayTime)) { buttons.Add(new List <InlineKeyboardButton>() { new InlineKeyboardButton() { Text = reminder.MessageText, CallbackData = reminder.ReminderId.ToString() } }); } } buttons.Add(TelegramHelper.GetHomeButton()); await client.SendTextMessageAsync(chatId, "Select reminder to remove", replyMarkup : new InlineKeyboardMarkup(buttons)); }