Добавьте файлы проекта.
This commit is contained in:
35
Demo/Pages/InlinePage.cs
Normal file
35
Demo/Pages/InlinePage.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using BotPages.Core;
|
||||
|
||||
namespace Demo.Pages
|
||||
{
|
||||
public sealed class InlinePage : Page
|
||||
{
|
||||
public override string Id => nameof(InlinePage);
|
||||
|
||||
public override Task<PageResult> EnterAsync(UpdateContext ctx, CancellationToken ct)
|
||||
{
|
||||
var actions = new[]
|
||||
{
|
||||
new PageAction { Label = "⬅️ Назад", Value = "back", Placement = ActionPlacement.Inline, Row = 0 }
|
||||
};
|
||||
|
||||
return Task.FromResult(
|
||||
PageResultBuilder.Empty()
|
||||
.WithText("Это страница с Inline‑кнопками.")
|
||||
.WithKeyboard(actions)
|
||||
.Build()
|
||||
);
|
||||
}
|
||||
|
||||
public override Task<PageResult> HandleAsync(UpdateContext ctx, CancellationToken ct)
|
||||
{
|
||||
if (ctx.Text == "back")
|
||||
return Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(MainPage)).Build());
|
||||
|
||||
return Task.FromResult(PageResultBuilder.Empty().WithText("Нажмите кнопку 'Назад'.").Build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user