/// <summary> /// Handles a page request failure. /// </summary> /// <param name="resultCode">The result of the request.</param> private void PageFailed(MLResult.Code resultCode) { this.Status = PageStatus.Failed; MLContacts.ReleaseRequest(this.RequestHandle); this.RequestHandle = MagicLeapNativeBindings.InvalidHandle; this.PageFailedAction?.Invoke(this, MLResult.Create(resultCode)); this.UnregisterUpdate = false; MLDevice.Unregister(this.Update); }
/// <summary> /// Decrement API instance count and cleanup if this is the last one. /// </summary> private void StopAPI() { if (startCount > 0) { --startCount; if (startCount == 0) { MLDevice.Unregister(this.Update); MLDevice.UnregisterOnApplicationPause(this.OnApplicationPause); this.CleanupAPI(true); if (this.perceptionHasStarted) { this.perceptionHandle.Dispose(); this.perceptionHasStarted = false; } _instance = null; } } }
/// <summary> /// Handles a page being ready. /// </summary> private void PageReady() { this.Status = PageStatus.Ready; if (this.listResult.Offset == null) { this.nextPageOffset = string.Empty; this.Status = PageStatus.LastPage; } else { this.nextPageOffset = string.Copy(this.listResult.Offset); } MLContacts.ReleaseRequest(this.RequestHandle); this.RequestHandle = MagicLeapNativeBindings.InvalidHandle; this.PageReadyAction?.Invoke(this); this.TotalHits = this.listResult.TotalHits; this.UnregisterUpdate = false; MLDevice.Unregister(this.Update); }