From 7a7a65c3a77858642b4b7b3082d2a2f2b22187c0 Mon Sep 17 00:00:00 2001 From: FlorianDahn Date: Sat, 25 Jul 2020 15:07:36 +0200 Subject: [PATCH] Update FormBase.cs - adding RemoveAllControls method --- TelegramBotBase/Base/FormBase.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/TelegramBotBase/Base/FormBase.cs b/TelegramBotBase/Base/FormBase.cs index 4ed434f..75fdb20 100644 --- a/TelegramBotBase/Base/FormBase.cs +++ b/TelegramBotBase/Base/FormBase.cs @@ -410,6 +410,19 @@ namespace TelegramBotBase.Form this.Controls.Remove(control); } + /// + /// Removes all controls. + /// + public void RemoveAllControls() + { + foreach(var c in this.Controls) + { + c.Cleanup().Wait(); + + this.Controls.Remove(c); + } + } + /// /// Cleanup ///