-update on FormBase which should prevent issues on control management

This commit is contained in:
FlorianDahn
2019-12-02 03:46:40 +01:00
parent 7be0f15ca4
commit a08ba8f512
13 changed files with 182 additions and 31 deletions
+2 -2
View File
@@ -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());
}
+22
View File
@@ -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()
{