Пример #1
0
        /// <summary>
        /// Starts device tracking.
        /// </summary>
        /// <param name="locationTrackingMode">
        /// </param>
        public async Task StartTrackingAsync(ARLocationTrackingMode locationTrackingMode = ARLocationTrackingMode.Ignore)
        {
            _locationTrackingMode = locationTrackingMode;
            if (locationTrackingMode != ARLocationTrackingMode.Ignore)
            {
                if (LocationDataSource == null)
                {
                    throw new InvalidOperationException("Cannot use location tracking without the LocationDataSource property being initialized");
                }
#if __ANDROID__
                if (!RequestLocationPermission())
                {
                    return;
                }
#endif
                await LocationDataSource.StartAsync();
            }
            CameraController = _controller;
            var currentTrackingValue = IsTracking;
            OnStartTracking();
            IsTracking = true;
            if (!currentTrackingValue)
            {
                IsTrackingStateChanged?.Invoke(this, true);
            }
        }
Пример #2
0
        /// <summary>
        /// Suspends device tracking.
        /// </summary>
        public async Task StopTrackingAsync()
        {
            if (LocationDataSource != null)
            {
                await LocationDataSource.StopAsync();
            }
            OnStopTracking();

            if (IsTracking)
            {
                IsTracking = false;
                IsTrackingStateChanged?.Invoke(this, false);
            }
        }