Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8666205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:40:13+00:00 2026-06-12T17:40:13+00:00

I am using Kinect to develop an Image viewing application using C# and WPF.

  • 0

I am using Kinect to develop an Image viewing application using C# and WPF. When the user puts both his hand above his head, I am displaying a Messagebox asking the user if he/she really wants to quit:

    //Quit if both hands above head
    if (skeleton.Joints[JointType.HandLeft].Position.Y > skeleton.Joints[JointType.Head].Position.Y &&
        skeleton.Joints[JointType.HandRight].Position.Y > skeleton.Joints[JointType.Head].Position.Y)
    {
        pause = true;
        quit();
    }

The quit() function is as follows:

    private void quit()
    {
        MessageBoxButton button = MessageBoxButton.YesNo;
        MessageBoxImage image = MessageBoxImage.Warning;
        MessageBoxResult result = MessageBox.Show("Are you sure you want to quit?", "Close V'Me :(", button, image);
        if (result == MessageBoxResult.Yes) window.Close();
        else if (result == MessageBoxResult.No)
        {
            pause = false;
        }

    }

The pause variable is used to stop recognizing any gestures while the MessageBox is still active. (pause = false means gesture recognition active, else no.)

So there are two problems:

  1. The MessageBox is displayed twice. If I click Yes in any one of those, the window closes. The behavior is okay but I dont want two windows.

  2. If I click No, another MessageBox gets displayed. If I click No on this box, another opens. This happens for every successive No that I click. After getting displayed 5-6 times approximately, it gives me the behavior I want, i.e, it changes the value of the pause variable to false and thus activates the recognition of other gestures.

What exactly am I doing wrong? What can I do to stop EVERYTHING and wait for the user to click on one of the options? Also why is the MessageBox being displayed multiple times (Twice initially, and more when I click No)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:40:14+00:00Added an answer on June 12, 2026 at 5:40 pm

    It’s hard to tell without looking at the code being debugged, but I’m guessing that your first block of code is being called in some sort of loop or event handler that is processing the latest Kinect data.

    Check for pause

    Try adding something like this above the first bit of code:

    if (pause)
       return;
    
    if (skeleton.Joints[JointType.HandLeft].Position.Y > skeleton.Joints[JointType.Head].Position.Y &&
        skeleton.Joints[JointType.HandRight].Position.Y > skeleton.Joints[JointType.Head].Position.Y)
    {
        pause = true;
        quit();
    }
    

    Timeout

    If this doesn’t work, you might need to add a timeout period since the last time you prompt the user.

    private void quit()
    {
        if (DateTime.Now.Subtract(_lastQuitTime).TotalSeconds > 5)
        {
    
              //Prompt the user
    
              //Reset the timeout
              _lastQuitTime = DateTime.Now;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop Windows WPF application using Kinect with great GUI/NUI. I've found
I am using kinect skd 1.5 and WPF application to simulate mouse events. To
I'm doing a kinect Application using Kinect SDK . The Result I want that
I want to develop a gesture recognition. I'm considering using the Kinect to have
We're doing an augmented reality application using the kinect. This has some challenges: We'll
I'm trying to develop a software where can detect face recognition using Kinect. Until
I am writing a C# application that is using the Kinect, i am taking
I'm new to WPF development with C#, and I'm trying to develop an application
I'm trying to create a Kinect + WPF Application. The Kinect part works fine;
Using the Kinect, I'm taking height measurements of both hands from a table, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.