TelegramBotFramework/TelegramBotBase/Base/LambdaStartFormFactory.cs
Victor f3167eda2c Add LambdaStartFormFactory.cs that allows pass parameters without creating factory class
eg. BotBase bb = new BotBase(api, new LambdaStartFormFactory(
    () => new Start(posible, parameters)
));
2021-10-11 14:37:15 +03:00

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();
}
}
}