Updates and improvements

- refactoring of ButtonGrid control for more readability
- refactoring of TaggedButtonGrid control for more readability
- adding Index parameter to ButtenClickedEventArgs
- adding FindRowByButton method to ButtonForm to get the row index
-
This commit is contained in:
FlorianDahn
2021-02-28 15:34:04 +01:00
parent 91048b4f7c
commit 15a8b8897f
5 changed files with 92 additions and 58 deletions
+9
View File
@@ -151,6 +151,15 @@ namespace TelegramBotBase.Form
return ikb;
}
public int FindRowByButton(ButtonBase button)
{
var row = this.Buttons.FirstOrDefault(a => a.Count(b => b == button) > 0);
if (row == null)
return -1;
return this.Buttons.IndexOf(row);
}
/// <summary>
/// Returns the first Button with the given value.
/// </summary>