public void Select(TimeSpan begin, TimeSpan end) { DMSentence first = null; DMSentence last = null; foreach (var sentence in this.Dictation.Sentences) { if (TimeSpanHelper.Intersect(begin, end, sentence.BeginTime, sentence.EndTime)) { if (first == null) { first = sentence; } last = sentence; } else if (first != null) { break; } } if (first != null && last != null) { this.SelectElement(first, last); } }
public void Select(TimeSpan begin, TimeSpan end) { this.ViewModel.SelectedCollection.Clear(); this.ViewModel.Lyrics.Phrases.ForEach((phrase) => { if (TimeSpanHelper.Intersect(begin, end, phrase.BeginTime, phrase.EndTime)) { this.ViewModel.SelectedCollection.Add(phrase); return; } }); }