di and serialization support
build nuget workflow for TelegramBotBase project / Build-TelegramBotBase (x64, linux) (push) Successful in 37s

This commit is contained in:
Максим Човнюк
2024-12-06 16:13:46 +05:00
parent 0931147f5a
commit 6a80ec66ad
3 changed files with 16 additions and 5 deletions
@@ -23,13 +23,15 @@ public class ServiceProviderStartFormFactory : IStartFormFactory
_serviceProvider = serviceProvider;
}
public FormBase CreateForm()
public FormBase CreateForm() => CreateForm(null);
public FormBase CreateForm(Type? specifiedStartFrom = null)
{
FormBase fb = null;
try
{
fb = (FormBase)ActivatorUtilities.CreateInstance(_serviceProvider, _startFormClass);
fb = (FormBase)ActivatorUtilities.CreateInstance(_serviceProvider, specifiedStartFrom ?? _startFormClass);
}
catch(InvalidOperationException ex)
{