async protected virtual void Start() { IsSupported = QRCodeWatcher.IsSupported(); capabilityTask = QRCodeWatcher.RequestAccessAsync(); accessStatus = await capabilityTask; capabilityInitialized = true; }
// Use this for initialization protected virtual void Start() { IsSupported = QRCodeWatcher.IsSupported(); #if !UNITY_EDITOR RequestCapability(); #endif }
public override async void Initialize() { if (QRCodeWatcher.IsSupported()) { #if WINDOWS_UWP try { var capture = new Windows.Media.Capture.MediaCapture(); await capture.InitializeAsync(); Debug.Log("Camera and Microphone permissions OK"); } catch (UnauthorizedAccessException) { Debug.LogError("Camera and microphone permissions not granted."); return; } #endif if (await QRCodeWatcher.RequestAccessAsync() == QRCodeWatcherAccessStatus.Allowed) { _qrWatcher = new QRCodeWatcher();; _qrWatcher.Added += OnQRCodeAddedEvent; _qrWatcher.Updated += OnQRCodeUpdatedEvent; _qrWatcher.Removed += OnQRCodeRemovedEvent; _qrWatcher.EnumerationCompleted += OnQREnumerationEnded; } } }
async void Start() { IsSupported = QRCodeWatcher.IsSupported(); await QRCodeWatcher.RequestAccessAsync(); qRCodeWatcher = new QRCodeWatcher(); qRCodeWatcher.Added += QRCodeWatcher_Added; qRCodeWatcher.Updated += QRCodeWatcher_Updated; qRCodeWatcher.Removed += QRCodeWatcher_Removed; IsReady.Value = true; this.UpdateAsObservable() .Subscribe(_ => { if (pendingActions.TryDequeue(out var action)) { if (action.Type == ActionData.EventType.Added || action.Type == ActionData.EventType.Updated) { if (DateTimeOffset.Compare(StartTime, action.QRCode.LastDetectedTime) < 0) { onScanned.OnNext(action.QRCode); } } } }) .AddTo(this); }
/// <summary> /// Record whether the QRCodeWatcher reports itself as supported, and request access. /// </summary> private async void Start() { isSupported = QRCodeWatcher.IsSupported(); var capabilityTask = QRCodeWatcher.RequestAccessAsync(); accessStatus = await capabilityTask; SimpleConsole.AddLine(log, $"Requested caps, access: {accessStatus.ToString()}"); }
/// <summary> /// Record whether the QRCodeWatcher reports itself as supported, and request access. /// </summary> private async void Start() { _isSupported = QRCodeWatcher.IsSupported(); _capabilityTask = QRCodeWatcher.RequestAccessAsync(); _accessStatus = await _capabilityTask; _capabilityInitialized = true; SimpleConsole.AddLine(log, $"Requested caps, access: {_accessStatus.ToString()}"); }
// Use this for initialization async protected virtual void Start() { IsSupported = QRCodeWatcher.IsSupported(); capabilityTask = QRCodeWatcher.RequestAccessAsync(); accessStatus = await capabilityTask; capabilityInitialized = true; //AROA EDIT //qrCodesList.Clear();//Clear list on initialization }
/// <summary> /// Record whether the QRCodeWatcher reports itself as supported, and request access. /// </summary> /// <remarks> /// If the camera permission has not already been granted (GetPermissions has successfully completed), /// then the call to QRCodeWather.RequestAccessAsync will never return, even after the user grants permissions. /// See https://github.com/microsoft/MixedReality-WorldLockingTools-Samples/issues/20 /// </remarks> private async void Start() { isSupported = QRCodeWatcher.IsSupported(); SimpleConsole.AddLine(log, $"QRCodeWatcher.IsSupported={isSupported}"); bool gotPermission = await GetPermissions(); if (gotPermission) { var capabilityTask = QRCodeWatcher.RequestAccessAsync(); accessStatus = await capabilityTask; SimpleConsole.AddLine(log, $"Requested caps, access: {accessStatus.ToString()}"); } }
private async Task InitializeTracker() { try { IsSupported = QRCodeWatcher.IsSupported(); if (IsSupported) { SendProgressMessage($"Initializing QR tracker attempt {++initializationAttempt}"); var capabilityTask = QRCodeWatcher.RequestAccessAsync(); await capabilityTask.AwaitWithTimeout(profile.AccessRetryTime, ProcessTrackerCapabilityReturned, () => _ = InitializeTracker()); } else { InitializationFail("QR tracking not supported"); } } catch (Exception ex) { InitializationFail($"QRCodeTrackingService initialization failed: {ex}"); } }