RSS 피드에서 원하는 기사를 열려면 코드에 무엇을 추가해야하는지 알고 있습니까? 새로운 형태로. 나는 제목과 기사의 내용을 가야 새로운 형태의에서 RSS 피드의 기사를 새 양식으로 여는 방법은 무엇입니까?
는 이미지는 선택 사항이며 여기에내 코드는 기사의 목록입니다 어디 :
private void ls_text_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
ListBox listBox = sender as ListBox;
if (listBox != null && listBox.SelectedItem != null)
{
SyndicationItem sItem = (SyndicationItem)listBox.SelectedItem;
if (sItem.Links.Count > 0)
{
if (listBox != null && listBox.SelectedItem != null)
{
SyndicationItem sItem = (SyndicationItem)listBox.SelectedItem;
PhoneApplicationService.Current.State["myItem"] = sItem;
NavigationService.Navigate(new Uri("/Clanak.xaml",UriKind.Relative));// leads to article form
}
}
}
catch (Exception f)
{
MessageBox.Show(f.Message, "", MessageBoxButton.OK);
}
}
내가 작성했습니다 대부분의 직업을 수행하는 코드 :
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
try
{
SyndicationItem sItem = PhoneApplicationService.Current.State["myItem"] as SyndicationItem;
PageTitle.Text = sItem.Title.Text; //Title would go in the pagetitle of the form , Title shows fine
PageTitle.FontSize = 40;
//tb_Content.Text = sItem.Summary.Text; //all goes fine
foreach (SyndicationItem item in sItem.SourceFeed.Items)
{
foreach (SyndicationElementExtension ext in item.ElementExtensions)
{
if (ext.GetObject<XElement>().Name.LocalName == "encoded")
tb_Content.Text = ext.GetObject<XElement>().Value; //textblock for content, throws NullReferenceException
}
}
}
catch (Exception f)
{
MessageBox.Show(f.Message, "Error clanak", MessageBoxButton.OK);
}
}
콘텐츠가 인식되지 않아 NullReferenment 언제나 TextBlock에 대한 요약을 링크했을 때 기사의 날짜가 훌륭하게 표시되었습니다. 또한 모든 기사가 나열된 목록에 goback 할 때마다 "OnNavigatedTo와"OnNavigatedFrom 사이에서만 상태를 사용할 수 있습니다. "라는 오류가 나타납니다. 홈 버튼 디버거를 누르면 (앱 충돌) 나타납니다.
이
내가 무엇을 얻을 : 'System.InvalidOperationException'형식의 첫째 예외가 Microsoft.Phone.dll 'System.Security.SecurityException'형식의 첫째 예외 발생 들은 System.Runtime.Serialization 발생 .dll 'System.Reflection.TargetInvocationException'형식의 첫 번째 예외가 mscorlib.dll에서 발생했습니다. System.Runtime.Serialization.dll에서 'System.Security.SecurityException'유형의 첫 번째 예외가 발생했습니다. 스레드 ''(0xfc2037a)가 코드 0 (0x0)으로 종료되었습니다. 스레드 ''(0xe880366)이 코드 0 (0x0)으로 종료되었습니다. 스레드 ''(0xe310372)가 코드 0 (0x0)으로 종료되었습니다. 스레드 ''(0xf970392)가 코드 0 (0x0)으로 종료되었습니다. 스레드 ''(0xe470392)가 코드 0 (0x0)으로 종료되었습니다.이것은 내가 작업하고있는 피드입니다. http://www.zimo.co/feed/ 내 주요 문제는 nullref를 지나가는 방법입니다. 예외 및 콘텐츠를 얻을.
을 현재 필요에 따라 제목과 내용을 입력 : 예를 들어
제안 또는 포인터를 찾고 있습니다. 누군가가 전에 이런 걸 시도 했나요? – Goran303