This repository has been archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.xaml.cs
104 lines (95 loc) · 3.77 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using Citrus.Interactions;
using Microsoft.Practices.Unity;
using PrismAdapter;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
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.Media.Animation;
using Windows.UI.Xaml.Navigation;
// 空のアプリケーション テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234227 を参照してください
namespace Sample
{
/// <summary>
/// 既定の Application クラスに対してアプリケーション独自の動作を実装します。
/// </summary>
public sealed partial class App : Application
{
#if WINDOWS_PHONE_APP
private TransitionCollection transitions;
#endif
private readonly UnityContainer container = new UnityContainer();
/// <summary>
/// 単一アプリケーション オブジェクトを初期化します。これは、実行される作成したコードの
/// 最初の行であり、main() または WinMain() と論理的に等価です。
/// </summary>
public App()
{
this.InitializeComponent();
}
/// <summary>
/// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、
/// アプリケーションが特定のファイルを開くために呼び出されたときに
/// 検索結果やその他の情報を表示するために使用されます。
/// </summary>
/// <param name="e">起動要求とプロセスの詳細を表示します。</param>
protected async override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
// Create bootstrapper.
var boot = new PrismAdapterBootstrapper
{
// customize resolve process.
Resolve = type => this.container.Resolve(type)
};
// setup and run application.
await boot.Setup(e);
// register instances and types.
boot.RegistPrismInstanceTo(this.container)
.Run(nav => nav.Navigate("Main", e.Arguments));
}
#if WINDOWS_PHONE_APP
/// <summary>
/// アプリを起動した後のコンテンツの移行を復元します。
/// </summary>
/// <param name="sender">ハンドラーがアタッチされたオブジェクト。</param>
/// <param name="e">ナビゲーション イベントの詳細。</param>
private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
{
var rootFrame = sender as Frame;
if (rootFrame != null)
{
rootFrame.ContentTransitions =
this.transitions
?? (this.transitions = new TransitionCollection { new NavigationThemeTransition() });
rootFrame.Navigated -= this.RootFrame_FirstNavigated;
}
}
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
var e = args as IContinuationActivatedEventArgs;
if (e != null)
{
ContinuationManager.Current.Continue(e);
}
}
#endif
}
}