コード例 #1
0
 private void RegisterForAppEvents()
 {
     appSuspendEventHandler  = new SuspendingEventHandler(DeviceEventHandler.Current.OnAppSuspension);
     appResumeEventHandler   = new EventHandler <Object>(DeviceEventHandler.Current.OnAppResume);
     App.Current.Suspending += appSuspendEventHandler;
     App.Current.Resuming   += appResumeEventHandler;
 }
コード例 #2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     _viewModel                      = new DatasetEventsViewModel(e.Parameter as Dataset);
     _appSuspendHandler              = new SuspendingEventHandler(App_Suspending);
     Application.Current.Suspending += _appSuspendHandler;
     base.OnNavigatedTo(e);
 }
コード例 #3
0
 private void UnregisterFromAppEvents()
 {
     App.Current.Suspending -= appSuspendEventHandler;
     appSuspendEventHandler  = null;
     App.Current.Resuming   -= appResumeEventHandler;
     appResumeEventHandler   = null;
 }
コード例 #4
0
 private void UnregisterFromAppEvents()
 {
     // This event is raised when the app is exited and when the app is suspended
     Application.Current.Suspending -= appSuspendEventHandler;
     appSuspendEventHandler          = null;
     Application.Current.Resuming   -= appResumeEventHandler;
     appResumeEventHandler           = null;
 }
コード例 #5
0
        private void StartHandlingAppEvents()
        {
            appSuspendEventHandler = new SuspendingEventHandler(this.OnAppSuspension);
            appResumeEventHandler  = new EventHandler <Object>(this.OnAppResume);

            App.Current.Suspending += appSuspendEventHandler;
            App.Current.Resuming   += appResumeEventHandler;
        }
コード例 #6
0
        private void StartHandlingAppEvents()
        {
            appSuspendEventHandler = new SuspendingEventHandler(OnAppSuspension);
            appResumeEventHandler  = new EventHandler <object>(OnAppResume);

            // This event is raised when the app is exited and when the app is suspended
            Application.Current.Suspending += appSuspendEventHandler;
            Application.Current.Resuming   += appResumeEventHandler;
        }
コード例 #7
0
        private void UnregisterFromAppEvents()
        {
            // This event is raised when the app is exited and when the app is suspended
            CallerApp.Suspending  -= appSuspendEventHandler;
            appSuspendEventHandler = null;

            CallerApp.Resuming   -= appResumeEventHandler;
            appResumeEventHandler = null;
        }
コード例 #8
0
        /// <summary>
        /// Register for app suspension/resume events
        /// </summary>
        private void RegisterForAppEvents()
        {
            _appSuspendEventHandler = new SuspendingEventHandler(this.OnAppSuspension);
            _appResumeEventHandler  = new EventHandler <Object>(this.OnAppResume);

            // This event is raised when the app is exited and when the app is suspended
            App.Current.Suspending += _appSuspendEventHandler;
            App.Current.Resuming   += _appResumeEventHandler;
        }
コード例 #9
0
        /// <summary>
        /// Register for app suspension/resume events. See the comments
        /// for the event handlers for more information on the exact device operation performed.
        ///
        /// We will also register for when the app exists so that we may close the device handle.
        /// </summary>
        private void RegisterForAppEvents()
        {
            appSuspendEventHandler = new SuspendingEventHandler(EventHandlerForDevice.Current.OnAppSuspension);
            appResumeEventHandler  = new EventHandler <Object>(EventHandlerForDevice.Current.OnAppResume);

            // This event is raised when the app is exited and when the app is suspended
            //App.Current.Suspending += appSuspendEventHandler;

            //App.Current.Resuming += appResumeEventHandler;
        }
コード例 #10
0
        //Registro y desregistro para los eventos de la app (Suspending y Resuming)
        private void RegisterForAppEvents()
        {
            //Inicializa los eventos para la suspencion y reanudación de la app
            appSuspendEventHandler = new SuspendingEventHandler(Current.OnAppSuspension);
            appResumeEventHandler  = new EventHandler <object>(Current.OnAppResumen);

            //Los eventos son lanzados cuando se cierra la app o se supende
            App.Current.Suspending += appSuspendEventHandler;
            App.Current.Resuming   += appResumeEventHandler;
        }
