protected async override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { _repository = new SnippetRepository(); try { if (navigationParameter != null) { var snippetFile = navigationParameter as string; if (string.IsNullOrEmpty(snippetFile)) { throw new ArgumentException(); } // Lookup the full detail of the selected snippet: _snippet = await _repository.GetSnippetInfoAsync(snippetFile); if (_snippet == null) { throw new ArgumentException(); } // Set the WebView's source to be the html version of the snippet webView.Source = new Uri("ms-appx-web:///Snippets/" + _snippet.SnippetFile + ".html"); // Register for DataRequested events (Share contract) DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested; _registeredforShare = true; // Read the plain-text version of the snippet... await GetSnippetText(); } } catch { webView.Source = new Uri("ms-appx-web:///Snippets/error.html"); } }