Update ButtonGrid.cs
Small refactoring for ButtonGrid
This commit is contained in:
parent
4336ff1681
commit
975a942993
@ -239,43 +239,38 @@ namespace TelegramBotBase.Controls
|
|||||||
await result.ConfirmAction(this.ConfirmationText ?? "");
|
await result.ConfirmAction(this.ConfirmationText ?? "");
|
||||||
|
|
||||||
//Find clicked button depending on Text or Value (depending on markup type)
|
//Find clicked button depending on Text or Value (depending on markup type)
|
||||||
switch (this.KeyboardType)
|
if (this.KeyboardType != eKeyboardType.InlineKeyBoard)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
var button = HeadLayoutButtonRow?.FirstOrDefault(a => a.Value == result.RawData)
|
||||||
|
?? SubHeadLayoutButtonRow?.FirstOrDefault(a => a.Value == result.RawData)
|
||||||
|
?? ButtonsForm.ToList().FirstOrDefault(a => a.Value == result.RawData);
|
||||||
|
|
||||||
|
if (button != null)
|
||||||
{
|
{
|
||||||
case eKeyboardType.InlineKeyBoard:
|
await OnButtonClicked(new ButtonClickedEventArgs(button));
|
||||||
|
|
||||||
var button = HeadLayoutButtonRow?.FirstOrDefault(a => a.Value == result.RawData)
|
result.Handled = true;
|
||||||
?? SubHeadLayoutButtonRow?.FirstOrDefault(a => a.Value == result.RawData)
|
return;
|
||||||
?? ButtonsForm.ToList().FirstOrDefault(a => a.Value == result.RawData);
|
}
|
||||||
|
|
||||||
if (button == null)
|
switch (result.RawData)
|
||||||
{
|
{
|
||||||
switch (result.RawData)
|
case "$previous$":
|
||||||
{
|
|
||||||
case "$previous$":
|
|
||||||
|
|
||||||
if (this.CurrentPageIndex > 0)
|
if (this.CurrentPageIndex > 0)
|
||||||
this.CurrentPageIndex--;
|
this.CurrentPageIndex--;
|
||||||
|
|
||||||
this.Updated();
|
this.Updated();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "$next$":
|
case "$next$":
|
||||||
|
|
||||||
if (this.CurrentPageIndex < this.PageCount - 1)
|
if (this.CurrentPageIndex < this.PageCount - 1)
|
||||||
this.CurrentPageIndex++;
|
this.CurrentPageIndex++;
|
||||||
|
|
||||||
this.Updated();
|
this.Updated();
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await OnButtonClicked(new ButtonClickedEventArgs(button));
|
|
||||||
|
|
||||||
result.Handled = true;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user