/// <summary> /// Invoke callbacks /// </summary> /// <param name="dto">Report to be uploaded.</param> /// <returns><c>false</c> if any of the callbacks return <c>false</c>; otherwise <c>true</c></returns> /// <remarks> /// <para> /// All callbacks will be invoked, even if one of them returns <c>false</c>. /// </para> /// </remarks> public bool CanUploadReport(ErrorReportDTO dto) { var ctx = new ReportFilterContext(dto); var canUpload = true; foreach (var callback in _filters) { callback.Invoke(ctx); if (!ctx.CanSubmitReport) { canUpload = false; } } return(canUpload); }
/// <summary> /// Invoke callbacks /// </summary> /// <param name="dto">Report to be uploaded.</param> /// <returns><c>false</c> if any of the callbacks return <c>false</c>; otherwise <c>true</c></returns> /// <exception cref="ArgumentNullException">dto</exception> /// <remarks> /// <para> /// All callbacks will be invoked, even if one of them returns <c>false</c>. /// </para> /// </remarks> public bool CanUploadReport(ErrorReportDTO dto) { if (dto == null) { throw new ArgumentNullException(nameof(dto)); } var ctx = new ReportFilterContext(dto); var canUpload = true; foreach (var callback in _filters) { callback.Invoke(ctx); if (!ctx.CanSubmitReport) { canUpload = false; } } return(canUpload); }