Example #1
0
        //Method to open the input page with a specific grid using the parameter
        public void openInput(String name)
        {
            //Make a new instance of the page
            input = new InputPage();
            Console.WriteLine("Opening input window...");
            //Position and size each element
            input.init();
            //Set the specific grid as visible based on the parameter name
            input.openGrid(name);
            //If the page needs combo boxes as well as buttons for interaction, get them
            //Only the variables grid does not have a combo box which is why it is excluded
            if (name != "Variable (4)")
            {
                //Get the variabel names from the code window
                input.populateVariables(gst.getVariables());
                //Get the boxes and items as seperate lists
                validBoxes    = input.getComboBoxElements();
                validBoxItems = input.items;
            }

            //Set this as the active window
            setActiveWindow("input");
            //Get the interactable buttons
            validButtons = new List <Button>();
            //Hard coded solution to issue where the menu buttons were being loaded along with the inputs
            validButtons.Remove(menu.btn_quit);
            validButtons = input.getInteractableElements();
            //Tell the kinect to draw on this page
            initialisePeople();
            //Set it as the window content
            frame.Content = input;
        }
Example #2
0
        //Event handler called when the kinect updates
        private void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            //tracks multiple people in loop
            for (int i = 0; i < trackedSkeles; i++)
            {
                Skeleton me = null;

                getSkeles(e, ref me, i);
                //If the skeleton object is null, return out of statement
                if (me == null)
                {
                    //If there is was someone on screen, remove them
                    if (People[i].skeleCheck == true)
                    {
                        removePerson(People[i]);
                    }
                    return;
                }
                else
                {
                    //If there was no one on screen but there is this tick, add them
                    if (People[i].skeleCheck == false)
                    {
                        addPerson(People[i]);
                    }
                }

                //sets values to people array then draws the person
                GetXYD(me, People[i]);
                People[i].DrawPerson();

                //Adds the input combo box values to the grid if that is the active window
                //Solution to a bug with the combo boxes
                if (currentWindow == "input")
                {
                    validBoxes    = input.getComboBoxElements();
                    validBoxItems = input.items;
                    //Call the checkPersonFor method with 3 populated lists
                    gst.checkPersonFor(People[i], validButtons, validBoxes, validBoxItems);
                }
                else
                {
                    //Else, call the checkPersonFor with only the valid buttons list and 2 default values defined in the method
                    gst.checkPersonFor(People[i], validButtons, validBoxes, validBoxItems);
                }
            }
        }