Example #1
0
        private void SongDataGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            // combobox column is the second one so 1
            DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)SongDataGrid.Rows[e.RowIndex].Cells[1];

            if (cb.Value == null)
            {
                // Return Song to original
                string RefName    = SongDataGrid.Rows[e.RowIndex].Cells[0].Value.ToString();
                var    InGameSong = IngameSongsList.Find(x => x.Name == RefName);
                string FileToMove = Base_Path + @"Backup\" + InGameSong.ID + ".wem";
                System.Diagnostics.Debug.WriteLine(FileToMove + "->" + InGameSong.ID);
                ReplaceSong(FileToMove, InGameSong.ID, 1);
                SongDataGrid.Invalidate();
                return;
            }
            else if (cb.Value.ToString() == "Replaced With Unknown")
            {
                // Do nothing
                return;
            }
            else
            {
                // Do stuff with cb.Value
                string RefName    = SongDataGrid.Rows[e.RowIndex].Cells[0].Value.ToString();
                var    InGameSong = IngameSongsList.Find(x => x.Name == RefName);
                string FileToMove = Base_Path + @"Imported\" + cb.Value;
                ReplaceSong(FileToMove, InGameSong.ID, 0);
                SongDataGrid.Invalidate();
            }
        }
Example #2
0
 private void SongDataGrid_CurrentCellDirtyStateChanged(object sender, EventArgs e)
 {
     if (SongDataGrid.IsCurrentCellDirty)
     {
         // This fires the cell value changed handler below
         SongDataGrid.CommitEdit(DataGridViewDataErrorContexts.Commit);
     }
 }