| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
|
| 3 |
#if WINDOWS |
| 4 |
using Windows.ApplicationModel; |
| 5 |
using Windows.ApplicationModel.Core; |
| 6 |
|
| 7 |
namespace System.Reactive.PlatformServices |
| 8 |
{ |
| 9 |
internal class HostLifecycleNotifications : IHostLifecycleNotifications |
| 10 |
{ |
| 11 |
private EventHandler<SuspendingEventArgs> _suspending; |
| 12 |
private EventHandler<object> _resuming; |
| 13 |
|
| 14 |
public event EventHandler<HostSuspendingEventArgs> Suspending |
| 15 |
{ |
| 16 |
add |
| 17 |
{ |
| 18 |
_suspending = (o, e) => value(o, new HostSuspendingEventArgs()); |
| 19 |
CoreApplication.Suspending += _suspending; |
| 20 |
} |
| 21 |
|
| 22 |
remove |
| 23 |
{ |
| 24 |
CoreApplication.Suspending -= _suspending; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
public event EventHandler<HostResumingEventArgs> Resuming |
| 29 |
{ |
| 30 |
add |
| 31 |
{ |
| 32 |
_resuming = (o, e) => value(o, new HostResumingEventArgs()); |
| 33 |
CoreApplication.Resuming += _resuming; |
| 34 |
} |
| 35 |
|
| 36 |
remove |
| 37 |
{ |
| 38 |
CoreApplication.Resuming -= _resuming; |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
#endif |