Adding basic example for different types of ConfirmAction
This commit is contained in:
parent
f021f12486
commit
ef8ca3c988
@ -200,6 +200,13 @@ namespace TelegramBotBaseTest.Tests
|
||||
|
||||
break;
|
||||
|
||||
case "notifications":
|
||||
|
||||
var not = new Notifications.Start();
|
||||
await NavigateTo(not);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
message.Handled = false;
|
||||
@ -247,6 +254,8 @@ namespace TelegramBotBaseTest.Tests
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("#18 Dynamic ButtonGrid (DataSources)", new CallbackData("a", "dynamicbuttongrid").Serialize()));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("#19 Notifications", new CallbackData("a", "notifications").Serialize()));
|
||||
|
||||
await this.Device.Send("Choose your test:", btn);
|
||||
}
|
||||
|
||||
|
||||
63
TelegramBotBaseTest/Tests/Notifications/Start.cs
Normal file
63
TelegramBotBaseTest/Tests/Notifications/Start.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TelegramBotBase.Base;
|
||||
using TelegramBotBase.Form;
|
||||
|
||||
namespace TelegramBotBaseTest.Tests.Notifications
|
||||
{
|
||||
public class Start : AutoCleanForm
|
||||
{
|
||||
bool sent = false;
|
||||
|
||||
public Start()
|
||||
{
|
||||
this.DeleteMode = TelegramBotBase.Enums.eDeleteMode.OnLeavingForm;
|
||||
}
|
||||
|
||||
public override async Task Action(MessageResult message)
|
||||
{
|
||||
if (message.Handled)
|
||||
return;
|
||||
|
||||
switch (message.RawData)
|
||||
{
|
||||
case "alert":
|
||||
|
||||
await message.ConfirmAction("This is an alert.", true);
|
||||
|
||||
break;
|
||||
case "back":
|
||||
|
||||
var mn = new Menu();
|
||||
await NavigateTo(mn);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
await message.ConfirmAction("This is feedback");
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override async Task Render(MessageResult message)
|
||||
{
|
||||
if (sent)
|
||||
return;
|
||||
|
||||
var bf = new ButtonForm();
|
||||
bf.AddButtonRow("Normal feeback", "normal");
|
||||
bf.AddButtonRow("Alert Box", "alert");
|
||||
bf.AddButtonRow("Back", "back");
|
||||
|
||||
await Device.Send("Choose your test", bf);
|
||||
|
||||
sent = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user