2012-04-10 22 views
1

私はWp7アプリケーションで作業しています。私はuriMapperを使用して、条件に応じて開始ページにユーザを誘導しています。UriMapperが動作しない

、条件が、彼が登録されている場合

彼が直接ので、これを解決するために、彼は登録していないならば、彼は

をmypage1.xamlに行くべき をmypage2.xamlに行くべきであるということです私はUriMapperを使用in app.xaml

<uriMapper:UriMapper x:Name="mapper"> 
     <uriMapper:UriMapping Uri="/InermediatePage.xaml" /> 
    </uriMapper:UriMapper> 

InermediatePage.xamlは何もしない中間ページです。

そして、私のコードは、app.xaml.csのコンストラクタで LoadActivePage()です。

private void LoadActivePage() 
    { 
     UriMapper mapper = Resources["mapper"] as UriMapper; 
     RootFrame.UriMapper = mapper; 

     if(ifNotRegistered) 
     { 
      mapper.UriMappings[0].MappedUri= new Uri("/mypage1.xaml",UriKind.Relative); 
     } 
     else 
     { 
      mapper.UriMappings[0].MappedUri= new Uri("/mypage2.xaml",UriKind.Relative); 
     } 
    } 

ここで問題は、私がデバッグ..それはうまく動作します。

しかし、私のアプリは廃棄し、エミュレータやデバイス でアプリを再起動したときには、Inermediatepage.xaml 示し代わりmypage1.xamlまたはmypage2.xaml

答えて

1

を示すのアプリで活性化イベントを見てきました。 xaml.cs?このイベントハンドラにコードを追加する必要があります。