private void BtnMRAddSnapPoint_Click(object sender, RoutedEventArgs e) { try { double offset = Convert.ToDouble(txtMRSnapPointOffset.Text); double interval = Convert.ToDouble(txtMRSnapPointInterval.Text); double start = Convert.ToDouble(txtMRSnapPointStart.Text); double end = Convert.ToDouble(txtMRSnapPointEnd.Text); RepeatedScrollSnapPoint newSnapPoint = new RepeatedScrollSnapPoint(offset, interval, start, end, (ScrollSnapPointsAlignment)cmbMRSnapPointAlignment.SelectedIndex); Color fillColor = GetNewColor(); ScrollPresenterTestHooks.SetSnapPointVisualizationColor(newSnapPoint, fillColor); markupScrollPresenter.VerticalSnapPoints.Add(newSnapPoint); double value = GetFirstRepeatedSnapPoint(offset, interval, start); List <double> values = new List <double>(); while (value <= end) { values.Add(value); value += interval; } FillSnapPoint(values, start, end, fillColor); FixConsolidatedView(); } catch (Exception ex) { this.fullLogs.Add(ex.ToString()); txtExceptionReport.Text = ex.ToString(); } }
private void BtnORAddSnapPoint_Click(object sender, RoutedEventArgs e) { try { double offset = Convert.ToDouble(txtORSnapPointOffset.Text); double interval = Convert.ToDouble(txtORSnapPointInterval.Text); double range = Convert.ToDouble(txtORApplicableRange.Text); double start = Convert.ToDouble(txtORSnapPointStart.Text); double end = Convert.ToDouble(txtORSnapPointEnd.Text); RepeatedScrollSnapPoint newSnapPoint = new RepeatedScrollSnapPoint(offset, interval, start, end, range, ScrollSnapPointsAlignment.Near); Color fillColor = GetNewColor(); ScrollPresenterTestHooks.SetSnapPointVisualizationColor(newSnapPoint, fillColor); markupScrollPresenter.VerticalSnapPoints.Add(newSnapPoint); double value = GetFirstRepeatedSnapPoint(offset, interval, start); int minColumn = FillSnapPoint(new List <double>(), start, end, fillColor); while (value <= end) { FillSnapPoint(new List <double> { value }, Math.Max(start, value - range), Math.Min(end, value + range), fillColor, minColumn); value += interval; } FixConsolidatedView(); } catch (Exception ex) { this.fullLogs.Add(ex.ToString()); txtExceptionReport.Text = ex.ToString(); } }
private void ScrollPresenterTestHooks_ContentLayoutOffsetYChanged(ScrollPresenter sender, object args) { float contentLayoutOffsetY = 0.0f; ScrollPresenterTestHooks.GetContentLayoutOffsetY(sender, out contentLayoutOffsetY); txtScrollPresenterContentLayoutOffsetY.Text = contentLayoutOffsetY.ToString(); }
private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args) { if (chkLogScrollPresenterEvents.IsChecked == true) { ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetScrollCompletedResult(args); AppendAsyncEventMessage("ScrollCompleted OffsetsChangeId=" + args.ScrollInfo.OffsetsChangeId + ", Result=" + result); } }
private void ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args) { ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetZoomCompletedResult(args); this.fullLogs.Add(sender.Name + " ZoomCompleted ZoomFactorChangeId=" + args.ZoomInfo.ZoomFactorChangeId + ", Result=" + result); if (this.scrollPresenter52ZoomFactorChangeId == args.ZoomInfo.ZoomFactorChangeId) { this.txtResetStatus.Text = "Views reset"; } }
private void BtnSetZoomFactorChangeVelocityParameters_Click(object sender, RoutedEventArgs e) { try { ScrollPresenterTestHooks.SetZoomFactorChangeVelocityParameters( Convert.ToInt32(txtZoomFactorChangeMillisecondsPerUnit.Text), Convert.ToInt32(txtZoomFactorChangeMinMilliseconds.Text), Convert.ToInt32(txtZoomFactorChangeMaxMilliseconds.Text)); } catch (Exception ex) { tbException.Text = ex.ToString(); } }
private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args) { string senderId = "." + sender.Name; FrameworkElement parent = VisualTreeHelper.GetParent(sender) as FrameworkElement; if (parent != null) { senderId = parent.Name + senderId; } ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetScrollCompletedResult(args); this.fullLogs.Add(senderId + " ScrollCompleted. OffsetsChangeId=" + args.ScrollInfo.OffsetsChangeId + ", Result=" + result); chkLogUpdated.IsChecked = false; }
private void FixConsolidatedView() { consolidatedView.Children.Clear(); foreach (ScrollSnapPointBase snapPoint in ScrollPresenterTestHooks.GetConsolidatedVerticalScrollSnapPoints(markupScrollPresenter)) { Vector2 zone = ScrollPresenterTestHooks.GetVerticalSnapPointActualApplicableZone(markupScrollPresenter, snapPoint); zone.X = Math.Max(0, zone.X); zone.Y = Math.Min(snapPointColumnHeight, zone.Y); Rectangle rangeRectangle = new Rectangle(); rangeRectangle.Width = snapPointColumnWidth - 1; rangeRectangle.Height = zone.Y - zone.X; rangeRectangle.Margin = new Thickness(0, zone.X, 0, 0); rangeRectangle.Fill = new SolidColorBrush(ScrollPresenterTestHooks.GetSnapPointVisualizationColor(snapPoint)); rangeRectangle.VerticalAlignment = VerticalAlignment.Top; consolidatedView.Children.Add(rangeRectangle); } }
private void BtnMIAddSnapPoint_Click(object sender, RoutedEventArgs e) { try { double value = Convert.ToDouble(txtMISnapPointValue.Text); ScrollSnapPoint newSnapPoint = new ScrollSnapPoint(value, (ScrollSnapPointsAlignment)cmbMISnapPointAlignment.SelectedIndex); Color fillColor = GetNewColor(); ScrollPresenterTestHooks.SetSnapPointVisualizationColor(newSnapPoint, fillColor); markupScrollPresenter.VerticalSnapPoints.Add(newSnapPoint); FillSnapPoint(new List <double> { value }, value, value, fillColor); FixConsolidatedView(); } catch (Exception ex) { this.fullLogs.Add(ex.ToString()); txtExceptionReport.Text = ex.ToString(); } }
private void ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args) { string senderId = "." + sender.Name; FrameworkElement parent = VisualTreeHelper.GetParent(sender) as FrameworkElement; if (parent != null) { senderId = parent.Name + senderId; } ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetZoomCompletedResult(args); this.fullLogs.Add(senderId + " ZoomCompleted. ZoomFactorChangeId=" + args.ZoomInfo.ZoomFactorChangeId + ", Result=" + result); chkLogUpdated.IsChecked = false; if (args.ZoomInfo.ZoomFactorChangeId == scrollView52ZoomFactorChangeId) { this.txtResetStatus.Text = "Views reset"; scrollView52ZoomFactorChangeId = -1; } }
private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args) { ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetScrollCompletedResult(args); AppendAsyncEventMessage("ScrollCompleted ScrollPresenter=" + sender.Name + ", OffsetsChangeId=" + args.ScrollInfo.OffsetsChangeId + ", Result=" + result); }
public void CanShareSnapPointsInMultipleCollections() { ScrollPresenter scrollPresenter1 = null; ScrollPresenter scrollPresenter2 = null; ScrollPresenter scrollPresenter3 = null; ScrollSnapPoint scrollSnapPoint1 = null; ScrollSnapPoint scrollSnapPoint2 = null; ScrollSnapPoint scrollSnapPoint3 = null; RepeatedScrollSnapPoint repeatedScrollSnapPoint1 = null; RepeatedScrollSnapPoint repeatedScrollSnapPoint2 = null; RepeatedScrollSnapPoint repeatedScrollSnapPoint3 = null; ZoomSnapPoint zoomSnapPoint1 = null; ZoomSnapPoint zoomSnapPoint2 = null; ZoomSnapPoint zoomSnapPoint3 = null; RunOnUIThread.Execute(() => { scrollPresenter1 = new ScrollPresenter(); scrollPresenter2 = new ScrollPresenter(); scrollPresenter3 = new ScrollPresenter(); scrollSnapPoint1 = new ScrollSnapPoint(snapPointValue: 10, alignment: ScrollSnapPointsAlignment.Near); scrollSnapPoint2 = new ScrollSnapPoint(snapPointValue: 20, alignment: ScrollSnapPointsAlignment.Near); scrollSnapPoint3 = new ScrollSnapPoint(snapPointValue: 30, alignment: ScrollSnapPointsAlignment.Near); repeatedScrollSnapPoint1 = new RepeatedScrollSnapPoint(offset: 10, interval: 10, start: 10, end: 100, alignment: ScrollSnapPointsAlignment.Near); repeatedScrollSnapPoint2 = new RepeatedScrollSnapPoint(offset: 200, interval: 10, start: 110, end: 200, alignment: ScrollSnapPointsAlignment.Near); repeatedScrollSnapPoint3 = new RepeatedScrollSnapPoint(offset: 300, interval: 10, start: 210, end: 300, alignment: ScrollSnapPointsAlignment.Near); zoomSnapPoint1 = new ZoomSnapPoint(snapPointValue: 1); zoomSnapPoint2 = new ZoomSnapPoint(snapPointValue: 2); zoomSnapPoint3 = new ZoomSnapPoint(snapPointValue: 3); scrollPresenter1.HorizontalSnapPoints.Add(scrollSnapPoint1); scrollPresenter1.HorizontalSnapPoints.Add(scrollSnapPoint2); scrollPresenter1.VerticalSnapPoints.Add(scrollSnapPoint1); scrollPresenter1.VerticalSnapPoints.Add(scrollSnapPoint3); scrollPresenter2.HorizontalSnapPoints.Add(repeatedScrollSnapPoint1); scrollPresenter2.HorizontalSnapPoints.Add(repeatedScrollSnapPoint2); scrollPresenter2.VerticalSnapPoints.Add(repeatedScrollSnapPoint1); scrollPresenter2.VerticalSnapPoints.Add(repeatedScrollSnapPoint3); scrollPresenter1.ZoomSnapPoints.Add(zoomSnapPoint1); scrollPresenter1.ZoomSnapPoints.Add(zoomSnapPoint2); scrollPresenter2.ZoomSnapPoints.Add(zoomSnapPoint1); scrollPresenter2.ZoomSnapPoints.Add(zoomSnapPoint3); scrollPresenter3.HorizontalSnapPoints.Add(scrollSnapPoint1); scrollPresenter3.HorizontalSnapPoints.Add(scrollSnapPoint1); }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Vector2 horizontalScrollSnapPoint11ApplicableZone = ScrollPresenterTestHooks.GetHorizontalSnapPointActualApplicableZone(scrollPresenter1, scrollSnapPoint1); Vector2 verticalScrollSnapPoint11ApplicableZone = ScrollPresenterTestHooks.GetVerticalSnapPointActualApplicableZone(scrollPresenter1, scrollSnapPoint1); Log.Comment("horizontalScrollSnapPoint11ApplicableZone=" + horizontalScrollSnapPoint11ApplicableZone.ToString()); Log.Comment("verticalScrollSnapPoint11ApplicableZone=" + verticalScrollSnapPoint11ApplicableZone.ToString()); Vector2 horizontalScrollSnapPoint21ApplicableZone = ScrollPresenterTestHooks.GetHorizontalSnapPointActualApplicableZone(scrollPresenter2, repeatedScrollSnapPoint1); Vector2 verticalScrollSnapPoint21ApplicableZone = ScrollPresenterTestHooks.GetVerticalSnapPointActualApplicableZone(scrollPresenter2, repeatedScrollSnapPoint1); Log.Comment("horizontalScrollSnapPoint21ApplicableZone=" + horizontalScrollSnapPoint21ApplicableZone.ToString()); Log.Comment("verticalScrollSnapPoint21ApplicableZone=" + verticalScrollSnapPoint21ApplicableZone.ToString()); Vector2 zoomSnapPoint11ApplicableZone = ScrollPresenterTestHooks.GetZoomSnapPointActualApplicableZone(scrollPresenter1, zoomSnapPoint1); Vector2 zoomSnapPoint21ApplicableZone = ScrollPresenterTestHooks.GetZoomSnapPointActualApplicableZone(scrollPresenter2, zoomSnapPoint1); Log.Comment("zoomSnapPoint11ApplicableZone=" + zoomSnapPoint11ApplicableZone.ToString()); Log.Comment("zoomSnapPoint21ApplicableZone=" + zoomSnapPoint21ApplicableZone.ToString()); int combinationCount11 = ScrollPresenterTestHooks.GetHorizontalSnapPointCombinationCount(scrollPresenter1, scrollSnapPoint1); int combinationCount31 = ScrollPresenterTestHooks.GetHorizontalSnapPointCombinationCount(scrollPresenter3, scrollSnapPoint1); Log.Comment("combinationCount11=" + combinationCount11); Log.Comment("combinationCount31=" + combinationCount31); Log.Comment("Expecting different applicable zones for ScrollSnapPoint in horizontal and vertical collections"); Verify.AreEqual <float>(15.0f, horizontalScrollSnapPoint11ApplicableZone.Y); Verify.AreEqual <float>(20.0f, verticalScrollSnapPoint11ApplicableZone.Y); Log.Comment("Expecting identical applicable zones for RepeatedScrollSnapPoint in horizontal and vertical collections"); Verify.AreEqual <float>(10.0f, horizontalScrollSnapPoint21ApplicableZone.X); Verify.AreEqual <float>(10.0f, verticalScrollSnapPoint21ApplicableZone.X); Verify.AreEqual <float>(100.0f, horizontalScrollSnapPoint21ApplicableZone.Y); Verify.AreEqual <float>(100.0f, verticalScrollSnapPoint21ApplicableZone.Y); Log.Comment("Expecting different applicable zones for ZoomSnapPoint in two zoom collections"); Verify.AreEqual <float>(1.5f, zoomSnapPoint11ApplicableZone.Y); Verify.AreEqual <float>(2.0f, zoomSnapPoint21ApplicableZone.Y); Log.Comment("Expecting different combination counts for ScrollSnapPoint in two horizontal collections"); Verify.AreEqual <int>(0, combinationCount11); Verify.AreEqual <int>(1, combinationCount31); }); }
public ScrollPresenterPage() { // Some pages we will navigate to will need the resources, so lets load them now! App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml); LogController.InitializeLogging(); this.InitializeComponent(); navigateToSimpleContents.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresentersWithSimpleContentsPage), 0); }; navigateToDynamic.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterDynamicPage), 0); }; navigateToExpressionAnimationSources.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterExpressionAnimationSourcesPage), 0); }; navigateToChainingAndRailing.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterChainingAndRailingPage), 0); }; navigateToStackPanelAnchoring.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterStackPanelAnchoringPage), 0); }; navigateToRepeaterAnchoring.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterRepeaterAnchoringPage), 0); }; navigateToScrollSnapPoints.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterScrollSnapPointsPage), 0); }; navigateToZoomSnapPoints.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterZoomSnapPointsPage), 0); }; navigateToBringIntoView.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterBringIntoViewPage), 0); }; navigateToManipulationMode.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterManipulationModePage), 0); }; navigateToAccessibility.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterAccessibilityPage), 0); }; navigateToSimpleScrollControllers.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterWithSimpleScrollControllersPage), 0); }; navigateToCompositionScrollControllers.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterWithCompositionScrollControllersPage), 0); }; navigateToBiDirectionalScrollController.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterWithBiDirectionalScrollControllerPage), 0); }; navigateToLeakDetection.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterLeakDetectionPage), 0); }; navigateToMousePanning.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterMousePanningPage), 0); }; try { int millisecondsPerUnit; int minMilliseconds; int maxMilliseconds; ScrollPresenterTestHooks.GetOffsetsChangeVelocityParameters( out millisecondsPerUnit, out minMilliseconds, out maxMilliseconds); txtOffsetsChangeMillisecondsPerUnit.Text = millisecondsPerUnit.ToString(); txtOffsetsChangeMinMilliseconds.Text = minMilliseconds.ToString(); txtOffsetsChangeMaxMilliseconds.Text = maxMilliseconds.ToString(); ScrollPresenterTestHooks.GetZoomFactorChangeVelocityParameters( out millisecondsPerUnit, out minMilliseconds, out maxMilliseconds); txtZoomFactorChangeMillisecondsPerUnit.Text = millisecondsPerUnit.ToString(); txtZoomFactorChangeMinMilliseconds.Text = minMilliseconds.ToString(); txtZoomFactorChangeMaxMilliseconds.Text = maxMilliseconds.ToString(); switch (ScrollPresenterTestHooks.MouseWheelDeltaForVelocityUnit) { case 15: cmbMouseWheelDeltaForVelocityUnit.SelectedIndex = 0; break; case 30: cmbMouseWheelDeltaForVelocityUnit.SelectedIndex = 1; break; case 60: cmbMouseWheelDeltaForVelocityUnit.SelectedIndex = 2; break; case 90: cmbMouseWheelDeltaForVelocityUnit.SelectedIndex = 3; break; case 120: cmbMouseWheelDeltaForVelocityUnit.SelectedIndex = 4; break; } txtMouseWheelInertiaDecayRate.Text = ScrollPresenterTestHooks.MouseWheelInertiaDecayRate.ToString(); txtMouseWheelScrollLines.Text = ScrollPresenterTestHooks.MouseWheelScrollLines.ToString(); txtMouseWheelScrollChars.Text = ScrollPresenterTestHooks.MouseWheelScrollChars.ToString(); chkIsInteractionTrackerPointerWheelRedirectionEnabled.IsChecked = ScrollPresenterTestHooks.IsInteractionTrackerPointerWheelRedirectionEnabled; } catch (Exception ex) { tbException.Text = ex.ToString(); } }
private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args) { ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetScrollCompletedResult(args); this.fullLogs.Add(sender.Name + " ScrollCompleted OffsetsChangeId=" + args.ScrollInfo.OffsetsChangeId + ", Result=" + result); }