eg. BotBase bb = new BotBase(api, new LambdaStartFormFactory(
() => new Start(posible, parameters)
));
22 lines
485 B
C#
22 lines
485 B
C#
using TelegramBotBase.Form;
|
|
using TelegramBotBase.Interfaces;
|
|
|
|
namespace TelegramBotBase.Base
|
|
{
|
|
public class LambdaStartFormFactory : IStartFormFactory
|
|
{
|
|
public delegate FormBase CreateFormDelegate();
|
|
|
|
private readonly CreateFormDelegate _lambda;
|
|
|
|
public LambdaStartFormFactory(CreateFormDelegate lambda)
|
|
{
|
|
_lambda = lambda;
|
|
}
|
|
|
|
public FormBase CreateForm()
|
|
{
|
|
return _lambda();
|
|
}
|
|
}
|
|
} |