Ejemplo n.º 1
0
        private void backButtonPressed(object sender, RoutedEventArgs e)
        {
            stopProcesses();
            StartupWindow sw = new StartupWindow();

            sw.Show();
            closeWindow();
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            StartupWindow sw = new StartupWindow();

            this.Close();
            sw.Show();
        }
Ejemplo n.º 3
0
        /**
         * Checks to see if hands are hovering over a button
         */
        private void checkHands(object sender, EventArgs e)
        {
            try
            {
                if (rightHandPos.IntersectsWith(warmUp))
                {
                    hoverTimer.Start();
                    //Highlight the correct image and unhighlight the others
                    hoverImage(warmUpImg, new RoutedEventArgs());
                    leaveImage(intenseImg, new RoutedEventArgs());
                    leaveImage(moderateImg, new RoutedEventArgs());

                    //Set progress bar to increase on hands to indicate if hand is hovering on button

                    setHandProgressBar(false, hoverTimer.ElapsedMilliseconds);


                    //Check if hand has been hovering on target for 2 seconds or more
                    if (hoverTimer.ElapsedMilliseconds >= 2000)
                    {
                        //Tells the Kinect Window which file to load
                        warmUpWorkout(new object(), new RoutedEventArgs());
                    }
                }
                else if (rightHandPos.IntersectsWith(moderateCardio))
                {
                    hoverTimer.Start();
                    //Highlight the correct image and unhighlight the others
                    hoverImage(moderateImg, new RoutedEventArgs());
                    leaveImage(intenseImg, new RoutedEventArgs());
                    leaveImage(warmUpImg, new RoutedEventArgs());

                    //Set progress bar to increase on hands to indicate if hand is hovering on button

                    setHandProgressBar(false, hoverTimer.ElapsedMilliseconds);


                    //Check if hand has been hovering on target for 2 seconds or more
                    if (hoverTimer.ElapsedMilliseconds >= 2000)
                    {
                        //Tells the Kinect Window which file to load
                        moderateWorkout(new object(), new RoutedEventArgs());

                        //this.NavigationService.Navigate(kw);
                        //this.Content = null;
                        hoverTimer.Reset();
                    }
                }
                else if (rightHandPos.IntersectsWith(intenseCardio))
                {
                    hoverTimer.Start();
                    //Highlight the correct image and unhighlight the others
                    hoverImage(intenseImg, new RoutedEventArgs());
                    leaveImage(moderateImg, new RoutedEventArgs());
                    leaveImage(warmUpImg, new RoutedEventArgs());


                    //Set progress bar to increase on hands to indicate if hand is hovering on button
                    setHandProgressBar(false, hoverTimer.ElapsedMilliseconds);


                    //Check if hand has been hovering on target for 2 seconds or more
                    if (hoverTimer.ElapsedMilliseconds >= 2000)
                    {
                        //Tells the Kinect Window which file to load
                        intenseWorkout(new object(), new RoutedEventArgs());
                    }
                }
                else if (rightHandPos.IntersectsWith(backButton))
                {
                    hoverTimer.Start();
                    //Highlight the correct image and unhighlight the others
                    hoverImage(backButtonImg, new RoutedEventArgs());
                    leaveImage(moderateImg, new RoutedEventArgs());
                    leaveImage(warmUpImg, new RoutedEventArgs());
                    leaveImage(intenseImg, new RoutedEventArgs());


                    //Set progress bar to increase on hands to indicate if hand is hovering on button

                    setHandProgressBar(false, hoverTimer.ElapsedMilliseconds);


                    //Check if hand has been hovering on target for 2 seconds or more
                    if (hoverTimer.ElapsedMilliseconds >= 2000)
                    {
                        StopKinect(kinectSensorChooser1.Kinect);
                        dispatcherTimer.Stop();
                        StartupWindow sw = new StartupWindow();
                        sw.Show();
                        this.Close();
                        hoverTimer.Reset();
                    }
                }
                else  //If hand is not hovering on any button.  Reset timer.
                {
                    resetHandProgressBars();
                    hoverTimer.Reset();
                    //Unhighlight all images
                    leaveImage(warmUpImg, new RoutedEventArgs());
                    leaveImage(moderateImg, new RoutedEventArgs());
                    leaveImage(intenseImg, new RoutedEventArgs());
                    leaveImage(backButtonImg, new RoutedEventArgs());
                }
            }
            catch (NullReferenceException)
            {
                //Do Nothing
            }
        }