-1

アプリに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));
    }
}
}`
4

2 に答える 2

2

私があなたを正しく理解していれば、ユーザーがボタンを押して画面を切り替えるよりも、画面を循環できるPanoramaコントロールを使用した方がよいように思えます。

ボタンに完全に固執している場合は、ボタンを押したときに を使用しNavigationServiceて別のページに移動します。

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

戻るには、デバイスの [戻る] ボタンを直感的に押しますが、カスタム ボタンを提供することに固執している場合は、プログラムで逆方向に移動できます。

NavigationService.GoBack();
于 2012-04-20T21:21:28.343 に答える
1

非線形のナビゲーション サイクルについて説明しているように思えます。最初の SDK のリリース後に Microsoft が実現する可能性があることを認識し、そのレシピをリリースしました。Windows Phone チームのブログで、Windows Phone Silverlight アプリケーションでの円形ナビゲーションの解決に関するブログ記事を見つけることができます。これはRecipe: Non-Linear Navigation Service for Windows Phone 7にリンクしており、サンプル コードをダウンロードできます。

于 2012-04-21T01:03:20.453 に答える