private void bookLookup_EditValueChanged(object sender, EventArgs e) { if (bookLookup.EditValue == null || bookLookup.Tag != null) { return; } // ISSUE: reference to a compiler-generated field Changed?.Invoke(this, EventArgs.Empty); Book book = (Book)bookLookup.EditValue; if (book.BookID == -1) { SongSearchDialog songSearchDialog = new SongSearchDialog(); if (songSearchDialog.ShowDialog() == DialogResult.OK) { Song selectedSong = songSearchDialog.SelectedSong; songSearchDialog.Close(); SongEditDialog songEditDialog = new SongEditDialog(); songEditDialog.EditSong(selectedSong); DialogResult dialogResult = songEditDialog.ShowDialog(); if (dialogResult == DialogResult.OK || dialogResult == DialogResult.Retry) { int?selectedSongId = songEditDialog.SelectedSongID; if (selectedSongId.HasValue) { bookLookup.EditValue = selectedSong.Book; foreach (SongItem song in (List <SongItem>)songLookup.Properties.DataSource) { if (song.SongID == selectedSongId.Value) { songLookup.EditValue = song; ConfigureVerses(song); break; } } } else { _internetSong = selectedSong; ConfigureVerses(_internetSong); songLookup.EditValue = null; } } else { bookLookup.EditValue = null; } } else { bookLookup.EditValue = null; } } else { LoadSongLookup(book); } }
private void openButton_Click(object sender, EventArgs e) { SongEditDialog songEditDialog = new SongEditDialog(); if (songLookup.EditValue != null) { SongItem songItem = (SongItem)songLookup.EditValue; songEditDialog.EditSong(songItem.SongID); } else if (_internetSong != null) { songEditDialog.EditSong(_internetSong); } DialogResult dialogResult = songEditDialog.ShowDialog(); int num; switch (dialogResult) { case DialogResult.Abort: bookLookup_EditValueChanged(null, EventArgs.Empty); return; case DialogResult.OK: num = 1; break; default: num = dialogResult == DialogResult.Retry ? 1 : 0; break; } if (num == 0) { return; } // ISSUE: reference to a compiler-generated field if (Changed != null) { // ISSUE: reference to a compiler-generated field Changed(this, EventArgs.Empty); } int?selectedSongId = songEditDialog.SelectedSongID; if (selectedSongId.HasValue) { bookLookup.EditValue = DataSource.GetBookBySong(selectedSongId.Value); UpdateSongList(); foreach (SongItem song in (List <SongItem>)songLookup.Properties.DataSource) { if (song.SongID == selectedSongId.Value) { songLookup.EditValue = song; songLookup.ClosePopup(); ConfigureVerses(song); _internetSong = (Song)null; break; } } } else { ConfigureVerses(_internetSong); } }