private void TimeLine_OnSelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Interval IntervalForSelection = null; if (SelectedItem == null) { return; } { IEnumerable <Interval> v = Intervals.Where(n => n.sceneVM.GetHashCode() == SelectedItem.GetHashCode()); if (v.Count() > 0) { IntervalForSelection = v.First(); } else if (v.Count() != 1) { IntervalForSelection = v.Where(n => n.sceneVM.VideoSegment_TimeBegin == SelectedItem.VideoSegment_TimeBegin).FirstOrDefault(); } } if (IntervalForSelection != null) { SelectInterval(IntervalForSelection, "Событие"); } Console.WriteLine(" SelectedItem.GetHashCode() = " + SelectedItem.GetHashCode()); foreach (var item in Intervals) { Console.WriteLine(item.sceneVM.GetHashCode()); } }
public override int GetHashCode() { var result = Flush.GetHashCode(); result = result ^ (Mode.GetHashCode() ^ 1); // power of two for every other field(^1, ^2, ^4, ^8, ^16, ...) if (SelectedItem != null) { result ^= SelectedItem.GetHashCode(); } return(result); }