wasCSharpSQLite – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Linq;
5 using Windows.ApplicationModel;
6 using Windows.ApplicationModel.Activation;
7 using Windows.Foundation;
8 using Windows.Foundation.Collections;
9 using Windows.UI.Xaml;
10 using Windows.UI.Xaml.Controls;
11 using Windows.UI.Xaml.Controls.Primitives;
12 using Windows.UI.Xaml.Data;
13 using Windows.UI.Xaml.Input;
14 using Windows.UI.Xaml.Media;
15 using Windows.UI.Xaml.Navigation;
16  
17 // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
18  
19 namespace MetroSQLiteClientTest2
20 {
21 /// <summary>
22 /// Provides application-specific behavior to supplement the default Application class.
23 /// </summary>
24 sealed partial class App : Application
25 {
26 /// <summary>
27 /// Initializes the singleton application object. This is the first line of authored code
28 /// executed, and as such is the logical equivalent of main() or WinMain().
29 /// </summary>
30 public App()
31 {
32 this.InitializeComponent();
33 this.Suspending += OnSuspending;
34 }
35  
36 /// <summary>
37 /// Invoked when the application is launched normally by the end user. Other entry points
38 /// will be used when the application is launched to open a specific file, to display
39 /// search results, and so forth.
40 /// </summary>
41 /// <param name="args">Details about the launch request and process.</param>
42 protected override void OnLaunched(LaunchActivatedEventArgs args)
43 {
44 // Do not repeat app initialization when already running, just ensure that
45 // the window is active
46 if (args.PreviousExecutionState == ApplicationExecutionState.Running)
47 {
48 Window.Current.Activate();
49 return;
50 }
51  
52 if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
53 {
54 //TODO: Load state from previously suspended application
55 }
56  
57 // Create a Frame to act navigation context and navigate to the first page
58 var rootFrame = new Frame();
59 if (!rootFrame.Navigate(typeof(MainPage)))
60 {
61 throw new Exception("Failed to create initial page");
62 }
63  
64 // Place the frame in the current Window and ensure that it is active
65 Window.Current.Content = rootFrame;
66 Window.Current.Activate();
67 }
68  
69 /// <summary>
70 /// Invoked when application execution is being suspended. Application state is saved
71 /// without knowing whether the application will be terminated or resumed with the contents
72 /// of memory still intact.
73 /// </summary>
74 /// <param name="sender">The source of the suspend request.</param>
75 /// <param name="e">Details about the suspend request.</param>
76 private void OnSuspending(object sender, SuspendingEventArgs e)
77 {
78 var deferral = e.SuspendingOperation.GetDeferral();
79 //TODO: Save application state and stop any background activity
80 deferral.Complete();
81 }
82 }
83 }