public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)
{
//TODO: handle navigated article ID here when activating from a toast and retrieve from feedclient.
if (parameter != null)
{
try
{
var id = parameter.ToString();
var entry = await _client.GetNewsArticleAsync(id);
_item.Id = entry.Id;
_item.Title = entry.Title;
_item.ArticleType = entry.ArticleType;
_item.Date = entry.Date;
_item.Body = entry.Body;
_item.Url = entry.Url;
if (entry.ImageUrl == "")
{
_item.ImageUrl = "ms-appx-web:///Assets/bleh.png"; //ImageUrl can't be a non-url, so this allows nothing to display when there isn't an image.
}
else
{
_item.ImageUrl = entry.ImageUrl;
}
}
catch (Exception ex)
{
//Something is wrong with the id OR there isn't an internet connection.
//If id issue, best to navigate back to NewsPage. If no internet, display some sort of indication with ability to refresh and try to get the article again.
Debug.WriteLine(ex.Message);
this.NavigationService.Navigate(typeof(NewsPage));
throw;
}
}
//Register for share
DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
}