private void btnRemoveSegment_Click(object sender, RoutedEventArgs e) { long marker = Position.Ticks; BeatSegment segment = Segments.FirstOrDefault(s => s.Position <= marker && s.Position + s.Duration >= marker); if (segment != null) { Segments.Remove(segment); } }
private void btnDetect_Click(object sender, RoutedEventArgs e) { BeatPatternEditor editor = new BeatPatternEditor(new bool[] { true, false, false, false, false, false, false, false, }); if (editor.ShowDialog() != true) { return; } bool[] pattern = editor.Result; var beats = Beats.GetBeats(_begin, _end).ToList(); BeatSegment segment = GetSegment(beats, pattern); if (segment == null) { return; } Segments.Add(segment); }