App.xaml.cs 拡張子:txtvbswsfjsphpjavahtmlutf8sjis using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; //名前空間 namespace LBOX_TwitterListView1 { //クラス sealed partial class App : Application { // 簡単に参照可能なように、static で定義 public static ListMain listMain = null; public static MainPage mainPage = null; public static NextPage nextPage = null; // ルートフレームの作成 public static Frame rootFrame = Window.Current.Content as Frame; //コンストラクタ public App() { this.InitializeComponent(); this.Suspending += OnSuspending; } // ************************************************* // アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます // ************************************************* protected override void OnLaunched(LaunchActivatedEventArgs args) { // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、 // ウィンドウがアクティブであることだけを確認してください if (rootFrame == null) { Debug.WriteLine("ルートフレームを新しく作成しました"); rootFrame = new Frame(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 以前中断したアプリケーションから状態を読み込みます。 } // フレームを現在のウィンドウに配置します Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // ************************************************* // ナビゲーション スタックが復元されていない場合、最初のページに移動します。 // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを // 構成します // ************************************************* if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } Debug.WriteLine("ルートフレームにページをロードしました"); } // 現在のウィンドウがアクティブにします Window.Current.Activate(); } // ************************************************* // アプリケーションの実行が中断されたときに呼び出されます。 // ************************************************* private void OnSuspending(object sender, SuspendingEventArgs e) { Debug.WriteLine("アプリケーションの実行が中断されました"); var deferral = e.SuspendingOperation.GetDeferral(); //TODO: アプリケーションの状態を保存してバックグラウンドの動作があれば停止します deferral.Complete(); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; //名前空間 namespace LBOX_TwitterListView1 { //クラス sealed partial class App : Application { // 簡単に参照可能なように、static で定義 public static ListMain listMain = null; public static MainPage mainPage = null; public static NextPage nextPage = null; // ルートフレームの作成 public static Frame rootFrame = Window.Current.Content as Frame; //コンストラクタ public App() { this.InitializeComponent(); this.Suspending += OnSuspending; } // ************************************************* // アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます // ************************************************* protected override void OnLaunched(LaunchActivatedEventArgs args) { // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、 // ウィンドウがアクティブであることだけを確認してください if (rootFrame == null) { Debug.WriteLine("ルートフレームを新しく作成しました"); rootFrame = new Frame(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 以前中断したアプリケーションから状態を読み込みます。 } // フレームを現在のウィンドウに配置します Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // ************************************************* // ナビゲーション スタックが復元されていない場合、最初のページに移動します。 // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを // 構成します // ************************************************* if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } Debug.WriteLine("ルートフレームにページをロードしました"); } // 現在のウィンドウがアクティブにします Window.Current.Activate(); } // ************************************************* // アプリケーションの実行が中断されたときに呼び出されます。 // ************************************************* private void OnSuspending(object sender, SuspendingEventArgs e) { Debug.WriteLine("アプリケーションの実行が中断されました"); var deferral = e.SuspendingOperation.GetDeferral(); //TODO: アプリケーションの状態を保存してバックグラウンドの動作があれば停止します deferral.Complete(); } } }
MainPage.xaml.cs 拡張子:txtvbswsfjsphpjavahtmlutf8sjis // ************************************************* // 次ページ // ************************************************* private void NextpageButton_Click(object sender, RoutedEventArgs e) { // 最初の次ページへの移動 if (App.nextPage == null) { App.rootFrame.Navigate(typeof(NextPage)); } // 2回目以降の次ページへの移動 else { App.rootFrame.Content = App.nextPage; } }
// ************************************************* // 次ページ // ************************************************* private void NextpageButton_Click(object sender, RoutedEventArgs e) { // 最初の次ページへの移動 if (App.nextPage == null) { App.rootFrame.Navigate(typeof(NextPage)); } // 2回目以降の次ページへの移動 else { App.rootFrame.Content = App.nextPage; } }
コンストラクタ 拡張子:txtvbswsfjsphpjavahtmlutf8sjis public NextPage() { this.InitializeComponent(); // このページの保存 App.nextPage = this; } 戻る処理 拡張子:txtvbswsfjsphpjavahtmlutf8sjis App.rootFrame.Content = App.mainPage;
public NextPage() { this.InitializeComponent(); // このページの保存 App.nextPage = this; }
App.rootFrame.Content = App.mainPage;
MainPage.xaml.cs 拡張子:txtvbswsfjsphpjavahtmlutf8sjis App.mainPage = this;
App.mainPage = this;