Adding Init method to controls

This commit is contained in:
FlorianDahn 2021-02-20 01:39:37 +01:00
parent 0202fc29a8
commit dc8cb81284
2 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,14 @@ namespace TelegramBotBase.Base
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// Get invoked when control will be added to a form and invoked.
/// </summary>
/// <returns></returns>
public virtual void Init()
{
}
public virtual async Task Load(MessageResult result)
{

View File

@ -394,6 +394,8 @@ namespace TelegramBotBase.Form
control.ID = this.Controls.Count + 1;
control.Device = this.Device;
this.Controls.Add(control);
control.Init();
}
/// <summary>