protected override async Task LoadPayloadAsync(string payload) { _lastParseResult = AdaptiveBlock.Parse(payload); CurrentBlock = _lastParseResult?.Block; if (_lastParseResult.Block != null) { await _lastParseResult.Block.ResolveAsync(); } PreviewBlockHostViewModel updateArgs = new PreviewBlockHostViewModel() { BlockContent = _lastParseResult.Block?.View?.Content }; switch (base.Name) { case "OfficeFile.json": updateArgs.AssignApp("PowerPoint", "PowerPoint"); break; case "SkypeCallHistory.json": updateArgs.AssignApp("Skype", "Skype"); break; case "SummerRetreats.json": case "GitHubUserActivity.json": updateArgs.AssignApp("Edge", "Edge"); break; case "GoogleDocsSlide.json": updateArgs.AssignApp("Google Slides", "GoogleSlides"); break; } foreach (var preview in GetPreviews()) { try { preview.Update(_lastParseResult.Block?.View?.Content, _lastParseResult.Block, updateArgs); } catch { } } RichRendererPreviewPage.RenderNewBlock(_lastParseResult.Block); TransformedCardPreviewPage.RenderNewBlock(_lastParseResult.Block); if (_lastParseResult != null) { this.MakeErrorsLike(_lastParseResult.Errors.ToList()); } }
private void BlocksDocumentsViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(CurrentDocument): if (CurrentDocument != null) { RichRendererPreviewPage.RenderNewBlock((CurrentDocument as BlocksDocumentViewModel).LastBlockSource); TransformedCardPreviewPage.RenderNewBlock((CurrentDocument as BlocksDocumentViewModel).LastBlockSource); } break; } }