Kinect stops & restarts when navigated in multiwindow wpf desktop app? RRS feed

  • Question

  • Hi All,

    I am developing a kinect based multiwindow desktop app, which uses kinect gesture/speech to navigate from one window to the other. As of now I am using microsoft toolkit user control to start & stop kinect. But the user control need to be placed in every window of my app and the kinect stops & restarts in every window.

    Please provide any guidelines/code help to place kinect initialization code common irrespective of the window displayed.



    Tuesday, July 10, 2012 8:35 AM


All replies

  • I wonder if this is even supported? I think if each window is as a seperate process it might work. For MDI apps though im not certain can the kinect team confirm MDI app support?

    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog -

    • Proposed as answer by The Thinker Wednesday, July 11, 2012 7:27 PM
    • Unproposed as answer by The Thinker Thursday, July 12, 2012 12:45 PM
    Tuesday, July 10, 2012 3:57 PM
  • Can anyone provide some help for my requirement?
    Thursday, July 12, 2012 4:50 AM
  • can you post a picture for us? I confused as to if you mean multi-process or mdi application. If mdi application I think a picture would help the kinect team too since they would be able to better answer that question.

    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog -

    • Edited by The Thinker Thursday, July 12, 2012 5:51 PM
    Thursday, July 12, 2012 5:41 PM
  • It's not multi-process or mdi application. It's a simple wpf app which contains 3 window.xaml files.

    In window 1, initialize the kinect and speech using microsoft kinect tool kit as if in Shape Game sample. So if I say "Next" win 1 closes and win 2 is displayed.

    But when win 1 closes, the kinect sensor is stopped and uninitialized. Win 2 again contains the same code as win 1 and initializes the sensor again.

    So for ever window, kinect initializes and uninitializes.

    I am unable to place a common initialization and uninitialization code to the entire wpf app instead placing in every window.

    Please provide any guidelines to achieve this.



    Friday, July 13, 2012 3:15 AM
  • can you share the window close code for each one?
    Friday, July 13, 2012 3:40 AM
  • Hi Todd,

    Please see my initialization in ctor & uninitialization in closed event. The same continues in every window.

    This code is grabbed from Shape Game sample.

     #region Private State
            private readonly KinectSensorChooser sensorChooser = new KinectSensorChooser();
            private SpeechRecognizer mySpeechRecognizer = null;
            #endregion Private State
            #region Public Properties
            public static readonly DependencyProperty KinectSensorManagerProperty =
                   new PropertyMetadata(null));
            public KinectSensorManager KinectSensorManager
                get { return (KinectSensorManager)GetValue(KinectSensorManagerProperty); }
                set { SetValue(KinectSensorManagerProperty, value); }
            #endregion Public Properties

     public HomeWindowView()
                this.KinectSensorManager = new KinectSensorManager();
                this.KinectSensorManager.KinectSensorChanged += this.KinectSensorChanged;
                this.DataContext = this.KinectSensorManager;
                this.SensorChooserUI.KinectSensorChooser = sensorChooser;
                // Bind the KinectSensor from the sensorChooser to the KinectSensor on the KinectSensorManager
                var kinectSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
                BindingOperations.SetBinding(this.KinectSensorManager, KinectSensorManager.KinectSensorProperty, kinectSensorBinding);

            private void WinHomeWindowView_Closed(object sender, System.EventArgs e)
                this.KinectSensorManager.KinectSensor = null;
            private void WinHomeWindowView_Closing(object sender, System.ComponentModel.CancelEventArgs e)

    #region Speech Processing private void RecognizerSaidSomething(object sender, SpeechRecognizer.SaidSomethingEventArgs e) { if (e.Phrase != "") { switch (e.Phrase) { case "Next": window2 win2 = new window2();; this.close(); break; case "Previous": ShowPrevWin() break; default: break; } } } #endregion SpeechProcessing

    • Edited by ykbharat Friday, July 13, 2012 3:57 AM added speech code
    Friday, July 13, 2012 3:53 AM
  • I'm not sure I understand what you are trying to do with your app. You are stopping the sensor in each window on close, so it's going to stop.
    Friday, July 13, 2012 10:58 PM
  • I had same problem as you. But I solve it by this piece of code:

    private void UnregisterEvents() { this.sensor.SkeletonFrameReady -= SensorSkeletonFrameReady;


    I recommend you to read this link.

    Monday, November 4, 2013 1:15 PM