2012-04-20 14 views
-1

私のアプリに4ページあります。それらがAcs.xaml、MainPage.xaml、Home.xaml、Weather.xamlであると仮定します(認証機能を実行するためにアクセス制御サービス(ACS)を使用しています)。Windows Phone 7ループナビゲーション

認証後ACSリダイレクトMe MainPage.xmlとMainPage.xamlには2つのボタンがあり、そのうちの1つはHomeに、もう1つはWeatherに移動します。

今、私がホームにいるとき、別のボタンで天気予報に連れて行きます。同様に、私が天気にいるとき、私はボタンをホームに持っていきたいと思います(Home.xamlとWeather.xamlではChartを使用しています)、データ視覚化ツールキット[Silverlight]を使用したグラフ

I 'Have Gone windowsteamblog(Circular Navigation)を使っても、何もうまくいきません... MainPage.xamlに到達してボタンをクリックすると、ナビゲーションに失敗したようなエラーが表示されますが、私はパノラマも試してみましたが、問題を解決することはできません。

LoginPageCode: -

namespace PhoneApp1.Pages 
{ 
using System; 
using System.Windows; 
using System.Windows.Navigation; 
using Microsoft.Phone.Controls; 
using Microsoft.WindowsAzure.Samples.Phone.Identity.AccessControl 



public partial class LoginPage : PhoneApplicationPage 
{ 
    private readonly SimpleWebTokenStore swtStore = Application.Current.Resources["swtStore"] as SimpleWebTokenStore; 

    public LoginPage() 
    { 
     this.InitializeComponent(); 


     this.PageTransitionReset.Begin(); 
     this.SignInControl.RequestSimpleWebTokenResponseCompleted += 
      (s, e) => 
      { 
       // The ACS token was successfully received and stored in the "swtStore" application resource. 
       // TODO: Navigate to your main page i.e.: 
       this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); 
      }; 
    } 

    protected override void OnNavigatedTo(NavigationEventArgs e) 
    { 
     if ((e.NavigationMode == NavigationMode.New) && this.swtStore.IsValid()) 
     { 
      // There is a valid ACS token already in the "swtStore" application resource. 
      // TODO: Navigate to your main page i.e.: 
      this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); 
     } 
     else 
     { 
      // There is not a valid ACS token in the "swtStore" application resource. 
      // The token may be expired or it is the first time the user logs in. 
      this.PageTransitionIn.Begin(); 
      this.SignInControl.GetSimpleWebToken(); 
     } 
    } 

    protected override void OnNavigatedFrom(NavigationEventArgs e) 
    { 
     this.PageTransitionReset.Begin(); 
    } 
} 

} `

メインページコード:

using System; 
using System.Collections.Generic; 

using System.Linq; 
using System.Net; 
using System.Windows; 

using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using Microsoft.Phone.Controls; 


using System.Windows.Controls.DataVisualization.Charting; 

namespace Chart 
{ 

public partial class MainPage : PhoneApplicationPage 
{ 


// Constructor 
     public MainPage() 
     { 




InitializeComponent(); 

    } 

    private void button1_Click(object sender, RoutedEventArgs e) 
    { 
     this.NavigationService.Navigate(new System.Uri(@"/Home.xaml", UriKind.RelativeOrAbsolute)); 
    } 

    private void button2_Click(object sender, RoutedEventArgs e) 
    { 
     this.NavigationService.Navigate(new System.Uri(@"/Weather.xaml", UriKind.RelativeOrAbsolute)); 
    } 
} 
}` 
+0

そこに質問がありますか? – scottheckel

+0

@Ashutosh人々があなたの質問を終わらせるのを防ぐために、私はそれを私の理解の最高に言い換えました。私があなたの意味を忘れてしまった場合は、申し訳ありませんが、もう一度編集してください。 –

答えて

2

私が正しくあなたを理解していれば、あなたが可能Panorama controlを使用したほうが良いだろうと同じように、それが聞こえますユーザーがボタンを押して別の画面に移動させるのではなく、画面を循環させることができます。

ボタンで絶対にデッドに設定されている場合は、NavigationServiceを使用して別のページにアクセスしてください。

NavigationService.Navigate(new Uri("/Weather.xaml", UriKind.Relative)); 

戻って、彼らは直感的に自分のデバイス上の[戻る]ボタンを押すだろうが、あなたはカスタムボタンを提供する上で死んでセットしている場合は、再度、あなたはプログラムで逆方向に移動することができます。最初のSDKのリリース後、Microsoftが出てくるかもしれません実現何か、そしてそれのためのレシピをリリース -

NavigationService.GoBack(); 
関連する問題