예제 #1
0
        /// <summary>
        /// Start various tasks
        /// </summary>
        /// <param name="manager">
        /// </param>
        public void Start([NotNull] ITaskModuleManager manager)
        {
            CodeContracts.ArgumentNotNull(manager, "manager");

            this.Culture = "US";

            manager.StartTask(_taskName, () => this);
        }
예제 #2
0
        /// <summary>
        /// The start.
        /// </summary>
        /// <param name="taskModuleManager">
        /// The task module manager.
        /// </param>
        /// <param name="createTask">
        /// The create task.
        /// </param>
        /// <typeparam name="T">
        /// </typeparam>
        /// <returns>
        /// The start.
        /// </returns>
        public static bool Start <T>([NotNull] this ITaskModuleManager taskModuleManager, [NotNull] Func <T> createTask) where T : IBackgroundTask
        {
            CodeContracts.VerifyNotNull(taskModuleManager, "taskModuleManager");
            CodeContracts.VerifyNotNull(createTask, "createTask");

            string taskName = typeof(T).ToString();

            return(taskModuleManager.StartTask(taskName, () => createTask()));
        }