public EditSongDialog(int position, int spinMaxVal, bool replace) : this() { if (replace) { spinbuttonPosition.Sensitive = false; chkNull.Sensitive = false; } song = new Song (); spinbuttonPosition.Adjustment.Upper = spinMaxVal; spinbuttonPosition.Value = position; string artist = ""; for (int i = 0; i < 10; i++) { artist += (char)rand.Next (97, 123); } string title = ""; for (int i = 0; i < 10; i++) { title += (char)rand.Next (97, 123); } entryArtist.Text = artist; entryTitle.Text = title; }
public EditSongDialog(Song song, int position, bool editSong, int spinMaxVal) : this() { chkNull.Sensitive = false; this.song = song; spinbuttonPosition.Adjustment.Upper = spinMaxVal; entryArtist.Text = song.Artist; entryTitle.Text = song.Title; spinbuttonPosition.Value = position; if (editSong) { spinbuttonPosition.Sensitive = false; } else { entryArtist.Sensitive = false; entryTitle.Sensitive = false; } }
void HandleClicked(object sender, EventArgs e) { Position = (int)spinbuttonPosition.Value; if (chkNull.Active) { song = null; return; } song.Artist = entryArtist.Text; song.Title = entryTitle.Text; }