/// <summary> /// Creates a user report. /// </summary> /// <param name="callback">The callback. Provides the user report that was created.</param> public void CreateUserReport(Action <UserReport> callback) { this.LogEvent(UserReportEventLevel.Info, "Creating user report."); this.WaitForPerforation(this.screenshotsTaken, () => { this.Platform.RunTask(() => { // Start Stopwatch Stopwatch stopwatch = Stopwatch.StartNew(); // Copy Data UserReport userReport = new UserReport(); userReport.ProjectIdentifier = this.ProjectIdentifier; // Device Metadata lock (this.deviceMetadata) { userReport.DeviceMetadata = this.deviceMetadata.ToList(); } // Events lock (this.events) { userReport.Events = this.events.ToList(); } // Measures lock (this.measures) { userReport.Measures = this.measures.ToList(); } // Screenshots lock (this.screenshots) { userReport.Screenshots = this.screenshots.ToList(); } // Complete userReport.Complete(); // Modify this.Platform.ModifyUserReport(userReport); // Stop Stopwatch stopwatch.Stop(); // Sample Client Metric this.SampleClientMetric("UserReportingClient.CreateUserReport.Task", stopwatch.ElapsedMilliseconds); // Copy Client Metrics foreach (KeyValuePair <string, UserReportMetric> kvp in this.clientMetrics) { userReport.ClientMetrics.Add(kvp.Value); } // Return return(userReport); }, (result) => { callback(result as UserReport); }); }); }