Tigran 4 years ago
parent
commit
0141a5d82a

+ 2 - 1
CardCollector/Commands/CallbackQuery/AuthorCallback.cs

@@ -14,13 +14,14 @@ namespace CardCollector.Commands.CallbackQuery
 
         public override async Task Execute()
         {
+            var page = int.Parse(CallbackData.Split('=')[1]);
             /* Получаем из бд список всех авторов */
             var list = await StickerDao.GetAuthorsList();
             /* Сортируем по алфавиту */
             list.Sort();
             /* Заменяем сообщение меню на сообщение со списком */
             await MessageController.EditMessage(User, CallbackMessageId,
-                Messages.choose_author, Keyboard.GetAuthorsKeyboard(list));
+                Messages.choose_author, Keyboard.GetAuthorsKeyboard(list, page));
         }
 
         public AuthorCallback() { }

+ 1 - 0
CardCollector/Commands/CallbackQuery/CancelCallback.cs

@@ -10,6 +10,7 @@ namespace CardCollector.Commands.CallbackQuery
         protected override string CommandText => Command.cancel;
         public override async Task Execute()
         {
+            User.State = UserState.Default;
             await User.ClearChat();
         }
 

+ 0 - 9
CardCollector/Resources/Command.Designer.cs

@@ -87,15 +87,6 @@ namespace CardCollector.Resources {
             }
         }
         
-        /// <summary>
-        ///   Looks up a localized string similar to change_page.
-        /// </summary>
-        internal static string change_page {
-            get {
-                return ResourceManager.GetString("change_page", resourceCulture);
-            }
-        }
-        
         /// <summary>
         ///   Looks up a localized string similar to collect_income.
         /// </summary>

+ 0 - 3
CardCollector/Resources/Command.resx

@@ -42,9 +42,6 @@
     <data name="back" xml:space="preserve">
         <value>back</value>
     </data>
-    <data name="change_page" xml:space="preserve">
-        <value>change_page</value>
-    </data>
     <data name="unlimited_stickers" xml:space="preserve">
         <value>unlim</value>
     </data>

+ 5 - 5
CardCollector/Resources/Keyboard.cs

@@ -25,7 +25,7 @@ namespace CardCollector.Resources
         {
             var keyboard = new List<InlineKeyboardButton[]>
             {
-                new[] {InlineKeyboardButton.WithCallbackData(Text.author, Command.author)},
+                new[] {InlineKeyboardButton.WithCallbackData(Text.author, $"{Command.author}=1")},
                 new[] {InlineKeyboardButton.WithCallbackData(Text.tier, Command.tier)},
                 new[] {InlineKeyboardButton.WithCallbackData(Text.emoji, Command.emoji)}
             };
@@ -134,16 +134,16 @@ namespace CardCollector.Resources
                     {
                         <10 => new[]
                         {
-                            InlineKeyboardButton.WithCallbackData(Text.previous, $"{Command.change_page}={page - 1}")
+                            InlineKeyboardButton.WithCallbackData(Text.previous, $"{Command.author}={page - 1}")
                         },
                         >=10 when page == 1 => new[]
                         {
-                            InlineKeyboardButton.WithCallbackData(Text.next, $"{Command.change_page}={page + 1}")
+                            InlineKeyboardButton.WithCallbackData(Text.next, $"{Command.author}={page + 1}")
                         },
                         _ => new[]
                         {
-                            InlineKeyboardButton.WithCallbackData(Text.previous, $"{Command.change_page}={page - 1}"),
-                            InlineKeyboardButton.WithCallbackData(Text.next, $"{Command.change_page}={page + 1}")
+                            InlineKeyboardButton.WithCallbackData(Text.previous, $"{Command.author}={page - 1}"),
+                            InlineKeyboardButton.WithCallbackData(Text.next, $"{Command.author}={page + 1}")
                         }
                     }
                 );