Adding more details on ConfirmDialog

- adding a Tag property for optional use in ArrayPromptDialog and ConfirmDialog
- adding it to the ButtonClickedEventArgs
This commit is contained in:
FlorianDahn
2021-03-29 23:50:42 +02:00
parent 8142b626b2
commit 92f12735c8
3 changed files with 20 additions and 2 deletions
+9 -1
View File
@@ -16,8 +16,16 @@ namespace TelegramBotBase.Form
[IgnoreState]
public class ArrayPromptDialog : FormBase
{
/// <summary>
/// The message the users sees.
/// </summary>
public String Message { get; set; }
/// <summary>
/// An additional optional value.
/// </summary>
public object Tag { get; set; }
public ButtonBase[][] Buttons { get; set; }
[Obsolete]
@@ -70,7 +78,7 @@ namespace TelegramBotBase.Form
return;
}
OnButtonClicked(new ButtonClickedEventArgs(button));
OnButtonClicked(new ButtonClickedEventArgs(button) { Tag = this.Tag });
FormBase fb = ButtonForms.ContainsKey(call.Value) ? ButtonForms[call.Value] : null;
+9 -1
View File
@@ -13,8 +13,16 @@ namespace TelegramBotBase.Form
[IgnoreState]
public class ConfirmDialog : ModalDialog
{
/// <summary>
/// The message the users sees.
/// </summary>
public String Message { get; set; }
/// <summary>
/// An additional optional value.
/// </summary>
public object Tag { get; set; }
/// <summary>
/// Automatically close form on button click
/// </summary>
@@ -77,7 +85,7 @@ namespace TelegramBotBase.Form
return;
}
OnButtonClicked(new ButtonClickedEventArgs(button));
OnButtonClicked(new ButtonClickedEventArgs(button) { Tag = this.Tag });
if (AutoCloseOnClick)
await CloseForm();