コード例 #11
0
        /// <summary>
        /// Register for app suspension/resume events. See the comments
        /// for the event handlers for more information on what is being done to the device.
        ///
        /// We will also register for when the app exists so that we may close the device handle.
        /// </summary>
        private void RegisterForAppEvents()
        {
            appSuspendEventHandler = new SuspendingEventHandler(Current.OnAppSuspension);
            appResumeEventHandler  = new EventHandler <object>(Current.OnAppResume);

            // This event is raised when the app is exited and when the app is suspended
            CallerApp.Suspending += appSuspendEventHandler;

            CallerApp.Resuming += appResumeEventHandler;
        }
コード例 #12
0
        private void StartHandlingAppEvents()
        {
            _appSuspendEventHandler = OnAppSuspension;
            _appResumeEventHandler  = OnAppResume;

            // This event is raised when the app is exited and when the app is suspended
            Application.Current.Suspending += _appSuspendEventHandler;

            Application.Current.Resuming += _appResumeEventHandler;
        }
コード例 #13
0
        /// <summary>
        /// Closes the device, stops the device watcher, stops listening for app events, and resets object state to before a device
        /// was ever connected.
        /// </summary>
        public void CloseDevice()
        {
            if (IsDeviceConnected)
            {
                CloseCurrentlyConnectedDevice();
            }

            if (deviceWatcher != null)
            {
                if (watcherStarted)
                {
                    StopDeviceWatcher();

                    UnregisterFromDeviceWatcherEvents();
                }

                deviceWatcher = null;
            }

            if (deviceAccessInformation != null)
            {
                UnregisterFromDeviceAccessStatusChange();

                deviceAccessInformation = null;
            }

            if (appSuspendEventHandler != null || appResumeEventHandler != null)
            {
                UnregisterFromAppEvents();
            }

            deviceInformation = null;
            deviceSelector    = null;

            deviceConnectedCallback = null;
            deviceCloseCallback     = null;
            appSuspendCallback      = null;

            isEnabledAutoReconnect = true;
        }
コード例 #14
0
        private void UnregisterFromAppEvents()
        {
            // This event is raised when the app is exited and when the app is suspended
            App.Current.Suspending -= appSuspendEventHandler;
            appSuspendEventHandler = null;

            App.Current.Resuming -= appResumeEventHandler;
            appResumeEventHandler = null;
        }
コード例 #15
0
        /// <summary>
        /// Register for app suspension/resume events. See the comments
        /// for the event handlers for more information on what is being done to the device.
        ///
        /// We will also register for when the app exists so that we may close the device handle.
        /// </summary>
        private void RegisterForAppEvents()
        {
            appSuspendEventHandler = new SuspendingEventHandler(EventHandlerForDevice.Current.OnAppSuspension);
            appResumeEventHandler = new EventHandler<Object>(EventHandlerForDevice.Current.OnAppResume);

            // This event is raised when the app is exited and when the app is suspended
            App.Current.Suspending += appSuspendEventHandler;

            App.Current.Resuming += appResumeEventHandler;
        }
        private void StartHandlingAppEvents()
        {
            appSuspendEventHandler = new SuspendingEventHandler(this.OnAppSuspension);
            appResumeEventHandler = new EventHandler<Object>(this.OnAppResume);

            // This event is raised when the app is exited and when the app is suspended
            App.Current.Suspending += appSuspendEventHandler;

            App.Current.Resuming += appResumeEventHandler;
        }
コード例 #17
0
        /// <summary>
        /// Closes the device, stops the device watcher, stops listening for app events, and resets object state to before a device
        /// was ever connected.
        /// </summary>
        public void CloseDevice()
        {
            if (IsDeviceConnected)
            {
                CloseCurrentlyConnectedDevice();
            }

            if (deviceWatcher != null)
            {
                if (watcherStarted)
                {
                    StopDeviceWatcher();

                    UnregisterFromDeviceWatcherEvents();
                }

                deviceWatcher = null;
            }

            if (deviceAccessInformation != null)
            {
                UnregisterFromDeviceAccessStatusChange();

                deviceAccessInformation = null;
            }

            if (appSuspendEventHandler != null || appResumeEventHandler != null)
            {
                UnregisterFromAppEvents();
            }

            deviceInformation = null;
            deviceSelector = null;

            deviceConnectedCallback = null;
            deviceCloseCallback = null;
            appSuspendCallback = null;

            isEnabledAutoReconnect = true;
        }