public void BringIntoView( TimelineControlBringIntoViewMode mode, object dataItem) { TimelineItem container = ContainerFromItem(dataItem); if (container != null) { Nullable <DateTime> start = TimelineCompactPanel.GetStartDate(container); Nullable <DateTime> end = TimelineCompactPanel.GetEndDate(container); if (IsSetZoomToFit(mode) && start.HasValue && end.HasValue) { TimeSpan duration = end.Value - start.Value; double pixelPerTick = (ActualWidth / 2) / duration.Ticks; TimeSpan newTickTimeSpan = TimeSpan.FromTicks((long)(1D / pixelPerTick)); if (newTickTimeSpan.TotalMinutes < 1) { newTickTimeSpan = TimeSpan.FromMinutes(1); } if (newTickTimeSpan < TickTimeSpan) { TickTimeSpan = newTickTimeSpan; } else { if (ActualWidth / 2 < duration.Ticks * Timeline.GetPixelsPerTick(this)) { TickTimeSpan = newTickTimeSpan; } } WpfUtility.WaitForPriority(DispatcherPriority.Background); } if (IsSetCurrentTime(mode)) { if (start.HasValue) { CurrentTime = start.Value; } else if (end.HasValue) { CurrentTime = end.Value; } } } }
private static bool IsSetCurrentTime(TimelineControlBringIntoViewMode mode) { return((mode & TimelineControlBringIntoViewMode.SetCurrentTime) != 0); }
private static bool IsSetZoomToFit(TimelineControlBringIntoViewMode mode) { return((mode & TimelineControlBringIntoViewMode.SetZoomToFit) != 0); }
private static bool IsSetCurrentTime(TimelineControlBringIntoViewMode mode) { return ((mode & TimelineControlBringIntoViewMode.SetCurrentTime) != 0); }
private static bool IsSetZoomToFit(TimelineControlBringIntoViewMode mode) { return ((mode & TimelineControlBringIntoViewMode.SetZoomToFit) != 0); }
public void BringIntoView(TimelineControlBringIntoViewMode mode, object dataItem) { TimelineItem container = ContainerFromItem(dataItem); if (container != null) { Nullable<long> start = TimelineCompactPanel.GetStartTick(container); Nullable<long> end = TimelineCompactPanel.GetEndTick(container); if (IsSetZoomToFit(mode) && start.HasValue && end.HasValue) { long duration = end.Value - start.Value; double pixelPerTick = (ActualWidth / 2) / duration; TimeSpan newTickTimeSpan = TimeSpan.FromTicks((long)(1D / pixelPerTick)); if (newTickTimeSpan.TotalMinutes < 1) { newTickTimeSpan = TimeSpan.FromMinutes(1); } if (newTickTimeSpan < TickTimeSpan) { TickTimeSpan = newTickTimeSpan; } else { if (ActualWidth / 2 < duration * Timeline.GetPixelsPerTick(this)) { TickTimeSpan = newTickTimeSpan; } } WpfUtility.WaitForPriority(DispatcherPriority.Background); } if (IsSetCurrentTime(mode)) { if (start.HasValue) CurrentTick = start.Value; else if (end.HasValue) CurrentTick = end.Value; } } }