Esempio n. 1
0
 /// <summary>
 /// Re-establishes the communication channel with underlying sensor, if it doesn't
 /// already exist.  Connection needs to be re-established when the application
 /// is brought to foreground.
 /// </summary>
 /// <returns>Returns an IAsyncAction object that is used to control the asynchronous operation.</returns>
 public async Task ActivateAsync()
 {
     if (_aMonitor != null)
     {
         await _aMonitor.ActivateAsync();
     }
     if (_sCounter != null)
     {
         await _sCounter.ActivateAsync();
     }
     if (_rTracker != null)
     {
         await _rTracker.ActivateAsync();
     }
     if (_pMonitor != null)
     {
         await _pMonitor.ActivateAsync();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// constructor
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode          = NavigationCacheMode.Required;
            Window.Current.VisibilityChanged += async(oo, ee) =>
            {
                if (!ee.Visible && _trackMonitor != null)
                {
                    await CallSenseApiAsync(async() =>
                    {
                        await _trackMonitor.DeactivateAsync();
                    });
                }
                else if (_trackMonitor != null)
                {
                    await CallSenseApiAsync(async() =>
                    {
                        await _trackMonitor.ActivateAsync();
                    });

                    UpdateScreenAsync();
                }
            };
        }