KinectWindow
Inheritance: System.Windows.Window, System.Windows.Markup.IComponentConnector
 /// <summary>
 /// Close the KinectWindow associated with this KinectSensorItem, if present.
 /// </summary>
 public void CloseWindow()
 {
     if (null != this.Window)
     {
         this.Window.Close();
         this.Window = null;
     }
 }
示例#2
0
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            sensorStatusChanges.Text += kinectSensor.DeviceConnectionId + " " + kinectStatus + "\n";

            KinectSensorItem sensorItem;

            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);
            switch (kinectStatus)
            {
            case KinectStatus.Disconnected:
            case KinectStatus.NotPowered:
                if (sensorItem != null)
                {
                    this.sensorItems.Remove(sensorItem);
                    if (sensorItem.Window != null)
                    {
                        sensorItem.Window.Close();
                        sensorItem.Window = null;
                    }
                }

                break;

            default:
                if (sensorItem == null)
                {
                    sensorItem = new KinectSensorItem
                    {
                        Window = null,
                        Sensor = kinectSensor,
                        Status = kinectSensor.Status
                    };
                    this.sensorItems.Add(sensorItem);
                }

                // show a window, if one isn't already shown, unless we are initializing
                if (sensorItem.Window == null && kinectStatus != KinectStatus.Initializing)
                {
                    var kinectWindow = new KinectWindow {
                        Kinect = kinectSensor
                    };
                    kinectWindow.Show();

                    sensorItem.Window = kinectWindow;
                }

                if (sensorItem.Window != null)
                {
                    sensorItem.Window.StatusChanged();
                }

                sensorItem.Status = kinectStatus;
                break;
            }
        }
        /// <summary>
        /// Ensure a KinectWindow is associated with this KinectSensorItem, and Show it and Activate it.
        /// This can be safely called for a fully operation and visible Window.
        /// </summary>
        public void ShowWindow()
        {
            if (null == this.Window)
            {
                var kinectWindow = new KinectWindow();
                kinectWindow.Closed += this.KinectWindowOnClosed;
                this.Window          = kinectWindow;
            }

            this.Window.KinectSensor = this.Sensor;
            this.Window.Show();
            this.Window.Activate();
        }
        /// <summary>
        /// Ensure a KinectWindow is associated with this KinectSensorItem, and Show it and Activate it.
        /// This can be safely called for a fully operation and visible Window.
        /// </summary>
        public void ShowWindow()
        {
            if (null == this.Window)
            {
                var kinectWindow = new KinectWindow();
                kinectWindow.Closed += this.KinectWindowOnClosed;
                this.Window = kinectWindow;
            }

            this.Window.KinectSensor = this.Sensor;
            this.Window.Show();
            this.Window.Activate();
        }
        private void KinectWindowOnClosed(object sender, EventArgs e)
        {
            var sensor = this.Window.KinectSensor;

            this.Window.Closed      -= this.KinectWindowOnClosed;
            this.Window.KinectSensor = null;
            this.Window = null;

            if ((null != sensor) && sensor.IsRunning)
            {
                sensor.Stop();
            }
        }
        private void KinectWindowOnClosed(object sender, EventArgs e)
        {
            //OnChildReturnEvent(50);
            var sensor = this.Window.KinectSensor;

            this.Window.Closed -= this.KinectWindowOnClosed;

            this.Window.Closed      -= this.tempCallBack;
            this.Window.KinectSensor = null;
            this.Window = null;

            if ((null != sensor) && sensor.IsRunning)
            {
                sensor.Stop();
            }
        }
        /// <summary>
        /// Ensure a KinectWindow is associated with this KinectSensorItem, and Show it and Activate it.
        /// This can be safely called for a fully operation and visible Window.
        /// </summary>
        public void ShowWindow()
        {
            if (null == this.Window)
            {
                var kinectWindow = new KinectWindow(postureIndex);
                kinectWindow.Closed += this.KinectWindowOnClosed;
                kinectWindow.Closed += tempCallBack;
                kinectWindow.OnChildReturnEventInKinectWindow += new KinectWindow.OnChildReturnValueInKinectWindow(cw_OnChildReturnValueEvent);
                this.Window = kinectWindow;
            }

            this.Window.KinectSensor = this.Sensor;
            //CallBack callBack = new CallBack(MainWindow.WindowClosed);
            //System.EventHandler tempCallBack = MainWindow.WindowClosed;
            //this.Window.Closed += tempCallBack;


            this.Window.Show();
            this.Window.Activate();
        }
