0
|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Windows; |
|
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Data; |
|
8 |
using System.Windows.Documents; |
|
9 |
using System.Windows.Input; |
|
10 |
using System.Windows.Media; |
|
11 |
using System.Windows.Media.Imaging; |
|
12 |
using System.Windows.Shapes; |
|
13 |
using System.Windows.Threading; |
|
14 |
using Microsoft.Surface; |
|
15 |
using Microsoft.Surface.Presentation; |
|
16 |
using Microsoft.Surface.Presentation.Controls; |
|
17 |
|
|
18 |
namespace FingersDance.Control.Base |
|
19 |
{ |
|
20 |
/// <summary> |
|
21 |
/// Interaction logic for SurfaceWindow1.xaml |
|
22 |
/// </summary> |
|
23 |
public partial class SurfaceWindow1 : SurfaceWindow |
|
24 |
{ |
|
25 |
/// <summary> |
|
26 |
/// Default constructor. |
|
27 |
/// </summary> |
|
28 |
public SurfaceWindow1() |
|
29 |
{ |
|
30 |
InitializeComponent(); |
|
31 |
|
|
32 |
// Add handlers for Application activation events |
|
33 |
AddActivationHandlers(); |
|
34 |
} |
|
35 |
|
|
36 |
|
|
37 |
/// <summary> |
|
38 |
/// Occurs when the window is about to close. |
|
39 |
/// </summary> |
|
40 |
/// <param name="e"></param> |
|
41 |
protected override void OnClosed(EventArgs e) |
|
42 |
{ |
|
43 |
base.OnClosed(e); |
|
44 |
|
|
45 |
// Remove handlers for Application activation events |
|
46 |
RemoveActivationHandlers(); |
|
47 |
} |
|
48 |
|
|
49 |
/// <summary> |
|
50 |
/// Adds handlers for Application activation events. |
|
51 |
/// </summary> |
|
52 |
private void AddActivationHandlers() |
|
53 |
{ |
|
54 |
// Subscribe to surface application activation events |
|
55 |
ApplicationLauncher.ApplicationActivated += OnApplicationActivated; |
|
56 |
ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed; |
|
57 |
ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated; |
|
58 |
} |
|
59 |
|
|
60 |
/// <summary> |
|
61 |
/// Removes handlers for Application activation events. |
|
62 |
/// </summary> |
|
63 |
private void RemoveActivationHandlers() |
|
64 |
{ |
|
65 |
// Unsubscribe from surface application activation events |
|
66 |
ApplicationLauncher.ApplicationActivated -= OnApplicationActivated; |
|
67 |
ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed; |
|
68 |
ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated; |
|
69 |
} |
|
70 |
|
|
71 |
/// <summary> |
|
72 |
/// This is called when application has been activated. |
|
73 |
/// </summary> |
|
74 |
/// <param name="sender"></param> |
|
75 |
/// <param name="e"></param> |
|
76 |
private void OnApplicationActivated(object sender, EventArgs e) |
|
77 |
{ |
|
78 |
//TODO: enable audio, animations here |
|
79 |
} |
|
80 |
|
|
81 |
/// <summary> |
|
82 |
/// This is called when application is in preview mode. |
|
83 |
/// </summary> |
|
84 |
/// <param name="sender"></param> |
|
85 |
/// <param name="e"></param> |
|
86 |
private void OnApplicationPreviewed(object sender, EventArgs e) |
|
87 |
{ |
|
88 |
//TODO: Disable audio here if it is enabled |
|
89 |
|
|
90 |
//TODO: optionally enable animations here |
|
91 |
} |
|
92 |
|
|
93 |
/// <summary> |
|
94 |
/// This is called when application has been deactivated. |
|
95 |
/// </summary> |
|
96 |
/// <param name="sender"></param> |
|
97 |
/// <param name="e"></param> |
|
98 |
private void OnApplicationDeactivated(object sender, EventArgs e) |
|
99 |
{ |
|
100 |
//TODO: disable audio, animations here |
|
101 |
} |
|
102 |
} |
|
103 |
} |