source: 2013/30/MiskaK/MW2(My Warfare 2)/Paranneltu Jypeli/JyStorage/SilverlightTest/App.xaml.cs @ 4507

Revision 4507, 5.1 KB checked in by anlakane, 6 years ago (diff)

Talletus.

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Net;
5using System.Windows;
6using System.Windows.Controls;
7using System.Windows.Documents;
8using System.Windows.Input;
9using System.Windows.Media;
10using System.Windows.Media.Animation;
11using System.Windows.Navigation;
12using System.Windows.Shapes;
13using Microsoft.Phone.Controls;
14using Microsoft.Phone.Shell;
15
16namespace SilverStorageTest
17{
18    public partial class App : Application
19    {
20        /// <summary>
21        /// Provides easy access to the root frame of the Phone Application.
22        /// </summary>
23        /// <returns>The root frame of the Phone Application.</returns>
24        public PhoneApplicationFrame RootFrame { get; private set; }
25
26        /// <summary>
27        /// Constructor for the Application object.
28        /// </summary>
29        public App()
30        {
31            // Global handler for uncaught exceptions.
32            UnhandledException += Application_UnhandledException;
33
34            // Show graphics profiling information while debugging.
35            if ( System.Diagnostics.Debugger.IsAttached )
36            {
37                // Display the current frame rate counters.
38                Application.Current.Host.Settings.EnableFrameRateCounter = true;
39
40                // Show the areas of the app that are being redrawn in each frame.
41                //Application.Current.Host.Settings.EnableRedrawRegions = true;
42
43                // Enable non-production analysis visualization mode,
44                // which shows areas of a page that are being GPU accelerated with a colored overlay.
45                //Application.Current.Host.Settings.EnableCacheVisualization = true;
46            }
47
48            // Standard Silverlight initialization
49            InitializeComponent();
50
51            // Phone-specific initialization
52            InitializePhoneApplication();
53        }
54
55        // Code to execute when the application is launching (eg, from Start)
56        // This code will not execute when the application is reactivated
57        private void Application_Launching( object sender, LaunchingEventArgs e )
58        {
59        }
60
61        // Code to execute when the application is activated (brought to foreground)
62        // This code will not execute when the application is first launched
63        private void Application_Activated( object sender, ActivatedEventArgs e )
64        {
65        }
66
67        // Code to execute when the application is deactivated (sent to background)
68        // This code will not execute when the application is closing
69        private void Application_Deactivated( object sender, DeactivatedEventArgs e )
70        {
71        }
72
73        // Code to execute when the application is closing (eg, user hit Back)
74        // This code will not execute when the application is deactivated
75        private void Application_Closing( object sender, ClosingEventArgs e )
76        {
77        }
78
79        // Code to execute if a navigation fails
80        private void RootFrame_NavigationFailed( object sender, NavigationFailedEventArgs e )
81        {
82            if ( System.Diagnostics.Debugger.IsAttached )
83            {
84                // A navigation has failed; break into the debugger
85                System.Diagnostics.Debugger.Break();
86            }
87        }
88
89        // Code to execute on Unhandled Exceptions
90        private void Application_UnhandledException( object sender, ApplicationUnhandledExceptionEventArgs e )
91        {
92            if ( System.Diagnostics.Debugger.IsAttached )
93            {
94                // An unhandled exception has occurred; break into the debugger
95                System.Diagnostics.Debugger.Break();
96            }
97        }
98
99        #region Phone application initialization
100
101        // Avoid double-initialization
102        private bool phoneApplicationInitialized = false;
103
104        // Do not add any additional code to this method
105        private void InitializePhoneApplication()
106        {
107            if ( phoneApplicationInitialized )
108                return;
109
110            // Create the frame but don't set it as RootVisual yet; this allows the splash
111            // screen to remain active until the application is ready to render.
112            RootFrame = new PhoneApplicationFrame();
113            RootFrame.Navigated += CompleteInitializePhoneApplication;
114
115            // Handle navigation failures
116            RootFrame.NavigationFailed += RootFrame_NavigationFailed;
117
118            // Ensure we don't initialize again
119            phoneApplicationInitialized = true;
120        }
121
122        // Do not add any additional code to this method
123        private void CompleteInitializePhoneApplication( object sender, NavigationEventArgs e )
124        {
125            // Set the root visual to allow the application to render
126            if ( RootVisual != RootFrame )
127                RootVisual = RootFrame;
128
129            // Remove this handler since it is no longer needed
130            RootFrame.Navigated -= CompleteInitializePhoneApplication;
131        }
132
133        #endregion
134    }
135}
Note: See TracBrowser for help on using the repository browser.