Пример #1
0
        private static TestLocal InitializeCommander(ICommandCollection registrations, Action <IConsoleCommand> assert)
        {
            var memoryRx      = MemoryRx.Create();
            var loggerFactory = new LoggerFactory {
                Observers = { memoryRx }
            };

            var builder = new ContainerBuilder();

            builder
            .RegisterInstance(loggerFactory)
            .As <ILoggerFactory>();

            builder
            .RegisterInstance(assert);

            builder
            .RegisterModule(new CommanderModule(registrations));


            var container = builder.Build();
            var scope     = container.BeginLifetimeScope();

            return(new TestLocal(container, scope)
            {
                MemoryRx = memoryRx,
                Executor = scope.Resolve <ICommandLineExecutor>(),
                Assert = assert
            });
        }
Пример #2
0
 public DiscordClient(BotConfig config,
                      IRedisDatabaseProvider redisDatabaseProvider,
                      ICommandCollection commandCollection,
                      DiscordSocketClient client)
 {
     _config = config;
     _redisDatabaseProvider = redisDatabaseProvider;
     _commandCollection     = commandCollection;
     _client = client;
 }
Пример #3
0
        /// <summary>
        /// Testing constructor
        /// </summary>
        /// <param name="database"></param>
        /// <param name="factory"></param>
        /// <param name="defaultState"></param>
        /// <param name="transactionalState"></param>
        public DataSession(IDatabaseEngine database, ICommandFactory factory, IExecutionState defaultState,
                           ITransactionalExecutionState transactionalState)
        {
            _database = database;
            _factory = factory;
            _defaultState = defaultState;
            _transactionalState = transactionalState;

            _currentState = _defaultState;

            _commands = new CommandCollection(this, _factory);
            _readerSources = new ReaderSourceCollection(this, _factory);
        }
        /// <summary>
        /// Testing constructor
        /// </summary>
        /// <param name="database"></param>
        /// <param name="factory"></param>
        /// <param name="defaultState"></param>
        /// <param name="transactionalState"></param>
        public DataSession(IDatabaseEngine database, ICommandFactory factory, IExecutionState defaultState,
                           ITransactionalExecutionState transactionalState)
        {
            _database           = database;
            _factory            = factory;
            _defaultState       = defaultState;
            _transactionalState = transactionalState;

            _currentState = _defaultState;

            _commands      = new CommandCollection(this, _factory);
            _readerSources = new ReaderSourceCollection(this, _factory);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandInvokedProcessAction"/> class.
        /// </summary>
        /// <param name="localEndpoint">The endpoint ID of the local endpoint.</param>
        /// <param name="sendMessage">The action that is used to send messages.</param>
        /// <param name="availableCommands">The collection that holds all the registered commands.</param>
        /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="localEndpoint"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="sendMessage"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="availableCommands"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />.
        /// </exception>
        public CommandInvokedProcessAction(
            EndpointId localEndpoint,
            SendMessage sendMessage,
            ICommandCollection availableCommands,
            SystemDiagnostics systemDiagnostics)
        {
            {
                Lokad.Enforce.Argument(() => localEndpoint);
                Lokad.Enforce.Argument(() => sendMessage);
                Lokad.Enforce.Argument(() => availableCommands);
                Lokad.Enforce.Argument(() => systemDiagnostics);
            }

            m_Current     = localEndpoint;
            m_SendMessage = sendMessage;
            m_Commands    = availableCommands;
            m_Diagnostics = systemDiagnostics;
        }
Пример #6
0
 public CommandChangedEventArgs(ICommandCollection added, ICommandCollection removed)
 {
     this.added   = added;
     this.removed = removed;
 }
Пример #7
0
 private void RegisterCommands(IDependencyContainer dependencyContainer, ICommandCollection commands)
 {
     commands
     .Add(new CommandViewModel(FontAwesomeIcon.Cog, "Configuration", new OpenConfigurationCommand()))
     .Add(new CommandViewModel(FontAwesomeIcon.Try, "Try write to log", new TryWriteToLogCommand(dependencyContainer.Resolve <ILogFactory>())));
 }
		/// <summary>
		/// </summary>
		public CommandChangedEventArgs(ICommandCollection added, ICommandCollection removed)
		{
			this.added = added;
			this.removed = removed;
		}