Пример #1
0
        //Enables MouseInput and Scroll-Ability by Touch
        private void InkCanvas_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Point p = new Point()
            {
                X = e.Position.X,
                Y = e.Position.Y,
            };

            if (GeometryHelper.PointIsInPolygon(P1, P2, P3, p) == true && e.IsInertial == false && ViewModel.GeodreieckVisibility == Visibility.Visible)
            {
                Geodreieck_ManipulationDelta(sender, e);
            }
            else
            {
                double x = e.Delta.Translation.X;
                double y = e.Delta.Translation.Y;
                ScaleFactor  = ScrollViewer_InkCanvas.ZoomFactor;
                ScaleFactor *= e.Delta.Scale;

                if (Math.Abs(x) > Math.Abs(y))
                {
                    ScrollViewer_InkCanvas.ChangeView(ScrollViewer_InkCanvas.HorizontalOffset - x, null, ScaleFactor);
                }
                else
                {
                    ScrollViewer_InkCanvas.ChangeView(null, ScrollViewer_InkCanvas.VerticalOffset - y, ScaleFactor);
                }
                ScaleFactor = ScrollViewer_InkCanvas.ZoomFactor;
            }
        }
Пример #2
0
        //AppLifeCycle and DataEvents
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            await ViewModel.AutoLoadAsync();

            ScrollViewer_InkCanvas.ChangeView(null, null, 0.5f, true);

            FirstStartDialog firstStartDialog = new FirstStartDialog(ViewModel);

            if (ViewModel.FirstStartOnBuild == true)
            {
                await firstStartDialog.ShowAsync();
            }
        }