001.
using
System;
002.
using
System.Collections.Generic;
003.
using
System.Linq;
004.
using
System.Net;
005.
using
System.Windows;
006.
using
System.Windows.Controls;
007.
using
System.Windows.Documents;
008.
using
System.Windows.Input;
009.
using
System.Windows.Media;
010.
using
System.Windows.Media.Animation;
011.
using
System.Windows.Navigation;
012.
using
System.Windows.Shapes;
013.
using
Microsoft.Phone.Controls;
014.
using
Microsoft.Phone.Shell;
015.
016.
namespace
PhoneApp1
017.
{
018.
public
partial
class
App : Application
019.
{
020.
/// <summary>
021.
/// Phone アプリケーションのルート フレームへの容易なアクセスを提供します。
022.
/// </summary>
023.
/// <returns>Phone アプリケーションのルート フレームです。</returns>
024.
public
PhoneApplicationFrame RootFrame {
get
;
private
set
; }
025.
026.
027.
public
MainPage mainPage {
get
;
set
; }
028.
public
Page1 page1 {
get
;
set
; }
029.
030.
/// <summary>
031.
/// Application オブジェクトのコンストラクターです。
032.
/// </summary>
033.
public
App()
034.
{
035.
036.
UnhandledException += Application_UnhandledException;
037.
038.
039.
InitializeComponent();
040.
041.
042.
InitializePhoneApplication();
043.
044.
045.
if
(System.Diagnostics.Debugger.IsAttached)
046.
{
047.
048.
Application.Current.Host.Settings.EnableFrameRateCounter =
true
;
049.
050.
051.
052.
053.
054.
055.
056.
057.
058.
059.
060.
061.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
062.
}
063.
064.
}
065.
066.
067.
068.
private
void
Application_Launching(
object
sender, LaunchingEventArgs e)
069.
{
070.
}
071.
072.
073.
074.
private
void
Application_Activated(
object
sender, ActivatedEventArgs e)
075.
{
076.
}
077.
078.
079.
080.
private
void
Application_Deactivated(
object
sender, DeactivatedEventArgs e)
081.
{
082.
}
083.
084.
085.
086.
private
void
Application_Closing(
object
sender, ClosingEventArgs e)
087.
{
088.
}
089.
090.
091.
private
void
RootFrame_NavigationFailed(
object
sender, NavigationFailedEventArgs e)
092.
{
093.
if
(System.Diagnostics.Debugger.IsAttached)
094.
{
095.
096.
System.Diagnostics.Debugger.Break();
097.
}
098.
}
099.
100.
101.
private
void
Application_UnhandledException(
object
sender, ApplicationUnhandledExceptionEventArgs e)
102.
{
103.
if
(System.Diagnostics.Debugger.IsAttached)
104.
{
105.
106.
System.Diagnostics.Debugger.Break();
107.
}
108.
}
109.
110.
#region Phone アプリケーションの初期化
111.
112.
113.
private
bool
phoneApplicationInitialized =
false
;
114.
115.
116.
private
void
InitializePhoneApplication()
117.
{
118.
if
(phoneApplicationInitialized)
119.
return
;
120.
121.
122.
123.
RootFrame =
new
PhoneApplicationFrame();
124.
RootFrame.Navigated += CompleteInitializePhoneApplication;
125.
126.
127.
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
128.
129.
130.
phoneApplicationInitialized =
true
;
131.
}
132.
133.
134.
private
void
CompleteInitializePhoneApplication(
object
sender, NavigationEventArgs e)
135.
{
136.
137.
if
(RootVisual != RootFrame)
138.
RootVisual = RootFrame;
139.
140.
141.
RootFrame.Navigated -= CompleteInitializePhoneApplication;
142.
}
143.
144.
#endregion
145.
}
146.
}