示例#8
0
        /// <summary>
        /// Ensure a KinectWindow is associated with this KinectSensorItem, and Show it and Activate it.
        /// This can be safely called for a fully operation and visible Window.
        /// </summary>
        public void ShowWindow()
        {
            if (null == this.Window)
            {
                var kinectWindow = new KinectWindow();
                kinectWindow.Closed += this.KinectWindowOnClosed;
                this.Window = kinectWindow;
            }
            this.Window.KinectSensor = this.Sensor;
            this.Window.Show();
            this.Window.Activate();

            //HIER KANN ANSONSTEN AUCH NAO INITIALISIERT WERDEN
            /*
            KinectSensorItem_InitNao InitNao = new KinectSensorItem_InitNao();
            KinectSensorItem_ShowWindows ShowWindows = new KinectSensorItem_ShowWindows(this);
            Thread[] ta = new Thread[2];
            ta[0] = new Thread(InitNao.DoWork);
            ta[1] = new Thread(ShowWindows.DoWork);
            ta[0].Start();
            ta[1].Start();
            */
        }
示例#9
0
        public void KinectWindowOnClosed(object sender, EventArgs e)
        {
            var sensor = this.Window.KinectSensor;
            this.Window.Closed -= this.KinectWindowOnClosed;
            this.Window.KinectSensor = null;
            this.Window = null;

            if ((null != sensor) && sensor.IsRunning)
            {
                sensor.Stop();
            }
        }
示例#10
0
 /// <summary>
 /// Close the KinectWindow associated with this KinectSensorItem, if present.
 /// </summary>
 public void CloseWindow()
 {
     if (null != this.Window)
     {
         this.Window.Close();
         this.Window = null;
     }
 }
示例#11
0
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            sensorStatusChanges.Text += kinectSensor.DeviceConnectionId + " " + kinectStatus + "\n";

            KinectSensorItem sensorItem;
            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);
            switch (kinectStatus)
            {
                case KinectStatus.Disconnected:
                case KinectStatus.NotPowered:
                    if (sensorItem != null)
                    {
                        this.sensorItems.Remove(sensorItem);
                        if (sensorItem.Window != null)
                        {
                            sensorItem.Window.Close();
                            sensorItem.Window = null;
                        }
                    }

                    break;
                default:
                    if (sensorItem == null)
                    {
                        sensorItem = new KinectSensorItem
                        {
                            Window = null,
                            Sensor = kinectSensor,
                            Status = kinectSensor.Status
                        };
                        this.sensorItems.Add(sensorItem);
                    }

                    // show a window, if one isn't already shown, unless we are initializing
                    if (sensorItem.Window == null && kinectStatus != KinectStatus.Initializing)
                    {
                        var kinectWindow = new KinectWindow { Kinect = kinectSensor };
                        kinectWindow.Show();

                        sensorItem.Window = kinectWindow;
                    }

                    if (sensorItem.Window != null)
                    {
                        sensorItem.Window.StatusChanged();
                    }

                    sensorItem.Status = kinectStatus;
                    break;
            }
        }
 //user clicked the window away
 private void KinectWindowOnClosed(object sender, EventArgs e)
 {
     //this does NOT close the sensor but just dismisses the window reference.
     this.Window.Closed -= this.KinectWindowOnClosed;
     this.Window = null;
 }
        public void ShowWindow()
        {
            if (null == this.Window)
            {
                var kinectWindow = new KinectWindow(depthBitmap, Name, "data/kinect/" + USBID + ".xml", this);
                kinectWindow.Closed += this.KinectWindowOnClosed;
                this.Window = kinectWindow;
            }

            //this.Window.KinectSensor = this.Sensor;
            this.Window.Show();
            this.Window.Activate();
        }
        public void Close()
        {
            //dismisses the window
            if (null != this.Window)
            {
                this.Window.Close();
                this.Window = null;
            }

            //closes the Sensor
            if ((null != this.Sensor) && this.Sensor.IsRunning)
            {
                this.Sensor.Stop();
            }
            this.Sensor = null;

            mmf.Dispose();

            // saves the settings
            SaveSettings();
        }
示例#15
0
文件: Nao.cs 项目: kinectNao/bluenao
 public Nao(KinectWindow kinectWindow)
 {
     // TODO: Complete member initialization
     this.kinectWindow = kinectWindow;
 }