I have problem with optimalization of my code. I am trying to write code library for our customized infragistics controls.
My problematic function finds table via xPath, select a row with specified values in specified columns and than click\select it. Additionaly table shows only 50 rows at once and if the row is not found there is a
"->" button witch shows next 50 records.
There is a sample sreenshot of the table:
That's a piece of a code witch i have a problem with:
Code: Select all
...
//finding table
Element grid = Host.Local.FindSingle(xPath, int.Parse(maxCzasSzukania));
Table tab = grid.FindSingle("table[@accessiblerole='Table']");
//stores names of columns, desired values and column's indexes in target table
List<string> columns = new List<string>();
List<string> values = new List<string>();
List<int> indexes = new List<int>();
...
while (true)
{
...
foreach (Row row in tab.Rows)
{
bool sel = true;
for (int i = 0; i < indexes.Count; i++)
{
//this check last 1s per row !!!
if (row.Cells[indexes[i]].Text !=
values[i])
{
sel = false;
break;
}
...
The problem is with chec in the inner loop, it lasts 1 second per row and it is too long. Can you tell me how should i optimalize it??
The function is quite long, thats why i put only the problematic part. If necessary i can send whole code.