private void OnTrackRemoved(Core.Model.Track track) { Stop(); var index = TrackHeaders.GetChildren <UI.Track>().Select(x => x.Model).ToList().IndexOf(track); TrackHeaders.Children.RemoveAt(index); BarGrid.RowDefinitions.RemoveAt(0); TrackHeaders.GetChildren <UI.Track>(t => Grid.GetRow(t) > index).ForEach(t => Grid.SetRow(t, Grid.GetRow(t) - 1)); BarGrid.GetChildren <UI.Bar>(b => Grid.GetRow(b) > index).ForEach(b => Grid.SetRow(b, Grid.GetRow(b) - 1)); AddLog("Track removed"); }
private void OnTrackAdded(Core.Model.Track track) { track.BarAdded += (sender, bar) => UI.Utilities.CallUI(() => BarAdded(bar)); track.BarRemoved += (sender, bar) => UI.Utilities.CallUI(() => BarRemoved(bar)); track.Name = GenerateTrackName(); var numberOfRows = BarGrid.RowDefinitions.Count(); TrackHeaders.RowDefinitions.Add(new RowDefinition { Height = new GridLength(Constants.TrackHeight) }); BarGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(Constants.TrackHeight) }); var ui = new UI.Track(track); ui.Deleted += (s, t) => Song.RemoveTrack(track); Grid.SetRow(ui, numberOfRows); Grid.SetColumn(ui, 0); TrackHeaders.Children.Add(ui); AddLog("Track added"); }
private void OnRecording(Core.Model.Track track) { SetAudioStatus(Core.Model.AudioStatus.Recording); }