示例#1
0
 public static void WriteNotifications <T>(this IPipeLine <T> pipeLine)
 {
     foreach (var notification in pipeLine.Notifications)
     {
         Console.WriteLine(notification);
     }
 }
 public DefaultUpdateHandler(ILogger logger,
                             IPipeLine <IMessageHandler, Message> messagePipeLine,
                             IChatManager chatManager)
     : base(logger)
 {
     _messagePipeLine = messagePipeLine;
     _chatManager     = chatManager;
     Order            = int.MinValue;
 }
        static IPipeLine CreatePipeInstance(PipeLineDefinition pipeDefinition)
        {
            var       assemly = Assembly.Load(pipeDefinition.AssemblyName);
            var       type    = assemly.GetTypes().FirstOrDefault(x => x.Name == pipeDefinition.Name);
            IPipeLine pipe    = Activator.CreateInstance(type) as IPipeLine;

            pipe.Name     = pipeDefinition.Name;
            pipe.PipeType = Enum.Parse <PipeType>(pipeDefinition.Type);
            return(pipe);
        }
 private static void LoadPipeDefinitions()
 {
     lock (lockObject)
     {
         _pipes       = _configuration.GetSection("PipeLine").Get <List <PipeLineDefinition> >();
         dicPipeLines = new ConcurrentDictionary <string, IPipeLine>();
         foreach (var item in _pipes)
         {
             IPipeLine pipe = CreatePipeInstance(item);
             dicPipeLines.TryAdd(item.Name, pipe);
         }
     }
 }
示例#5
0
        /// <inheritdoc />
        internal override void InterInitialContainer(IPipeLine flowContainer)
        {
            LineContainer = flowContainer;
            WatchProxy=flowContainer.GetWatchProxy();

            if (this.Equals(flowContainer.EndPipe))
                return;

            if (NextPipe == null)
                throw new ArgumentNullException(nameof(NextPipe),
                    $"Flow({flowContainer.PipeCode})需要有明确的EndPipe,且所有的分支路径最终需到达此EndPipe");

            NextPipe.InterInitialContainer(flowContainer);
        }
示例#6
0
 private void resetRepositories()
 {
     _userManagement     = null;
     _pipeLine           = null;
     _product            = null;
     _manageLeadAccess   = null;
     _contact            = null;
     _common             = null;
     _files              = null;
     _source             = null;
     _stageManagement    = null;
     _user               = null;
     _zone               = null;
     _advanceLeadCreator = null;
     _notes              = null;
 }
        public BotManager(
            IKernel kernel,
            IBotConfiguration config,
            IAdminChatManager adminChatManager,
            IPipeLine <IUpdateHandler, Update> updatePipeLine,
            ILogger logger,
            CommandMessageHandler commandMessageHandler)
        {
            _config                = config;
            _logger                = logger;
            _adminChatManager      = adminChatManager;
            _updatePipeLine        = updatePipeLine;
            _commandMessageHandler = commandMessageHandler;

            Telegram = string.IsNullOrEmpty(_config.Proxy.Host)
                ? new TelegramBotClient(_config.ApiToken)
                : new TelegramBotClient(_config.ApiToken, new WebProxy(_config.Proxy.Host, _config.Proxy.Port));
            _receiver = new QueuedUpdateReceiver(Telegram);
            Telegram.OnReceiveError        += Telegram_OnReceiveError;
            Telegram.OnReceiveGeneralError += Telegram_OnReceiveGeneralError;
        }
示例#8
0
        private void RegisterFilter(IPipeLine <Game> pipeline, FilterDTO filter, int page = 1, PageEnum pageSize = PageEnum.Ten)
        {
            if (filter.SelectedGenresName != null && filter.SelectedGenresName.Any())
            {
                pipeline.Register(new GenreFilter(filter.SelectedGenresName));
            }

            if (filter.MaxPrice != null)
            {
                pipeline.Register(new MaxPriceFilter(filter.MaxPrice.Value));
            }

            if (filter.MinPrice != null)
            {
                pipeline.Register(new MinPriceFilter(filter.MinPrice.Value));
            }

            if (filter.SelectedTypesName != null && filter.SelectedTypesName.Any())
            {
                pipeline.Register(new PlatformTypeFilter(filter.SelectedTypesName));
            }

            if (filter.SelectedPublishersName != null && filter.SelectedPublishersName.Any())
            {
                pipeline.Register(new PublisherFilter(filter.SelectedPublishersName));
            }

            if (filter.Name != null && filter.Name.Length >= 3)
            {
                pipeline.Register(new SearchNameFilter(filter.Name));
            }

            pipeline.Register(new DateFilter(filter.DateOfAdding))
            .Register(new FilterBy(filter.FilterBy))
            .Register(new PageFilter <Game>(page, pageSize));
        }
示例#9
0
 public Pipeline <T> Register(IPipeLine <T> pipeLine)
 {
     Filters.Add(pipeLine);
     return(this);
 }
            /// <summary>
            ///     Initializes a new instance of the <see cref="RequestingElement" /> class.
            ///     Initialisiert eine neue Instanz der <see cref="RequestingElement" /> Klasse.
            /// </summary>
            /// <param name="obj">
            ///     The obj.
            /// </param>
            /// <param name="pipline">
            ///     The pipline.
            /// </param>
            public RequestingElement([CanBeNull] DependencyObject obj, [NotNull] IPipeLine pipline)
            {
                _depObj = new FrameworkObject(obj);
                _pipline = pipline;

                _depObj.LoadedEvent += LoadedEventHandler;
            }
 public void RemovePipline(IPipeLine pipeline)
 {
     _pips.Remove(pipeline);
 }
示例#12
0
 /// <inheritdoc />
 internal override void InterInitialContainer(IPipeLine flowContainer)
 {
     base.InterInitialContainer(flowContainer);
     _startPipe.InterInitialContainer(this);
 }
示例#13
0
 public CustomApproachController(IPipeLine <CustomInput> pipeline)
 {
     this.pipeline = pipeline;
 }
示例#14
0
 void IPipeInitiator.InterInitialContainer(IPipeLine containerFlow)
 {
     InterInitialContainer(containerFlow);
 }
示例#15
0
 /// <summary>
 ///  内部处理流容器初始化赋值
 /// </summary>
 /// <param name="containerFlow"></param>
 internal abstract void InterInitialContainer(IPipeLine containerFlow);