Пример #1
0
        /// <summary>
        /// Finds a row index by using specified <paramref name="valueToSearch"/> and
        /// <paramref name="columnIndex"/>.
        /// </summary>
        /// <param name="valueToSearch">The value to search.</param>
        /// <param name="columnIndex">Index of the column.</param>
        /// <param name="searchOptions">The search options.</param>
        public int FindRowIndex(
            string valueToSearch,
            int columnIndex,
            HtmlTableSearchOptions searchOptions)
        {
            WaitForControlReady();
            int iRow     = -1;
            int rowCount = -1;

            foreach (CUITControls.HtmlControl control in SourceControl.Rows)
            {
                //control could be of ControlType.RowHeader or ControlType.Row

                rowCount++;

                int columnCount = -1;

                foreach (CUITControls.HtmlControl cell in control.GetChildren()) //Cells could be a collection of HtmlCell and HtmlHeaderCell controls
                {
                    columnCount++;
                    bool searchOptionResult = false;
                    if (columnCount == columnIndex)
                    {
                        if (searchOptions == HtmlTableSearchOptions.Normal)
                        {
                            searchOptionResult = (valueToSearch == cell.InnerText);
                        }
                        else if (searchOptions == HtmlTableSearchOptions.NormalTight)
                        {
                            searchOptionResult = (valueToSearch == cell.InnerText.Trim());
                        }
                        else if (searchOptions == HtmlTableSearchOptions.StartsWith)
                        {
                            searchOptionResult = cell.InnerText.StartsWith(valueToSearch);
                        }
                        else if (searchOptions == HtmlTableSearchOptions.EndsWith)
                        {
                            searchOptionResult = cell.InnerText.EndsWith(valueToSearch);
                        }
                        else if (searchOptions == HtmlTableSearchOptions.Greedy)
                        {
                            searchOptionResult = (cell.InnerText.IndexOf(valueToSearch) > -1);
                        }
                        if (searchOptionResult)
                        {
                            iRow = rowCount;
                            break;
                        }
                    }
                }
                if (iRow > -1)
                {
                    break;
                }
            }
            return(iRow);
        }
Пример #2
0
        /// <summary>
        /// Finds a row by using specified <paramref name="valueToSearch"/> and double-clicks its
        /// column specified by <paramref name="columnIndex"/>.
        /// </summary>
        /// <param name="valueToSearch">The value to search.</param>
        /// <param name="columnIndex">Index of the column.</param>
        /// <param name="searchOptions">The search options.</param>
        public void FindRowAndDoubleClick(
            string valueToSearch,
            int columnIndex,
            HtmlTableSearchOptions searchOptions = HtmlTableSearchOptions.Normal)
        {
            int rowIndex = FindRowIndex(valueToSearch, columnIndex, searchOptions);

            FindCellAndDoubleClick(rowIndex, columnIndex);
        }
Пример #3
0
        public void FindRowAndDoubleClick(int iCol, string sValueToSearch, HtmlTableSearchOptions option)
        {
            int iRow = FindRow(iCol, sValueToSearch, option);

            FindCellAndDoubleClick(iRow, iCol);
        }