예제 #1
0
        /// <summary>
        ///     Selects all rows
        ///     <param name="dataGrid">UI data grid</param>
        ///     <returns>true if row selection sucessfull</returns>
        /// </summary>
        public bool SelectDataGridAllRows(bool selectAll)
        {
            var parent    = QAUIItem.GetParent(UIItem, "parent");
            var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container");

            var gotoRowTextBox = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridGoToRow"), "(Hidden) GoToRow",
                                               container.UIItem);

            if (gotoRowTextBox != null && gotoRowTextBox.Exists)
            {
                gotoRowTextBox.UIItem.SetValue(string.Empty);
                Thread.Sleep(1000);
                if (selectAll)
                {
                    gotoRowTextBox.UIItem.SetValue("all");
                }
                else
                {
                    gotoRowTextBox.UIItem.SetValue("none");
                }
                return(true);
            }
            if (selectAll)
            {
                Report.Output("FAILURE: Failed to select all rows");
            }
            else
            {
                Report.Output("FAILURE: Failed to unselect all rows");
            }
            return(false);
        }
예제 #2
0
        /// <summary>
        ///     Copies data to the clipboard from the grid using data grid instead of keyboard shortcut CTRL-C
        /// </summary>
        /// <returns>bool to indicate whether grid based copy was possible</returns>
        private bool CopyGridToClipboardAsCSV(Window window)
        {
            var parent    = QAUIItem.GetParent(UIItem, "parent");
            var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container");

            var copyToClipboard = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridCopyToClipboardCSV"),
                                                "copyToClipboard", container.UIItem);

            if (copyToClipboard.Exists)
            {
                copyToClipboard.SetValue("1", false);
                return(true);
            }
            Report.Output("FAILURE: unable to copy to clipboard");
            return(false);
        }
예제 #3
0
        /// <summary>
        ///     Sets UI to a specific row
        ///     <param name="dataGrid">UI data grid</param>
        ///     <returns>true if row found</returns>
        /// </summary>
        public bool SelectMultipleDataGridRows(List <int> zeroBasedTargetRows)
        {
            var parent         = QAUIItem.GetParent(UIItem, "parent");
            var container      = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container");
            var gotoRowTextBox = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridGoToRow"), "(Hidden) GoToRow",
                                               container.UIItem);

            if (gotoRowTextBox != null && gotoRowTextBox.Exists)
            {
                gotoRowTextBox.UIItem.SetValue(string.Empty);
                Thread.Sleep(1000);
                gotoRowTextBox.UIItem.SetValue(string.Join(",", zeroBasedTargetRows));
                return(true);
            }
            Report.Output("FAILURE: Row not found");
            return(false);
        }
    private void SetFilePath(string path)
    {
        // load data and enable play button
        QAContainer qac = GameObject.FindGameObjectWithTag("QAContainer").GetComponent <QAContainer>();

        if (!qac.LoadValues(path))
        {
            SetState(STATE.FORMATERROR);
            return;
        }

        string[] pathsplit  = path.Split('\\');
        string[] pathsplit2 = pathsplit[pathsplit.Length - 1].Split('.');

        var txtcomp = _PlayButton.GetComponentInChildren <Text>();

        txtcomp.text = txtcomp.text + " '" + pathsplit2[0] + "'";

        _PlayButton.enabled     = true;
        _PlayButton.image.color = _PlayButton.colors.normalColor;
    }
    // Start is called before the first frame update
    void Start()
    {
        _PausedUI   = GameObject.Find("PausedUI").GetComponent <Canvas>();
        _GameUI     = GameObject.Find("GameUI").GetComponent <Canvas>();
        _GameOverUI = GameObject.Find("GameOverUI").GetComponent <Canvas>();
        _PregameUI  = GameObject.Find("PregameUI").GetComponent <Canvas>();
        _ScoreUI    = GameObject.Find("ScoreUI").GetComponent <Canvas>();
        _QuestionUI = GameObject.Find("QuestionUI").GetComponent <Canvas>();

        // QAContiner class stores our questions and matching answers
        _QAContainer = GameObject.FindGameObjectWithTag("QAContainer").GetComponent <QAContainer>();

        // buttons on question screen
        _QButtons = new List <GameObject>()
        {
            GameObject.Find("QB1"),
            GameObject.Find("QB2"),
            GameObject.Find("QB3"),
            GameObject.Find("QB4")
        };


        SetGamestate(STATE.PREGAME);
    }