当前位置: 首页>>代码示例>>C#>>正文


C# Windows.GetPosition方法代码示例

本文整理汇总了C#中Windows.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Windows.GetPosition方法的具体用法?C# Windows.GetPosition怎么用?C# Windows.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows的用法示例。


在下文中一共展示了Windows.GetPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyMap_Tapped_1

        private async void MyMap_Tapped_1(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            var mp = MyMap.ScreenToMap(e.GetPosition(MyMap));
            Graphic g = new Graphic() { Geometry = mp };
            var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.Graphics.Add(g);

            var bufferResult = GeometryEngine.Buffer(mp, 100);
            var bufferLayer = MyMap.Layers["BufferLayer"] as GraphicsLayer;
            bufferLayer.Graphics.Add(new Graphic() { Geometry = bufferResult });


            var queryTask = new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
            var query = new ESRI.ArcGIS.Runtime.Tasks.Query()
            {
                ReturnGeometry = true,
                OutSpatialReference = MyMap.SpatialReference,
                Geometry = bufferResult
            };
            query.OutFields.Add("OWNERNME1");

            try
            {
                var queryResult = await queryTask.ExecuteAsync(query);
                if (queryResult != null && queryResult.FeatureSet != null)
                {
                    var resultLayer = MyMap.Layers["MyResultsGraphicsLayer"] as GraphicsLayer;
                    resultLayer.Graphics.AddRange(queryResult.FeatureSet.Features);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:35,代码来源:QueryWithBuffer.xaml.cs

示例2: FlyButtonBehavior_Tapped

        private void FlyButtonBehavior_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            if (sender is FrameworkElement)
            {
                FrameworkElement element = sender as FrameworkElement;
                FrameworkElement flyImg = element.FindName(ElementName) as FrameworkElement;

                Point pTouchInElement = e.GetPosition(element);
                Point pTouchInFrame = e.GetPosition(Window.Current.Content as Frame);

                Point pElementCenter = new Point();
                pElementCenter.X = pTouchInFrame.X - pTouchInElement.X + element.ActualWidth / 2 - flyImg.Height / 2;
                pElementCenter.Y = pTouchInFrame.Y - pTouchInElement.Y + element.ActualHeight / 2 - flyImg.Width/2;

                Point pElementTo = new Point(Window.Current.Bounds.Width, (Window.Current.Bounds.Height - flyImg.ActualHeight) / 2);

                flyImg.Visibility = Visibility.Visible;

                MoveAnimation.MoveFromTo(flyImg, pElementCenter.X, pElementCenter.Y, pElementTo.X, pElementTo.Y, TimeSpan.FromSeconds(0.8), (ele) => { flyImg.Visibility = Visibility.Collapsed; });
            }
        }
开发者ID:wpdu,项目名称:ControlTest,代码行数:21,代码来源:RotateBehavior.cs

示例3: MyMap_Tapped

 private async void MyMap_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
 {
     var mp = MyMap.ScreenToMap(e.GetPosition(MyMap));
     Graphic g = new Graphic() { Geometry = mp };
     var stopsLayer = MyMap.Layers["MyStopsGraphicsLayer"] as GraphicsLayer;
     var barriersLayer = MyMap.Layers["MyBarriersGraphicsLayer"] as GraphicsLayer;
     if (StopsRadioButton.IsChecked.Value)
     {
         stopsLayer.Graphics.Add(g);
     }
     else if (BarriersRadioButton.IsChecked.Value)
     {
         barriersLayer.Graphics.Add(g);
     }
     if (stopsLayer.Graphics.Count > 1)
     {
         try
         {
             var routeTask = new RouteTask(new Uri("http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route"));
             var result = await routeTask.SolveAsync(new RouteParameter()
             {
                 Stops = new FeatureStops(stopsLayer.Graphics),
                 Barriers = new FeatureBarriers(barriersLayer.Graphics),
                 UseTimeWindows = false,
                 OutSpatialReference = MyMap.SpatialReference
             });
             if (result != null)
             {
                 if (result.Directions != null && result.Directions.Count > 0)
                 {
                     var direction = result.Directions.FirstOrDefault();
                     if (direction != null && direction.RouteSummary != null)
                         await new MessageDialog(string.Format("{0} minutes", direction.RouteSummary.TotalDriveTime.ToString("#0.000"))).ShowAsync();
                 }
                 GraphicsLayer routeLayer = MyMap.Layers["MyRouteGraphicsLayer"] as GraphicsLayer;
                 routeLayer.Graphics.Clear();
                 routeLayer.Graphics.AddRange(result.Routes);
             }
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex.Message);
         }
     }
 }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:45,代码来源:RoutingWithBarriers.xaml.cs

示例4: pushpinTapped

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void pushpinTapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            Pushpin tappedpin = sender as Pushpin;  // gets the pin that was tapped
            if (null == tappedpin) return;          // null check to prevent bad stuff if it wasn't a pin.

            var x = MapLayer.GetPosition(tappedpin);

            if (Map.ZoomLevel < 16.0)
            {
                Map.SetView(x, 16.0F);
            }
            else
            {
                if (e.GetPosition(Map).Y < 150 || e.GetPosition(Map).X < 100 || e.GetPosition(Map).X > Map.ActualWidth - 200)
                {
                    Map.SetView(x, Map.ZoomLevel);
                }
            }

            if (((Pushpin)sender).Name[0] == '@')
            {
                InfoBoxToReportButton.Visibility = Visibility.Collapsed;
                try
                {
                    await ShowMapBuildingInfoBox((Pushpin)sender);
                }
                catch (Exception)
                {
                    //QueuedBlock.Text = "ERROR DISPLAYING BUILDING INFOBOX";
                }
            }
            else
            {
                InfoBoxToReportButton.Visibility = Visibility.Visible;
                try
                {
                    await ShowMapReportInfoBox((Pushpin)sender);
                }
                catch (Exception)
                {
                    //QueuedBlock.Text = "ERROR DISPLAYING REPORT INFOBOX";
                }
            }
        }
