2011-07-17 3 views
0

왜 작동하지 않습니까? 다른 메서드에서 OnNavigatedTo (NavigationEventArgs e)를 호출하십시오.

내가이

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) 
{ 
    base.OnNavigatedTo(e); 
    RequestAsync(new Uri(teamsite), 
     (html, exc) => { 
      if (exc == null) { 
       m_doc = new HtmlDocument(); 
       Dispatcher.BeginInvoke(() => m_doc.LoadHtml(html)); 
       xpathList.Items.Add(html); 
      } 
      else { 
       // handle exception appropriately 
      } 
     } 
    ); 
} 

public void test() 
{ 
    this.OnNavigatedTo(NavigationEventArgs e) 
} 

난 형태 public void test()

protected override void OnNavigatedTo(NavigationEventArgs e) 

로 이동할 수있는 방법이있어?

+0

이 인수

를 제공해야? 무슨 컴파일 오류가 뭐야? –

+0

정확히 * 작동하지 않는 것은 무엇입니까? – abatishchev

답변

2

메서드 호출을 메서드 선언처럼 보이게 만들 수 없습니다. 인수를 제공해야합니다. 수정 :

public void test() 
{ 
    var arg = new NavigationEventArgs(...); // Supply constructor arguments 
    // Set arg properties if necessary 
    //... 
    this.OnNavigatedTo(arg) 
} 
+0

내가 C# verry new이기 때문에 어떻게하는지 말해 줄 수 있겠습니까? –

+0

이것은 내 코드입니다. –

+3

그게 당신의 코드라고 생각하지 않습니다. 어디에서 복사 했습니까? –

1

메서드 선언과 같은 메서드 호출을 할 수 없으므로 코드가 작동하지 않아야합니다. t 가공 - 그것은 컴파일되지 않고 무엇인가 '- 당신이 시도하시기 바랍니다 작동합니다 아래에 붙여 넣은 코드

public void test() 
{ 
    var arg = new NavigationEventArgs(); 
    // Initialize the variable 
    // other necessory code ... 

    this.OnNavigatedTo(arg) 
} 
관련 문제