private void InternalOpenFile(string file) { try { // load the score from the filesystem Score = ScoreLoader.LoadScore(file); trackDetails.Controls.Clear(); trackBars.Controls.Clear(); for (int i = Score.Tracks.Count - 1; i >= 0; i--) { TrackDetailsControl details = new TrackDetailsControl(Score.Tracks[i]); details.Dock = DockStyle.Top; details.Height = 25; trackDetails.Controls.Add(details); details.Selected += details_Click; TrackBarsControl bars = new TrackBarsControl(Score.Tracks[i]); bars.Dock = DockStyle.Top; trackBars.Controls.Add(bars); } UpdateSelectedTrack(); } catch (Exception e) { MessageBox.Show(this, e.Message, "An error during opening the file occured", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void details_Click(object sender, EventArgs e) { TrackDetailsControl details = (TrackDetailsControl)sender; CurrentTrackIndex = _score.Tracks.FindIndex(t => t == details.Track); }