Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PathService"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="directPather">The direct pather.</param>
        /// <param name="threadFactory">The thread factory.</param>
        /// <param name="useThreadPoolForAsync">if set to <c>true</c> the thread pool will be used for async operation.</param>
        public PathService(IPathingEngine engine, IDirectPather directPather, IThreadFactory threadFactory, bool useThreadPoolForAsync)
        {
            Ensure.ArgumentNotNull(engine, "engine");
            Ensure.ArgumentNotNull(directPather, "directPather");
            Ensure.ArgumentNotNull(threadFactory, "threadFactory");

            _stopwatch    = new Stopwatch();
            _queue        = new PriorityQueueFifo <IPathRequest>(StartQueueSize, QueueType.Max);
            _engine       = engine;
            _directPather = directPather;

            _threadPoolSupported = useThreadPoolForAsync;

#if !NETFX_CORE
            _threadFactory = threadFactory;
#endif
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PathService"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="directPather">The direct pather.</param>
        /// <param name="threadFactory">The thread factory.</param>
        /// <param name="useThreadPoolForAsync">if set to <c>true</c> the thread pool will be used for async operation.</param>
        public PathService(IPathingEngine engine, IDirectPather directPather, IThreadFactory threadFactory, bool useThreadPoolForAsync)
        {
            Ensure.ArgumentNotNull(engine, "engine");
            Ensure.ArgumentNotNull(directPather, "directPather");
            Ensure.ArgumentNotNull(threadFactory, "threadFactory");

            _stopwatch = new Stopwatch();
            _queue = new PriorityQueueFifo<IPathRequest>(StartQueueSize, QueueType.Max);
            _engine = engine;
            _directPather = directPather;

            _threadPoolSupported = useThreadPoolForAsync;

            #if !NETFX_CORE
            _threadFactory = threadFactory;
            #endif
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathService"/> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="directPather">The direct pather.</param>
 /// <param name="threadFactory">The thread factory.</param>
 public PathService(IPathingEngine engine, IDirectPather directPather, IThreadFactory threadFactory)
     : this(engine, directPather, threadFactory, true)
 {
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathService"/> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="directPather">The direct pather.</param>
 /// <param name="threadFactory">The thread factory.</param>
 public PathService(IPathingEngine engine, IDirectPather directPather, IThreadFactory threadFactory)
     : this(engine, directPather, threadFactory, true)
 {
 }