MAJOR CHANGE for ButtonGrids, Dynamic data sources, etc

- introducing a dynamic data source class (IDataSource)
- introducing a ButtonRow class for better managability
- replacing that List<ButtonBase> with ButtonRow object
- introducing ButtonFormDataSource with special methods for ButtonGrid controls
- updating ButtonGrid and refactoring of the Load/Action methods
- updating CheckButtonList and refactoring of the Load/Action methods
- updating TaggedButtonGrid and refactoring of the Load/Action methods
- adding example to the Test project
This commit is contained in:
FlorianDahn
2021-07-26 15:10:10 +02:00
parent 894d0799c8
commit 71433c0e4e
14 changed files with 1225 additions and 266 deletions
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Controls.Hybrid;
using TelegramBotBase.Form;
namespace TelegramBotBase.Args
@@ -18,6 +19,8 @@ namespace TelegramBotBase.Args
public object Tag { get; set; }
public ButtonRow Row { get; set; }
public ButtonClickedEventArgs()
{
@@ -36,5 +39,11 @@ namespace TelegramBotBase.Args
this.Index = Index;
}
public ButtonClickedEventArgs(ButtonBase button, int Index, ButtonRow row)
{
this.Button = button;
this.Index = Index;
this.Row = row;
}
}
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using TelegramBotBase.Controls.Hybrid;
using TelegramBotBase.Form;
namespace TelegramBotBase.Args
@@ -17,7 +18,7 @@ namespace TelegramBotBase.Args
/// <summary>
/// Contains all buttons within this row, excluding the checkbox.
/// </summary>
public List<ButtonBase> Row { get; set; }
public ButtonRow Row { get; set; }
/// <summary>
@@ -31,7 +32,7 @@ namespace TelegramBotBase.Args
}
public CheckedChangedEventArgs(List<ButtonBase> row, int Index, bool Checked)
public CheckedChangedEventArgs(ButtonRow row, int Index, bool Checked)
{
this.Row = row;
this.Index = Index;