FlorianDahn 4f1eae543d - adding Delete Options for Both sides to AutoCleanForm
- general Performance improvements
- Adding MessageReceived Event to DeviceSession, will be called before "message loop"
- AutoCleanForm optimized and clean process added to public function MessageCleanup (so you could call on your own)
- IsGroup for DeviceSession fixed to correct test
- IsChannel added to DeviceSession

Examples:
- SimpleForm (#1) derived now from AutoCleanForm to show deletion mode for both sides
2019-05-04 16:32:48 +02:00

75 lines
1.4 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 TelegramBaseTest.Tests
{
public class TestForm : FormBase
{
String LastMessage { get; set; }
public override async Task Opened()
{
await this.Device.Send("Welcome to Form 1");
}
public override async Task Closed()
{
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);
}
}
}
}