コード例 #1
0
        /// <summary>
        /// Starts the new.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="apartmentState">State of the apartment.</param>
        /// <returns></returns>
        public IWorker StartNew(Action target, ApartmentState apartmentState = ApartmentState.MTA)
        {
            var worker = new ThreadedWorker(target, logger, apartmentState);

            TrackWorker(worker);
            worker.Execute();
            return(worker);
        }
コード例 #2
0
        /// <summary>
        /// Starts the new.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="apartmentState">State of the apartment.</param>
        /// <param name="isBackgroundThread">Specifies whether or not the thread should be marked as a Background Thread</param>
        /// <returns></returns>
        public IWorker StartNew(Action target, ApartmentState apartmentState = ApartmentState.MTA, bool isBackgroundThread = true)
        {
            var worker = new ThreadedWorker(target, logger, apartmentState, isBackgroundThread);

            TrackWorker(worker);
            worker.Execute();
            return(worker);
        }