コード例 #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;
        }
コード例 #2
0
        private void speechInputCheck(String speechResult)
        {
            Console.WriteLine("Setting speech result");
            //Uses the previously set varResult variable to check which speech to text method to run
            switch (varResult)
            {
            case "":
                //When nothing is set in varResult this is used to set the text of the relevant text boxes for the input pages
                kinect.input.txt_condVal.Text = speechResult;
                kinect.input.txt_print.Text   = speechResult;
                //Opacity is used to match the setting of the text in the input page, since it uses reduced opacity to attain a greyed out effect
                kinect.input.txt_condVal.Opacity = 1;
                kinect.input.txt_print.Opacity   = 1;
                //Sets the speechResult in the input page so it is known by the program
                InputPage.setSpeechResult(speechResult);
                break;

            case "set":
                //Gets first word of speech result by splitting the string on spaces and using the .First() command
                speechResult = speechResult.Split(' ').First();
                Console.WriteLine("Set split speechResult: " + speechResult);
                kinect.input.txt_varSet.Opacity = 1;
                kinect.input.txt_varSet.Text    = speechResult;
                //Sets the variable name in the input page
                InputPage.setVarResult(speechResult);
                break;

            case "value":
                kinect.input.txt_varVal.Opacity = 1;
                kinect.input.txt_varVal.Text    = speechResult;
                //Sets the value of the current variable in the input page
                InputPage.valVarResult(speechResult);
                break;

            case "change title":
                //Sets the content of the project title label in the code window to be the result from the 'change title' speech to text
                kinect.code.lbl_title.Content = speechResult;
                Console.WriteLine("Project title: " + kinect.code.lbl_title.Content);
                break;

            case "open page":
                Console.WriteLine(speechResult);
                //Opens a given file provided the user gives a correct name
                kinect.frame.textToSpeech("Opening " + speechResult);
                kinect.gst.events.runPress(speechResult);
                break;
            }
            //And then resets varResult...
            varResult = "";
        }