アプリに4つのページがあるとしましょう。それらがAcs.xaml、MainPage.xaml、Home.xaml、およびWeather.xamlであると想定します(認証機能を実行するためにアクセス制御サービス(ACS)を使用しているため)。
認証後、ACSは私をMainPage.xmlにリダイレクトします。MainPage.xamlには2つのボタンがあり、1つはユーザーをホームに、もう1つは天気に移動します。
今、私が家にいるとき、私は彼らを天気に連れて行くための別のボタンが欲しいです。同様に、Weatherを使用しているときは、ボタンでそれらを家に持ち帰りたいです。(Home.xamlとWeather.xamlの両方で、グラフ、データ視覚化ツールキットを使用したグラフを使用しています[Silverlight)
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();
}
}
} `
MainPageコード:
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));
}
}
}`