コード例 #1
0
        public CommandsCollection(IEventsApiClient apiClient, TelegramBotService telegramService)
        {
            commands = new Dictionary <string, ICommand>();
            var types = typeof(Startup).Assembly.GetTypes()
                        .Where(type => typeof(ICommand).IsAssignableFrom(type) && !type.IsAbstract && type.IsClass);

            foreach (var type in types)
            {
                var instance = (ICommand)Activator.CreateInstance(type, apiClient, telegramService);

                var name = instance.GetType().GetProperty("CommandName").GetValue(instance).ToString();

                commands.TryAdd(name, instance);
            }
        }
コード例 #2
0
 public EventsApi(IBitmovinApiClientFactory apiClientFactory)
 {
     _apiClient = apiClientFactory.CreateClient <IEventsApiClient>();
 }
コード例 #3
0
 public GetEventsCommand(IEventsApiClient apiClient, TelegramBotService telegramService)
 {
     this.apiClient       = apiClient;
     this.telegramService = telegramService;
 }