开发者ID:retrohacker,项目名称:SIUC311_Welling,代码行数:49,代码来源:MainPage.xaml.cs

示例5: DiagramCanvas_DoubleTapped

 void DiagramCanvas_DoubleTapped(object sender, Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
 {
     addFigureRectangle(e.GetPosition(this));
 }
开发者ID:kondoumh,项目名称:MetroCsStudyDraw,代码行数:4,代码来源:DiagramCanvas.cs

示例6: Parent_Tapped

        private void Parent_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            if (SelectedTool == InkingToolMode.Annotate)
            {
                Point position = e.GetPosition(null);
                // Find if we're intersecting with the toolbar, because we don't want annotation screens there.
                IEnumerable<UIElement> intersectedElements = VisualTreeHelper.FindElementsInHostCoordinates(position, _inkToolbar);
                // Check what elements of the sender we're on top of. If there's a button, we'll intersect with our toggle button collection
                // to confirm whether we'd like to simply 'hittest' that button.
                IEnumerable<UIElement> allIntersectedElements = VisualTreeHelper.FindElementsInHostCoordinates(position, (UIElement)sender);

                // Not intersected with the toolbar and no togglebuttons (of ours) in the way indicating there's another annotation, go ahead
                // and create the XAML.
                if (intersectedElements.Count() == 0 && (AnnotationTogglers.Intersect(allIntersectedElements.OfType<ButtonBase>())).Count() == 0)
                {
                    var panel = new Grid { Width = 300, Height = 200 };
                    StackPanel collapsingPanel = new StackPanel { Orientation = Orientation.Horizontal };
                    var toggleButtonText = new TextBlock { DataContext = this, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
                    var toggleButtonId = "tb" + Guid.NewGuid().ToString();
                    var toggleButtonContent = new Grid();
                    toggleButtonContent.Children.Add(toggleButtonText);
                    toggleButtonContent.Children.Add(new FontIcon { FontFamily = new FontFamily("Segoe MDL2 Assets"), Glyph = "\uE70B" });
                    var toggleButton = new ToggleButton { Content = new Viewbox { Child = toggleButtonContent }, Name = toggleButtonId, RenderTransform = new TranslateTransform { X = -10 }, Width = 32, Height = 32, Template = null, VerticalAlignment = VerticalAlignment.Top };
                    toggleButton.AddHandler(ToggleButton.PointerPressedEvent, new PointerEventHandler(ToggleButton_PointerPressed), true);
                    toggleButton.AddHandler(ToggleButton.PointerReleasedEvent, new PointerEventHandler(ToggleButton_PointerReleased), true);
                    toggleButton.AddHandler(ToggleButton.PointerMovedEvent, new PointerEventHandler(ToggleButton_PointerMoved), true);

                    toggleButton.PointerReleased += ToggleButton_PointerReleased;
                    AnnotationTogglers.Add(toggleButton);
                    toggleButtonText.SetBinding(TextBlock.TextProperty, new Binding { Path = new PropertyPath("AnnotationTogglers"), Converter = listIndexerConverter, ConverterParameter = toggleButtonId, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged });
                    collapsingPanel.Children.Add(toggleButton);

                    var innerGrid = new Grid();

                    CommandBar richTextEditBar = new CommandBar();
                    var boldButton = new AppBarButton { Label = "Bold", Icon = new SymbolIcon(Symbol.Bold) };
                    // TODO: remove when destroyed
                    boldButton.Click += BoldButton_Click;
                    richTextEditBar.PrimaryCommands.Add(boldButton);
                    var italicButton = new AppBarButton { Label = "Italic", Icon = new SymbolIcon(Symbol.Italic) };
                    // TODO: remove when destroyed
                    italicButton.Click += ItalicButton_Click;
                    richTextEditBar.PrimaryCommands.Add(italicButton);

                    innerGrid.Children.Add(new RichEditBox { Header = richTextEditBar, Width = 200 });
                    var deleteIcon = new FontIcon { Name = "deleteIcon", FontFamily = new FontFamily("Segoe MDL2 Assets"), Glyph = "\uE74D", Margin = new Thickness(0, 0, 5, 5), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom };
                    deleteIcon.Tapped += new Windows.UI.Xaml.Input.TappedEventHandler((o, a) => { DeleteAnnotation(panel); });
                    innerGrid.Children.Add(deleteIcon);
                    innerGrid.SetBinding(Grid.VisibilityProperty, new Binding { ElementName = toggleButton.Name, Path = new PropertyPath("IsChecked"), Converter = booleanToVisibilityConverter });
                    collapsingPanel.Children.Add(innerGrid);
                    panel.Children.Add(collapsingPanel);

                    Canvas.SetLeft(panel, position.X);
                    Canvas.SetTop(panel, position.Y);

                    _annotationCanvas.Children.Add(panel);
                }
            }
        }
开发者ID:martijnhoogendoorn,项目名称:inkingbehavior,代码行数:59,代码来源:InkingBehavior.cs

示例7: MyMap_Tapped_1

 private async void MyMap_Tapped_1(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
 {
     var mp = MyMap.ScreenToMap(e.GetPosition(MyMap));
     await RunIdentify(mp);
 }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:5,代码来源:Identify.xaml.cs

示例8: OnDoubleTapped

        /// <summary>
        /// ${ui_action_Pan_event_OnDoubleTapped_D}
        /// </summary>
        public override void OnDoubleTapped(Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
        {
            base.OnDoubleTapped(e);
            Point curMousePos = e.GetPosition(Map);
            Map.ZoomToResolution(Map.GetNextResolution(!(KeyboardHelper.ShiftIsDown())), Map.ScreenToMap(curMousePos));

        }
开发者ID:SuperMap,项目名称:iClient-for-Win8,代码行数:10,代码来源:Pan.cs

示例9: StackPanel_RightTapped

 private void StackPanel_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
 {
     var stackpanelitem = (StackPanel)sender;
     SiteKeyItemFlyout.ShowAt(stackpanelitem, e.GetPosition(stackpanelitem));
     sitekeyRightClicked = (Model.SiteKeyItem)((FrameworkElement)sender).DataContext;
 }
开发者ID:AndHell,项目名称:CreatePass,代码行数:6,代码来源:MainPage.xaml.cs

示例10: OnGridChartArea_Tapped

		private void OnGridChartArea_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
		{
			if (GridChartArea.Visibility == Visibility.Visible && GridChartArea.ActualHeight > 0.0 && GridChartArea.ActualWidth > 0.0)
			{
				Point touchPosition = e.GetPosition(GridChartArea);
				ChartTapped?.Invoke(this, new ChartTappedArguments() { X = touchPosition.X, Y = touchPosition.Y, XMax = GridChartArea.ActualWidth, YMax = GridChartArea.ActualHeight });
			}
		}
开发者ID:lolluslollus,项目名称:Utilz,代码行数:8,代码来源:LolloChartMobile.xaml.cs


注:本文中的Windows.GetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。