FlorianDahn 376ba68e8e MAJOR CHANGE: Refactoring namespace for controls
Chaning namespace for controls depending on their use area to:

Controls.Hybrid
Controls.Inline
Controls.Reply

Updating example project as well.
2021-01-15 19:33:44 +01:00

79 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
using TelegramBotBase.Base;
using TelegramBotBase.Form;
namespace TelegramBotBaseTest.Tests
{
public class TestForm : FormBase
{
String LastMessage { get; set; }
public TestForm()
{
this.Opened += TestForm_Opened;
this.Closed += TestForm_Closed;
}
private async Task TestForm_Opened(object sender, EventArgs e)
{
await this.Device.Send("Welcome to Form 1");
}
private async Task TestForm_Closed(object sender, EventArgs e)
{
await this.Device.Send("Ciao from Form 1");
}
public override async Task Action(MessageResult message)
{
switch (message.Command)
{
case "reply":
break;
case "navigate":
var tf = new TestForm2();
await this.NavigateTo(tf);
break;
default:
if (message.RawMessageData == null)
return;
this.LastMessage = message.RawMessageData.Message.Text;
break;
}
}
public override async Task Render(MessageResult message)
{
if (message.Command == "reply")
{
await this.Device.Send("Last message: " + this.LastMessage);
}
}
}
}