예제 #1
0
        /// <summary>
        ///      Executes the specified delegate in a safe fire-and-forget manner, prevent the project from
        ///      closing until it has completed.
        /// </summary>
        /// <param name="threadingService">
        ///     The <see cref="IProjectThreadingService"/> that handles the fork.
        /// </param>
        /// <param name="asyncAction">
        ///      The async delegate to invoke. It is invoked asynchronously with respect to the caller.
        /// </param>
        /// <param name="unconfiguredProject">
        ///     The unconfigured project which the delegate operates on, if applicable. Can be <see langword="null"/>.
        /// </param>
        /// <param name="faultSeverity">
        ///     Suggests to the user how severe the fault is if the delegate throws.
        /// </param>
        /// <param name="options">
        ///     Influences the environment in which the delegate is executed.
        /// </param>
        public static void RunAndForget(
            this IProjectThreadingService threadingService,
            Func <Task> asyncAction,
            UnconfiguredProject?unconfiguredProject,
            ProjectFaultSeverity faultSeverity = ProjectFaultSeverity.Recoverable,
            ForkOptions options = ForkOptions.Default)
        {
            Requires.NotNull(threadingService, nameof(threadingService));

            // If you do not pass in a project it is not legal to ask the threading service to cancel this operation on project unloading
            if (unconfiguredProject is null)
            {
                options &= ~ForkOptions.CancelOnUnload;
            }

            threadingService.Fork(asyncAction, factory: null, unconfiguredProject: unconfiguredProject, watsonReportSettings: s_defaultReportSettings, faultSeverity: faultSeverity, options: options);
        }
예제 #2
0
        /// <summary>
        ///     Executes the specified delegate in a safe fire-and-forget manner, prevent the project from
        ///     closing until it has completed.
        /// </summary>
        /// <param name="threadingService">
        ///     The <see cref="IProjectThreadingService"/> that handles the fork.
        /// </param>
        /// <param name="asyncAction">
        ///     The async delegate to invoke. It is invoked asynchronously with respect to the caller.
        /// </param>
        /// <param name="configuredProject">
        ///     The configured project which the delegate operates on, if applicable. Can be <see langword="null"/>.
        /// </param>
        /// <param name="faultSeverity">
        ///     Suggests to the user how severe the fault is if the delegate throws.
        /// </param>
        /// <param name="options">
        ///     Influences the environment in which the delegate is executed.
        /// </param>
        public static void RunAndForget(this IProjectThreadingService threadingService, Func <Task> asyncAction, ConfiguredProject configuredProject, ProjectFaultSeverity faultSeverity = ProjectFaultSeverity.Recoverable, ForkOptions options = ForkOptions.Default)
        {
            Requires.NotNull(threadingService, nameof(threadingService));

            threadingService.Fork(asyncAction, factory: null, configuredProject: configuredProject, watsonReportSettings: s_defaultReportSettings, faultSeverity: faultSeverity, options: options);
        }
 public void Fork(Func <Task> asyncAction, JoinableTaskFactory factory = null, UnconfiguredProject unconfiguredProject = null, ConfiguredProject configuredProject = null, ErrorReportSettings watsonReportSettings = null, ProjectFaultSeverity faultSeverity = ProjectFaultSeverity.Recoverable, ForkOptions options = ForkOptions.Default)
 {
     throw new NotImplementedException();
 }