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
@@ -32,6 +32,7 @@ namespace TelegramBotBaseTest.Tests.Controls
m_Buttons.EnablePaging = true;
m_Buttons.HeadLayoutButtonRow = new List<ButtonBase>() { new ButtonBase("Back", "back") };
var countries = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
@@ -45,7 +46,9 @@ namespace TelegramBotBaseTest.Tests.Controls
m_Buttons.Tags = countries.Select(a => a.Parent.EnglishName).Distinct().OrderBy(a => a).ToList();
m_Buttons.SelectedTags = countries.Select(a => a.Parent.EnglishName).Distinct().OrderBy(a => a).ToList();
m_Buttons.ButtonsForm = bf;
m_Buttons.EnableCheckAllTools = true;
m_Buttons.DataSource = new TelegramBotBase.Datasources.ButtonFormDataSource(bf);
m_Buttons.ButtonClicked += Bg_ButtonClicked;
@@ -57,11 +60,13 @@ namespace TelegramBotBaseTest.Tests.Controls
if (e.Button == null)
return;
if (e.Button.Value == "back")
switch (e.Button.Value)
{
var start = new Menu();
await this.NavigateTo(start);
return;
case "back":
var start = new Menu();
await this.NavigateTo(start);
return;
}