- adding Hidden method to ControlBase which will be called on leaving form or on opening a modal one

This commit is contained in:
FlorianDahn 2020-03-25 12:27:01 +07:00
parent 5126074419
commit d5a9a5f7a4
2 changed files with 23 additions and 0 deletions

View File

@ -51,6 +51,12 @@ namespace TelegramBotBase.Base
}
public virtual async Task Hidden(bool FormClose)
{
}
public virtual async Task Cleanup()

View File

@ -290,6 +290,15 @@ namespace TelegramBotBase.Form
newForm.Client = this.Client;
newForm.Device = ds;
//Notify prior to close
foreach (var b in this.Controls)
{
if (!b.Enabled)
continue;
await b.Hidden(true);
}
this.CloseControls().Wait();
await this.OnClosed(new EventArgs());
@ -325,6 +334,14 @@ namespace TelegramBotBase.Form
await CloseModal(newForm, parentForm);
};
foreach (var b in this.Controls)
{
if (!b.Enabled)
continue;
await b.Hidden(false);
}
await newForm.OnInit(new InitEventArgs(args));
await newForm.OnOpened(new EventArgs());