-update on FormBase which should prevent issues on control management
This commit is contained in:
@@ -56,7 +56,7 @@ namespace TelegramBotBase.Form
|
||||
|
||||
var buttons = this.Buttons.Aggregate((a, b) => a.Union(b).ToArray()).ToList();
|
||||
|
||||
if(call==null)
|
||||
if (call == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace TelegramBotBase.Form
|
||||
{
|
||||
ButtonForm btn = new ButtonForm();
|
||||
|
||||
foreach(var bl in this.Buttons)
|
||||
foreach (var bl in this.Buttons)
|
||||
{
|
||||
btn.AddButtonRow(bl.Select(a => new ButtonBase(a.Text, CallbackData.Create("action", a.Value))).ToList());
|
||||
}
|
||||
|
||||
@@ -20,6 +20,28 @@ namespace TelegramBotBase.Form
|
||||
|
||||
public ControlBase DependencyControl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contains the number of rows.
|
||||
/// </summary>
|
||||
public int Rows
|
||||
{
|
||||
get
|
||||
{
|
||||
return Buttons.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains the highest number of columns in an row.
|
||||
/// </summary>
|
||||
public int Cols
|
||||
{
|
||||
get
|
||||
{
|
||||
return Buttons.Select(a => a.Count).OrderByDescending(a => a).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public ButtonForm()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user