Доработан менеджер состояний.
This commit is contained in:
@@ -29,7 +29,4 @@ namespace Demo.Pages
|
||||
return Task.FromResult(PageResultBuilder.Empty().WithText("Нажмите кнопку 'Назад'.").Build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace Demo.Pages
|
||||
{
|
||||
var actions = new[]
|
||||
{
|
||||
new PageAction { Label = "📌 Inline", Value = "inline", Placement = ActionPlacement.Reply, Row = 0 },
|
||||
new PageAction { Label = "⌨️ Reply", Value = "reply", Placement = ActionPlacement.Reply, Row = 1 },
|
||||
new PageAction { Label = "📂 Файлы", Value = "files", Placement = ActionPlacement.Reply, Row = 2 }
|
||||
new PageAction(MainPageButtons.Inline) { Placement = ActionPlacement.Reply, Row = 0 },
|
||||
new PageAction(MainPageButtons.Reply) { Placement = ActionPlacement.Reply, Row = 1 },
|
||||
new PageAction(MainPageButtons.Files) { Placement = ActionPlacement.Reply, Row = 2 },
|
||||
};
|
||||
|
||||
return Task.FromResult(
|
||||
@@ -25,14 +25,27 @@ namespace Demo.Pages
|
||||
|
||||
public override Task<PageResult> HandleAsync(UpdateContext ctx, CancellationToken ct)
|
||||
{
|
||||
return ctx.Text switch
|
||||
var button = ActionExtensions.FromActionLabel<MainPageButtons>(ctx.Text);
|
||||
|
||||
return button switch
|
||||
{
|
||||
"📌 Inline" => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(InlinePage)).Build()),
|
||||
"⌨️ Reply" => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(ReplyPage)).Build()),
|
||||
"📂 Файлы" => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(FilesPage)).Build()),
|
||||
MainPageButtons.Inline => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(InlinePage)).Build()),
|
||||
MainPageButtons.Reply => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(ReplyPage)).Build()),
|
||||
MainPageButtons.Files => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(FilesPage)).Build()),
|
||||
_ => Task.FromResult(PageResultBuilder.Empty().WithText("Выберите действие с кнопок.").Build())
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum MainPageButtons
|
||||
{
|
||||
[Action("📌 Inline")]
|
||||
Inline,
|
||||
|
||||
[Action("⌨️ Reply")]
|
||||
Reply,
|
||||
|
||||
[Action("📂 Файлы")]
|
||||
Files,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user