Example #1
0
        private /*protected virtual*/ int GetRowFromGridEntry(GridEntry gridEntry) {
            GridEntryCollection rgipesAll = GetAllGridEntries();
            if (gridEntry == null || rgipesAll == null)
                return -1;

            int bestMatch = -1;

            for (int i = 0; i < rgipesAll.Count; i++) {

                // try for an exact match.  semantics of equals are a bit loose here...
                //
                if (gridEntry == rgipesAll[i]) {
                    return i - GetScrollOffset();
                }
                else if (bestMatch == -1 && gridEntry.Equals(rgipesAll[i])) {
                    bestMatch = i - GetScrollOffset();
                }
            }

            if (bestMatch != -1) {
                return bestMatch;
            }

            return -1 - GetScrollOffset();
        }
 private int GetRowFromGridEntry(GridEntry gridEntry)
 {
     GridEntryCollection allGridEntries = this.GetAllGridEntries();
     if ((gridEntry == null) || (allGridEntries == null))
     {
         return -1;
     }
     int num = -1;
     for (int i = 0; i < allGridEntries.Count; i++)
     {
         if (gridEntry == allGridEntries[i])
         {
             return (i - this.GetScrollOffset());
         }
         if ((num == -1) && gridEntry.Equals(allGridEntries[i]))
         {
             num = i - this.GetScrollOffset();
         }
     }
     if (num != -1)
     {
         return num;
     }
     return (-1 - this.GetScrollOffset());
 }