public override void StoreTexts() { Texts.Store(); }
public Keyboards(Texts texts) { Texts = texts; }
public async override void Next(MessageEventArgs e) { var userId = e.Message.From.Id; string btnText = e.Message.Text; var state = GetUserState(userId); if (btnText == Texts.ToStartButton) { SetGreetingState(e.Message.From.Id); } else { switch (state) { case State.ChooseSettings: { if (btnText == Texts.PersonalAccount.StatisticsButton) { SetChooseStatisticsState(e); } else if (btnText == Texts.PersonalAccount.TextsEditingButton) { SetChooseBlockState(e); } else if (btnText == Texts.BackButton) { SetGreetingState(e.Message.From.Id); } break; } case State.ChooseStatistics: { if (btnText == Texts.PersonalAccount.AllUsersButton) { ShowAllUsers(e); } else if (btnText == Texts.PersonalAccount.LamagnaPassedUsersButton) { ShowLamagnaPassedUsers(e); } else if (btnText == Texts.PersonalAccount.TrippierPassedUsersButton) { ShowTrippierPassedUsers(e); } else if (btnText == Texts.PersonalAccount.MainProductPassedUsersButton) { ShowMainProductPassedUsers(e); } else if (btnText == Texts.BackButton) { SetChooseSettingsState(e); } break; } case State.ChooseBlockToEdit: { if (btnText == Texts.BackButton) { SetChooseSettingsState(e); } else if (Texts.ValidBlockName(e.Message.Text)) { SaveBlockChoice(userId, e.Message.Text); SetChooseTextState(e); } else { await TBot.SendTextMessageAsync(userId, $"{Emoji.Error} Нет такого блока."); SetChooseBlockState(e); } break; } case State.ChooseTextToEdit: { if (btnText == Texts.BackButton) { SetChooseBlockState(e); } else { SaveTextChoice(userId, e.Message.Text); SetEnterNewTextState(e); } break; } case State.EnterNewText: { if (btnText == Texts.BackButton) { SetChooseTextState(e); } else { if (string.IsNullOrEmpty(btnText)) { await TBot.SendTextMessageAsync(userId, "Молчание не привлечёт к вам клиентов!"); SetChooseTextState(e); } UpdateText(e); } break; } } } }