+++ /dev/null
-/*\r
- * Copyright (C) 2013 FooProject\r
- * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 3 of the License, or (at your option) any later version.\r
-\r
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of \r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-using System;\r
-using System.Collections.Generic;\r
-using System.IO;\r
-using System.Linq;\r
-using Windows.ApplicationModel;\r
-using Windows.ApplicationModel.Activation;\r
-using Windows.Foundation;\r
-using Windows.Foundation.Collections;\r
-using Windows.UI.Xaml;\r
-using Windows.UI.Xaml.Controls;\r
-using Windows.UI.Xaml.Controls.Primitives;\r
-using Windows.UI.Xaml.Data;\r
-using Windows.UI.Xaml.Input;\r
-using Windows.UI.Xaml.Media;\r
-using Windows.UI.Xaml.Navigation;\r
-using Windows.UI.ApplicationSettings;\r
-using Windows.UI.Popups;\r
-\r
-// 空のアプリケーション テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234227 を参照してください\r
-\r
-namespace Test\r
-{\r
- /// <summary>\r
- /// 既定の Application クラスを補完するアプリケーション固有の動作を提供します。\r
- /// </summary>\r
- sealed partial class App : Application\r
- {\r
- bool SettingRegistored;\r
- Popup Popup;\r
-\r
- /// <summary>\r
- /// 単一アプリケーション オブジェクトを初期化します。これは、実行される作成したコードの\r
- /// 最初の行であり、main() または WinMain() と論理的に等価です。\r
- /// </summary>\r
- public App()\r
- {\r
- this.InitializeComponent();\r
- this.Suspending += OnSuspending;\r
- }\r
-\r
- /// <summary>\r
- /// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、\r
- /// アプリケーションが特定のファイルを開くために呼び出されたときに\r
- /// 検索結果やその他の情報を表示するために使用されます。\r
- /// </summary>\r
- /// <param name="args">起動要求とプロセスの詳細を表示します。</param>\r
- protected override void OnLaunched(LaunchActivatedEventArgs args)\r
- {\r
- Frame rootFrame = Window.Current.Content as Frame;\r
-\r
- // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、\r
- // ウィンドウがアクティブであることだけを確認してください\r
- if (rootFrame == null)\r
- {\r
- // ナビゲーション コンテキストとして動作するフレームを作成し、最初のページに移動します\r
- rootFrame = new Frame();\r
-\r
- if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)\r
- {\r
- //TODO: 以前中断したアプリケーションから状態を読み込みます。\r
- }\r
-\r
- // フレームを現在のウィンドウに配置します\r
- Window.Current.Content = rootFrame;\r
- }\r
-\r
- if (rootFrame.Content == null)\r
- {\r
- // ナビゲーション スタックが復元されていない場合、最初のページに移動します。\r
- // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを\r
- // 構成します\r
- if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))\r
- {\r
- throw new Exception("Failed to create initial page");\r
- }\r
- }\r
- if (!this.SettingRegistored)\r
- {\r
- SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;\r
- this.SettingRegistored = true;\r
- }\r
- // 現在のウィンドウがアクティブであることを確認します\r
- Window.Current.Activate();\r
- }\r
-\r
- void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs)\r
- {\r
- var handler = new UICommandInvokedHandler(OnSettingsCommand);\r
-\r
- var policyCommand = new SettingsCommand("setting", "設定", handler);\r
- eventArgs.Request.ApplicationCommands.Add(policyCommand);\r
- }\r
-\r
- private void OnSettingsCommand(IUICommand command)\r
- {\r
- var settingsCommand = (SettingsCommand)command;\r
- switch (settingsCommand.Id.ToString())\r
- {\r
- case "setting":\r
- ShowSettingsFlyout();\r
- break;\r
- }\r
- }\r
-\r
- void ShowSettingsFlyout()\r
- {\r
- var flyout = new Test.SettingsFlyout1();\r
- flyout.Show();\r
- }\r
-\r
- /// <summary>\r
- /// アプリケーションの実行が中断されたときに呼び出されます。アプリケーションの状態は、\r
- /// アプリケーションが終了されるのか、メモリの内容がそのままで再開されるのか\r
- /// わからない状態で保存されます。\r
- /// </summary>\r
- /// <param name="sender">中断要求の送信元。</param>\r
- /// <param name="e">中断要求の詳細。</param>\r
- private void OnSuspending(object sender, SuspendingEventArgs e)\r
- {\r
- var deferral = e.SuspendingOperation.GetDeferral();\r
- //TODO: アプリケーションの状態を保存してバックグラウンドの動作があれば停止します\r
- deferral.Complete();\r
- }\r
- }\r
-}\r