示例#1
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            _dispatchTimer.Stop();
            _dispatchTimer.Tick -= DispatchTimer_Tick;

            if (_myDevice != null)
            {
                _myDevice.Dispose();
                _myDevice = null;
            }

            base.OnNavigatedFrom(e);
        }
示例#2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _myDevice = new MyDevice(0x26);

            if (await _myDevice.Initialize())
            {
                _dispatchTimer.Interval = TimeSpan.FromSeconds(5);
                _dispatchTimer.Tick    += DispatchTimer_Tick;
                _dispatchTimer.Start();
            }

            base.OnNavigatedTo(e);
        }