예제 #1
0
        //checks if a RomMatch with the same ID is already in the BindingSource, if so it's status is reset else it's added
        bool checkRow(RomMatch romMatch)
        {
            if (importerBindingSource.Contains(romMatch))
                return true;

            foreach (DataGridViewRow row in importGridView.Rows)
            {
                //Game already in gridview, must be previously ignored. Reset status and return
                RomMatch rowRomMatch = (RomMatch)row.DataBoundItem;
                if (romMatch.ID == rowRomMatch.ID)
                {
                    int rowNum = row.Index;
                    importerBindingSource.RemoveAt(rowNum);
                    romMatch.BindingSourceIndex = rowRomMatch.BindingSourceIndex;
                    importerBindingSource.Insert(rowNum, romMatch);
                    return true;
                }
            }
            return false;
        }
예제 #2
0
 void addRow(RomMatch romMatch)
 {
     int rowNum = importerBindingSource.Add(romMatch);
     romMatch.BindingSourceIndex = rowNum;
     if (rowNum == 0 && importGridView.Rows.Count > 0)
         importGridView.Rows[0].Selected = true; //if first item select it
 }