Exemple #1
0
        /// <summary>
        /// Initialize Kinect UI service
        /// </summary>
        /// <returns>Iterator</returns>
        private IEnumerator <ITask> InitializeKinectUI()
        {
            this.frameProcessor = new FramePreProcessor(this.kinectPort, this._state, this.useKinectNykoGlasses);

            var runWindow = this.wpfServicePort.RunWindow(() => new KinectUI(this));

            yield return((Choice)runWindow);

            var exception = (Exception)runWindow;

            if (exception != null)
            {
                LogError(exception);
                StartFailed();
                yield break;
            }

            // need double cast because WPF adapter doesn't know about derived window types
            this.userInterface = (Window)runWindow as KinectUI;

            yield return(this.kinectPort.Get().Choice(
                             kinectState =>
            {
                this.UpdateState(kinectState);
            },
                             failure =>
            {
                LogError(failure);
            }));

            yield return(this.kinectPort.GetDepthProperties().Choice(
                             GetDepthProperties =>
            {
                KinectUI.MaxValidDepth = GetDepthProperties.MaxDepthValue;
            },
                             failure =>
            {
                LogError(failure);
            }));

            SpawnIterator(this.ReadKinectLoop);
        }
        /// <summary>
        /// Initialize Kinect UI service
        /// </summary>
        /// <returns>Iterator</returns>
        private IEnumerator<ITask> InitializeKinectUI()
        {
            this.frameProcessor = new FramePreProcessor(this.kinectPort, this._state);

            var runWindow = this.wpfServicePort.RunWindow(() => new KinectUI(this));
            yield return (Choice)runWindow;

            var exception = (Exception)runWindow;
            if (exception != null)
            {
                LogError(exception);
                StartFailed();
                yield break;
            }

            // need double cast because WPF adapter doesn't know about derived window types
            this.userInterface = (Window)runWindow as KinectUI;

            yield return this.kinectPort.Get().Choice(
                kinectState =>
                {
                    this.UpdateState(kinectState);
                },
                failure =>
                {
                    LogError(failure);
                });

            yield return this.kinectPort.GetDepthProperties().Choice(
                GetDepthProperties =>
                {
                    KinectUI.MaxValidDepth = GetDepthProperties.MaxDepthValue;
                },
                failure =>
                {
                    LogError(failure);
                });

            SpawnIterator(this.ReadKinectLoop);
        }