diff --git a/TelegramBotBase/Args/PromptDialogCompletedEventArgs.cs b/TelegramBotBase/Args/PromptDialogCompletedEventArgs.cs new file mode 100644 index 0000000..14f9cf8 --- /dev/null +++ b/TelegramBotBase/Args/PromptDialogCompletedEventArgs.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace TelegramBotBase.Args +{ + public class PromptDialogCompletedEventArgs + { + public object Tag { get; set; } + + public String Value { get; set; } + + } +} diff --git a/TelegramBotBase/Form/PromptDialog.cs b/TelegramBotBase/Form/PromptDialog.cs index f2a26cd..ec9e61c 100644 --- a/TelegramBotBase/Form/PromptDialog.cs +++ b/TelegramBotBase/Form/PromptDialog.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using Telegram.Bot.Types; using Telegram.Bot.Types.ReplyMarkups; +using TelegramBotBase.Args; using TelegramBotBase.Attributes; using TelegramBotBase.Base; @@ -14,10 +15,21 @@ namespace TelegramBotBase.Form [IgnoreState] public class PromptDialog : ModalDialog { + /// + /// The message the users sees. + /// public String Message { get; set; } + /// + /// The returned text value by the user. + /// public String Value { get; set; } + /// + /// An additional optional value. + /// + public object Tag { get; set; } + private EventHandlerList __Events { get; set; } = new EventHandlerList(); private static object __evCompleted { get; } = new object(); @@ -86,13 +98,13 @@ namespace TelegramBotBase.Form message.Handled = true; - OnCompleted(new EventArgs()); + OnCompleted(new PromptDialogCompletedEventArgs() { Tag = this.Tag, Value = this.Value }); await this.CloseForm(); } - public event EventHandler Completed + public event EventHandler Completed { add { @@ -104,9 +116,9 @@ namespace TelegramBotBase.Form } } - public void OnCompleted(EventArgs e) + public void OnCompleted(PromptDialogCompletedEventArgs e) { - (this.__Events[__evCompleted] as EventHandler)?.Invoke(this, e); + (this.__Events[__evCompleted] as EventHandler)?.Invoke(this, e); } }