private async Task LoadImplAsync(IProgress <string> progress, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); await Task.Delay(2000); cancellationToken.ThrowIfCancellationRequested(); var provider = new ReportDataProvider(); progress.Report($"Kampfdaten für {BossName} werden geladen."); var reportData = await provider.GetReportDataAsync(ReportId); var matchingFights = reportData.fights.Where(d => d.name.ToUpper() == BossName.ToUpper()).ToList(); progress.Report($"{matchingFights.Count} Kämpfe gefunden."); await Task.Delay(1000); cancellationToken.ThrowIfCancellationRequested(); var templates = Configuration.Templates.ToList(); progress.Report($"{templates.Count} Auswertungsfelder gefunden."); await Task.Delay(1000); Dictionary <string, object> tokenValueByPlayer = new Dictionary <string, object>(); Dictionary <string, DynamicGridCell> cellByPlayer = new Dictionary <string, DynamicGridCell>(); var players = new HashSet <string>(reportData.friendlies.Select(s => s.name)); foreach (var player in players) { var playerCell = new DynamicGridCell(); playerCell["Spieler"] = player; cellByPlayer.Add(player, playerCell); } foreach (var template in templates) { tokenValueByPlayer.Clear(); cancellationToken.ThrowIfCancellationRequested(); var parser = ParserFactory.GetParser(template.ParserTypeName); parser.SetTemplate(template.Template); // var warcraftLogsContentParser = new GenericDamageTakenParser(); // await warcraftLogsContentParser.GetResultsAsync(new FightContextData()); // parser = warcraftLogsContentParser; foreach (var fight in matchingFights) { cancellationToken.ThrowIfCancellationRequested(); var fightContext = new FightContextData() { Fight = fight, ReportId = ReportId }; await parser.ApplyResultMappingAsync(cancellationToken, fightContext, tokenValueByPlayer, template.FieldWildcard); } foreach (var playerWithTokenValue in tokenValueByPlayer) { cancellationToken.ThrowIfCancellationRequested(); DynamicGridCell cell; if (cellByPlayer.TryGetValue(playerWithTokenValue.Key, out cell)) { cell[template.FieldWildcard] = playerWithTokenValue.Value; } } } var cells = new List <KeyValuePair <string, DynamicGridCell> >(); foreach (var cell in cellByPlayer) { cells.Add(cell); } await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => ResultData.AddRange(cells.Select(s => s.Value)))); }