IgnoreState and SaveState addings for better session serialization

- adding IgnoreState to all ModalDialogs to prevent them get saved.
- adding SaveState to AutoCleanForm to keep state
- change OldMessages property of AutoCleanForm to public
This commit is contained in:
FlorianDahn 2020-05-07 23:49:08 +02:00
parent 9314b4c0e5
commit 47876681e0
5 changed files with 13 additions and 3 deletions

View File

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Attributes;
using TelegramBotBase.Base;
namespace TelegramBotBase.Form
@ -11,6 +12,7 @@ namespace TelegramBotBase.Form
/// <summary>
/// A simple prompt dialog with one ok Button
/// </summary>
[IgnoreState]
public class AlertDialog : ConfirmDialog
{
public String ButtonText { get; set; }

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Args;
using TelegramBotBase.Attributes;
using TelegramBotBase.Base;
namespace TelegramBotBase.Form
@ -12,11 +13,11 @@ namespace TelegramBotBase.Form
/// <summary>
/// A prompt with a lot of buttons
/// </summary>
[IgnoreState]
public class ArrayPromptDialog : FormBase
{
public String Message { get; set; }
public ButtonBase[][] Buttons { get; set; }
[Obsolete]

View File

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
using TelegramBotBase.Args;
using TelegramBotBase.Attributes;
using TelegramBotBase.Base;
using TelegramBotBase.Enums;
@ -15,10 +16,13 @@ namespace TelegramBotBase.Form
/// </summary>
public class AutoCleanForm : FormBase
{
List<Message> OldMessages { get; set; }
[SaveState]
public List<Message> OldMessages { get; set; }
[SaveState]
public eDeleteMode DeleteMode { get; set; }
[SaveState]
public eDeleteSide DeleteSide { get; set; }

View File

@ -5,15 +5,16 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Args;
using TelegramBotBase.Attributes;
using TelegramBotBase.Base;
namespace TelegramBotBase.Form
{
[IgnoreState]
public class ConfirmDialog : ModalDialog
{
public String Message { get; set; }
public List<ButtonBase> Buttons { get; set; }
private EventHandlerList __Events { get; set; } = new EventHandlerList();

View File

@ -5,10 +5,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types.ReplyMarkups;
using TelegramBotBase.Attributes;
using TelegramBotBase.Base;
namespace TelegramBotBase.Form
{
[IgnoreState]
public class PromptDialog : ModalDialog
{
public String Message { get; set; }