예제 #1
0
            /// <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.UnregisterUpdate(this.Update);
            }
예제 #2
0
        /// <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.UnregisterUpdate(this.Update);
                    MLDevice.UnregisterApplicationPause(this.OnApplicationPause);
                    this.CleanupAPI(true);

                    if (this.perceptionHasStarted)
                    {
                        this.perceptionHandle.Dispose();
                        this.perceptionHasStarted = false;
                    }

                    _instance = null;
                }
            }
        }
        private void StopInternal()
        {
            if (IsStarted)
            {
                MLDevice.UnregisterUpdate(this.Update);
                MLDevice.UnregisterApplicationPause(this.OnApplicationPause);
                MLDevice.UnregisterDestroy(instance.StopInternal);

                MLResult.Code resultCode = instance.StopAPI();

                if (DidNativeCallSucceed(resultCode, $"{typeof(T).Name} Stop"))
                {
                    MLPluginLog.Debug($"{typeof(T).Name} API stopped successfully");
                }

                if (perceptionHandle.active)
                {
                    perceptionHandle.Dispose();
                }

                IsStarted = false;
            }
        }
예제 #4
0
            /// <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.UnregisterUpdate(this.Update);
            }