Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Rx/NET/Source/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs')
-rw-r--r--Rx/NET/Source/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/Rx/NET/Source/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs b/Rx/NET/Source/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs
new file mode 100644
index 0000000..30a32e7
--- /dev/null
+++ b/Rx/NET/Source/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+#if WINDOWSPHONE7
+
+#if DEBUG_NO_AGENT_SUPPORT
+using Microsoft.Phone.Shell;
+#else
+using System.Reactive.PlatformServices.Phone.Shell;
+#endif
+
+namespace System.Reactive.PlatformServices
+{
+ internal class HostLifecycleNotifications : IHostLifecycleNotifications
+ {
+ private EventHandler<ActivatedEventArgs> _activated;
+ private EventHandler<DeactivatedEventArgs> _deactivated;
+
+ public event EventHandler<HostSuspendingEventArgs> Suspending
+ {
+ add
+ {
+ _deactivated = (o, e) => value(o, new HostSuspendingEventArgs());
+
+ var current = PhoneApplicationService.Current;
+ if (current != null)
+ current.Deactivated += _deactivated;
+ }
+
+ remove
+ {
+ var current = PhoneApplicationService.Current;
+ if (current != null)
+ current.Deactivated -= _deactivated;
+ }
+ }
+
+ public event EventHandler<HostResumingEventArgs> Resuming
+ {
+ add
+ {
+ _activated = (o, e) =>
+ {
+ if (e.IsApplicationInstancePreserved)
+ {
+ value(o, new HostResumingEventArgs());
+ }
+ };
+
+ var current = PhoneApplicationService.Current;
+ if (current != null)
+ current.Activated += _activated;
+ }
+
+ remove
+ {
+ var current = PhoneApplicationService.Current;
+ if (current != null)
+ current.Activated -= _activated;
+ }
+ }
+ }
+}
+#endif \ No newline at end of file