private void SongLoaded(SongData song, string songName, string songFile) { curSong = song; curSongName = songName; curSongFile = songFile; beat = 0; ticksPerBeat = 0; beatsPerMeasure = 0; eventsAtTicksDict = new Dictionary <int, List <int[]> >(); SongName.Content = songName; lastPopulate = -100000000; List <Rectangle> markedChildren = new List <Rectangle>(); foreach (Rectangle child in PianoRoll.Children) { markedChildren.Add(child); } foreach (Rectangle child in markedChildren) { PianoRoll.Children.Remove(child); } for (int i = 0; i < 16; i++) { var squareNumber = "square" + (i + 1).ToString(); //get the correct image to populate's name. I changed the image names to what's on that sheet of paper. var rectNumber = "rect" + (i + 1).ToString(); //get the correct rect to populate's name. I changed the rect names to what's on that sheet of paper. //Console.WriteLine(squareNumber); object rectangle = FindName(rectNumber); Canvas rect = (Canvas)rectangle; rect.Background = colorByChannel[i]; rect.Opacity = .6; object item = FindName(squareNumber); // turn its name from a string into the Image Image imgToPopulate = (Image)item; imgToPopulate.Source = null; ChannelHandler temp = new ChannelHandler(); channels[i] = temp; channels[i].channelImage = imgToPopulate; channels[i].prevInst = -1; } ticksPerBeat = song.ppq; beatsPerMeasure = song.beatsPerMeasure; eventsAtTicksDict = song.eventsAtTicksDict; PianoRoll.ClipToBounds = true; VolumeGauge.ClipToBounds = true; Dispatch.TriggerLock(false); }
private void SongLoaded(SongData song, string songName, string songFile) { curSong = song; curSongName = songName; curSongFile = songFile; beat = 0; ticksPerBeat = 0; beatsPerMeasure = 0; eventsAtTicksDict = new Dictionary<int, List<int[]>>(); SongName.Content = songName; lastPopulate = -100000000; List<Rectangle> markedChildren = new List<Rectangle>(); foreach (Rectangle child in PianoRoll.Children) { markedChildren.Add(child); } foreach (Rectangle child in markedChildren) { PianoRoll.Children.Remove(child); } for (int i = 0; i < 16; i++) { var squareNumber = "square" + (i + 1).ToString(); //get the correct image to populate's name. I changed the image names to what's on that sheet of paper. var rectNumber = "rect" + (i + 1).ToString(); //get the correct rect to populate's name. I changed the rect names to what's on that sheet of paper. //Console.WriteLine(squareNumber); object rectangle = FindName(rectNumber); Canvas rect = (Canvas)rectangle; rect.Background = colorByChannel[i]; rect.Opacity = .6; object item = FindName(squareNumber); // turn its name from a string into the Image Image imgToPopulate = (Image)item; imgToPopulate.Source = null; ChannelHandler temp = new ChannelHandler(); channels[i] = temp; channels[i].channelImage = imgToPopulate; channels[i].prevInst = -1; } ticksPerBeat = song.ppq; beatsPerMeasure = song.beatsPerMeasure; eventsAtTicksDict = song.eventsAtTicksDict; PianoRoll.ClipToBounds = true; VolumeGauge.ClipToBounds = true; Dispatch.TriggerLock(false); }