コメント |
@DIV
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_ListBox
{
//クラス
sealed partial class App : Application
{
// 簡単に参照可能なように、static で定義
public static ListMain listMain = null;
public static ListMain listChild = null;
public static MainPage mainPage = null;
//コンストラクタ
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
// プログラム全体で共有する構造体の定義( Navigate の引数用 )
public struct MyParam
{
public string title;
public int type;
}
// ルートフレームの作成
public Frame rootFrame = Window.Current.Content as Frame;
// *************************************************
// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます
// *************************************************
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
// Navigate の引数作成
MyParam NavigateArgs = new MyParam() { title = "アプリケーション開始", type = 0 };
// ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、
// ウィンドウがアクティブであることだけを確認してください
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), NavigateArgs))
{
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();
}
}
}
@END |