diff --git a/TelegramBotBase/Base/ControlBase.cs b/TelegramBotBase/Base/ControlBase.cs index 6452ba9..43af947 100644 --- a/TelegramBotBase/Base/ControlBase.cs +++ b/TelegramBotBase/Base/ControlBase.cs @@ -28,6 +28,14 @@ namespace TelegramBotBase.Base /// public bool Enabled { get; set; } = true; + /// + /// Get invoked when control will be added to a form and invoked. + /// + /// + public virtual void Init() + { + + } public virtual async Task Load(MessageResult result) { diff --git a/TelegramBotBase/Base/FormBase.cs b/TelegramBotBase/Base/FormBase.cs index 75fdb20..16d3bde 100644 --- a/TelegramBotBase/Base/FormBase.cs +++ b/TelegramBotBase/Base/FormBase.cs @@ -394,6 +394,8 @@ namespace TelegramBotBase.Form control.ID = this.Controls.Count + 1; control.Device = this.Device; this.Controls.Add(control); + + control.Init(); } ///