private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e) { FeatureLayer featureLayer = MyMap.Layers["MyFeatureLayer"] as FeatureLayer; System.Windows.Point screenPnt = MyMap.MapToScreen(e.MapPoint); // Account for difference between Map and application origin GeneralTransform generalTransform = MyMap.TransformToVisual(Application.Current.RootVisual); System.Windows.Point transformScreenPnt = generalTransform.Transform(screenPnt); IEnumerable<Graphic> selected = featureLayer.FindGraphicsInHostCoordinates(transformScreenPnt); foreach (Graphic g in selected) { MyInfoWindow.Anchor = e.MapPoint; MyInfoWindow.IsOpen = true; //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate MyInfoWindow.Content = g.Attributes; return; } InfoWindow window = new InfoWindow() { Anchor = e.MapPoint, Map = MyMap, IsOpen = true, Placement=InfoWindow.PlacementMode.Auto, ContentTemplate = LayoutRoot.Resources["LocationInfoWindowTemplate"] as System.Windows.DataTemplate, //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate Content = e.MapPoint }; LayoutRoot.Children.Add(window); }
private void MyMap_MapGesture(object sender, ESRI.ArcGIS.Client.Map.MapGestureEventArgs e) { if (e.Gesture == GestureType.Tap) { FeatureLayer featureLayer = MyMap.Layers["MyFeatureLayer"] as FeatureLayer; IEnumerable<Graphic> selected = e.DirectlyOver(10, new GraphicsLayer[] { featureLayer }); foreach (Graphic g in selected) { MyInfoWindow.Anchor = e.MapPoint; MyInfoWindow.IsOpen = true; //Since a ContentTemplate is defined (in XAML), Content will define the DataContext for the ContentTemplate MyInfoWindow.Content = g; return; } InfoWindow window = new InfoWindow() { Anchor = e.MapPoint, Padding = new Thickness(3), Map = MyMap, IsOpen = true, Placement = InfoWindow.PlacementMode.Auto, ContentTemplate = LayoutRoot.Resources["LocationInfoWindowTemplate"] as System.Windows.DataTemplate, //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate Content = new ESRI.ArcGIS.Client.Geometry.MapPoint( double.Parse(e.MapPoint.X.ToString("0.000")), double.Parse(e.MapPoint.Y.ToString("0.000"))) }; LayoutRoot.Children.Add(window); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.SearchFlikr = ((System.Windows.Controls.Button)(target)); #line 55 "..\..\FlickrMapToolbar.xaml" this.SearchFlikr.Click += new System.Windows.RoutedEventHandler(this.SearchFlikr_Click); #line default #line hidden return; case 2: this.Done = ((System.Windows.Controls.Button)(target)); #line 64 "..\..\FlickrMapToolbar.xaml" this.Done.Click += new System.Windows.RoutedEventHandler(this.Done_Click); #line default #line hidden return; case 3: this.MyInfoWindow = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; } this._contentLoaded = true; }
public InfoWindowDynamic() { InitializeComponent(); _infoWindow = new InfoWindow() { Map = MyMap, Padding = new Thickness(3), IsOpen = false, Content = new TextBlock(), }; LayoutRoot.Children.Add(_infoWindow); _dispatcherTimer = new DispatcherTimer(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 2: this.mainMap = ((ESRI.ArcGIS.Client.Map)(target)); return; case 3: this.mainInfoWindow = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; } this._contentLoaded = true; }
public WebMapKML() { InitializeComponent(); MyInfoWindow = new InfoWindow() { Padding = new Thickness(5), CornerRadius = 5, BorderBrush = new SolidColorBrush(Colors.Black), BorderThickness = new Thickness(1), Background = new SolidColorBrush(Colors.White), Foreground = new SolidColorBrush(Colors.Black) }; Document webMap = new Document(); webMap.GetMapCompleted += webMap_GetMapCompleted; webMap.GetMapAsync("d2cb7cac8b1947c7b57ed8edd6b045bb"); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 2: this.mainmap = ((ESRI.ArcGIS.Client.Map)(target)); #line 90 "..\..\MainWindow.xaml" this.mainmap.ExtentChanged += new System.EventHandler <ESRI.ArcGIS.Client.ExtentEventArgs>(this.mainmap_ExtentChanged); #line default #line hidden return; case 3: this.InfoWin = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Returns to the original pop-up attribute display. /// </summary> private void goBack(object parameter) { popupWindow = PopupInfo.Container as InfoWindow; //remove the relationship view Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); if (infoWindowGrid.Children.Contains(RelationshipView)) { infoWindowGrid.Children.Remove(RelationshipView); } }
private void Button_Load(object sender, System.Windows.RoutedEventArgs e) { try { FeatureSet featureSet = FeatureSet.FromJson(JsonTextBox.Text); GraphicsLayer graphicsLayerFromFeatureSet = new GraphicsLayer() { Graphics = new GraphicCollection(featureSet) }; if (!featureSet.SpatialReference.Equals(MyMap.SpatialReference)) { if (MyMap.SpatialReference.Equals(new SpatialReference(102100)) && featureSet.SpatialReference.Equals(new SpatialReference(4326))) foreach (Graphic g in graphicsLayerFromFeatureSet.Graphics) g.Geometry = _mercator.FromGeographic(g.Geometry); else if (MyMap.SpatialReference.Equals(new SpatialReference(4326)) && featureSet.SpatialReference.Equals(new SpatialReference(102100))) foreach (Graphic g in graphicsLayerFromFeatureSet.Graphics) g.Geometry = _mercator.ToGeographic(g.Geometry); else { GeometryService geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryService.ProjectCompleted += (s, a) => { for (int i = 0; i < a.Results.Count; i++) graphicsLayerFromFeatureSet.Graphics[i].Geometry = a.Results[i].Geometry; }; geometryService.Failed += (s, a) => { MessageBox.Show("Projection error: " + a.Error.Message); }; geometryService.ProjectAsync(graphicsLayerFromFeatureSet.Graphics, MyMap.SpatialReference); } } SimpleRenderer simpleRenderer = new SimpleRenderer(); SolidColorBrush symbolColor = new SolidColorBrush(Colors.Blue); graphicsLayerFromFeatureSet.Renderer = simpleRenderer; if (featureSet.GeometryType == GeometryType.Polygon || featureSet.GeometryType == GeometryType.Polygon) { simpleRenderer.Symbol = new SimpleFillSymbol() { Fill = symbolColor }; } else if (featureSet.GeometryType == GeometryType.Polyline) { simpleRenderer.Symbol = new SimpleLineSymbol() { Color = symbolColor }; } else // Point { simpleRenderer.Symbol = new SimpleMarkerSymbol() { Color = symbolColor, Size = 12 }; } myInfoWindow = new InfoWindow() { Background = new SolidColorBrush(Colors.Black), BorderBrush = new SolidColorBrush(Colors.White), BorderThickness = new Thickness(1), CornerRadius = 10, Map = MyMap, }; myInfoWindow.MouseLeftButtonDown += myInfoWindow_MouseLeftButtonDown; StackPanel stackPanelParent = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Vertical, Margin = new Thickness(12) }; foreach (KeyValuePair<string, string> keyvalue in featureSet.FieldAliases) { StackPanel stackPanelChild = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal, Margin = new Thickness(0, 0, 0, 6) }; TextBlock textValue = new TextBlock() { Text = keyvalue.Value + ": " }; TextBlock textKey = new TextBlock(); Binding keyBinding = new Binding(string.Format("[{0}]", keyvalue.Key)); textKey.SetBinding(TextBlock.TextProperty, keyBinding); stackPanelChild.Children.Add(textValue); stackPanelChild.Children.Add(textKey); if (keyvalue.Key == featureSet.DisplayFieldName) { textKey.FontWeight = textValue.FontWeight = FontWeights.Bold; stackPanelParent.Children.Insert(0, stackPanelChild); } else stackPanelParent.Children.Add(stackPanelChild); } myInfoWindow.Content = stackPanelParent; ContentPanel.Children.Add(myInfoWindow); MyMap.Layers.Add(graphicsLayerFromFeatureSet); graphicsLayerFromFeatureSet.MouseLeftButtonDown += graphicsLayerFromFeatureSet_MouseLeftButtonDown; JsonPivot.Visibility = Visibility.Collapsed; } catch (Exception ex) { MessageBox.Show(ex.Message, "GraphicsLayer creation failed", MessageBoxButton.OK); } }
/// <summary> /// Determines whether the popupWindow is null /// </summary> private bool canCloseNoRecordsView(object parameter) { // Check whether the grid contained in the pop-up window contains the NoRecordsFoundView popupWindow = PopupInfo.Container as InfoWindow; Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); return popupWindow != null && infoWindowGrid.Children.Contains(NoRecordsFoundView); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Wheels@SG;component/AppPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.esriMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("esriMap"))); this.myGpsLayer = ((ESRI.ArcGIS.Client.Toolkit.DataSources.GpsLayer)(this.FindName("myGpsLayer"))); this.button1 = ((System.Windows.Controls.Button)(this.FindName("button1"))); this.button2 = ((System.Windows.Controls.Button)(this.FindName("button2"))); this.MyInfoWindow = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(this.FindName("MyInfoWindow"))); this.createEvent = ((System.Windows.Controls.Primitives.Popup)(this.FindName("createEvent"))); this.tbEventName = ((System.Windows.Controls.TextBox)(this.FindName("tbEventName"))); this.tbDescription = ((System.Windows.Controls.TextBox)(this.FindName("tbDescription"))); this.tbAddress = ((System.Windows.Controls.TextBox)(this.FindName("tbAddress"))); this.btn_checkin = ((System.Windows.Controls.Button)(this.FindName("btn_checkin"))); this.btn_cancel = ((System.Windows.Controls.Button)(this.FindName("btn_cancel"))); }
private void RemoveInfoWindow(InfoWindow infoWindow) { Grid layoutRoot = gisOperations.GetMap().Parent as Grid; layoutRoot.Children.Remove(infoWindow as UIElement); }
/// <summary> /// Retrieves the pop-up info and determines whether there is more than one relationship for the layer. If there is more /// than one, the relationships are displayed in a list for the user to choose from before proceeding. /// </summary> /// <param name="parameter">OnClickPopupInfo from clicked layer</param> public void Execute(object parameter) { relationshipList.Clear(); OnClickPopupInfo popupInfo = parameter as OnClickPopupInfo; popupWindow = popupInfo.Container as InfoWindow; // Instantiate the View Model if (vm == null) vm = new QueryRelatedViewModel(relationshipList, MapApplication.Current.Map); // Instantiate the Relationship View if (relationshipView == null) relationshipView = new RelationshipSelectionView(); // Instantiate the Keep on Map View if (keepOnMapView == null) keepOnMapView = new KeepOnMap(); // Instantiate the No results found View if (noRecordsView == null) noRecordsView = new NoRecordsFoundView(); // Set the variables on the ViewModel vm.PopupInfo = popupInfo; vm.KeepOnMapView = keepOnMapView; vm.RelationshipView = relationshipView; vm.NoRecordsFoundView = noRecordsView; // Set the data context of the RelationshipView and the KeepOnMapView to the QueryRelatedViewModel relationshipView.DataContext = vm; keepOnMapView.DataContext = vm; noRecordsView.DataContext = vm; // Get the layer info from the pop-up to access the Relationships. Verify the layer is a FeatureLayer to proceed. FeatureLayer relatesLayer; Layer lyr = popupInfo.PopupItem.Layer; if (lyr is FeatureLayer) { relatesLayer = lyr as FeatureLayer; // Check the number of relationships for the layer int relCount = relatesLayer.LayerInfo.Relationships.Count(); if (relCount > 1) // Layer has more than one relationship { foreach (Relationship rel in relatesLayer.LayerInfo.Relationships) { relationshipList.Add(rel); } numberOfRelates = string.Format(Strings.RelationshipsFound, relatesLayer.LayerInfo.Relationships.Count().ToString()); vm.NumberOfRelationships = numberOfRelates; // Add the available relationships view to the popupWindow. Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); infoWindowGrid.Children.Add(relationshipView); // Can now navigate back to attributes and close the popup from the relationship view, // so notify about change in executable state ((DelegateCommand)vm.GoBack).RaiseCanExecuteChanged(); ((DelegateCommand)vm.CloseRelationshipView).RaiseCanExecuteChanged(); } else // Layer only has one relationship, so can use Relationship.First to retrieve the ID. { // Set the SelectedRelationship property on the ViewModel vm.SelectedRelationship = relatesLayer.LayerInfo.Relationships.First(); // Call Execute method on the ViewModel vm.QueryRelated.Execute(vm.SelectedRelationship); } } else { return; } }
/// <summary> /// Checks whether the QueryRelatedRecords tool can be used. Layer must have a relationship associated /// with it for the tool to be enabled. /// </summary> /// <param name="parameter">OnClickPopupInfo from clicked layer</param> public bool CanExecute(object parameter) { popupInfo = parameter as OnClickPopupInfo; if (popupWindow != null && popupInfo.PopupItem != null) { // If the pop-up item (and therefore pop-up) changes, then verify whether the // KeepOnMap View should still be included in the pop-up. popupWindow = popupInfo.Container as InfoWindow; popupInfo.PropertyChanged += PopupItem_PropertyChanged; } return popupInfo != null && popupInfo.PopupItem != null && popupInfo.PopupItem.Layer is FeatureLayer && ((FeatureLayer)popupInfo.PopupItem.Layer).LayerInfo != null && ((FeatureLayer)popupInfo.PopupItem.Layer).LayerInfo.Relationships != null && ((FeatureLayer)popupInfo.PopupItem.Layer).LayerInfo.Relationships.Count() > 0 && MapApplication.Current != null && MapApplication.Current.Map != null && MapApplication.Current.Map.Layers != null && MapApplication.Current.Map.Layers.Contains(popupInfo.PopupItem.Layer) && popupInfo.PopupItem.Graphic != null; }
/// <summary> /// Determines whether the Close button is in an executable state /// </summary> /// <remarks> /// The executable state is determined by whether QueryRelatedViewModel.PopupInfo.Container /// container is an InfoWindow. If it is, the command is executable.</remarks> private bool canCloseRelationshipView(object parameter) { popupWindow = PopupInfo.Container as InfoWindow; Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); return popupWindow != null && infoWindowGrid.Children.Contains(RelationshipView); }
/// <summary> /// Closes the pop-up window /// </summary> private void closeRelationshipView(object parameter) { // Remove the list of relationships from the pop-up and close it popupWindow = PopupInfo.Container as InfoWindow; Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); if (infoWindowGrid.Children.Contains(RelationshipView)) { infoWindowGrid.Children.Remove(RelationshipView); } popupWindow.IsOpen = false; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\MainWindow.xaml" ((Jovian.ClientMap.MainWindow)(target)).Closed += new System.EventHandler(this.Window_Closed); #line default #line hidden return; case 4: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 5: this.mainMap = ((ESRI.ArcGIS.Client.Map)(target)); #line 742 "..\..\MainWindow.xaml" this.mainMap.ExtentChanged += new System.EventHandler <ESRI.ArcGIS.Client.ExtentEventArgs>(this.mainMap_ExtentChanged); #line default #line hidden #line 742 "..\..\MainWindow.xaml" this.mainMap.MouseClick += new System.EventHandler <ESRI.ArcGIS.Client.Map.MouseEventArgs>(this.mainMap_MouseClick); #line default #line hidden #line 742 "..\..\MainWindow.xaml" this.mainMap.MouseMove += new System.Windows.Input.MouseEventHandler(this.mainMap_MouseMove); #line default #line hidden #line 742 "..\..\MainWindow.xaml" this.mainMap.TouchDown += new System.EventHandler <System.Windows.Input.TouchEventArgs>(this.mainMap_TouchDown); #line default #line hidden return; case 6: this.mainNavigation = ((ESRI.ArcGIS.Client.Toolkit.Navigation)(target)); return; case 7: this.mainInfoWindow = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; case 8: this.tbPosition = ((System.Windows.Controls.TextBlock)(target)); return; case 9: #line 764 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 10: #line 765 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 11: #line 766 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 12: #line 767 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 13: #line 768 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 14: #line 769 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 15: #line 770 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnMain_Click); #line default #line hidden return; case 16: this.btnSwitch = ((System.Windows.Controls.Button)(target)); #line 773 "..\..\MainWindow.xaml" this.btnSwitch.Click += new System.Windows.RoutedEventHandler(this.btnSwitch_Click); #line default #line hidden return; case 17: this.borMapTools = ((System.Windows.Controls.Border)(target)); return; case 18: #line 793 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Tools_Click); #line default #line hidden return; case 19: #line 794 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Tools_Click); #line default #line hidden return; case 20: #line 795 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Tools_Click); #line default #line hidden return; case 21: #line 796 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Tools_Click); #line default #line hidden return; case 22: #line 797 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Tools_Click); #line default #line hidden return; case 23: #line 798 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Tools_Click); #line default #line hidden return; case 24: #line 799 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.UserTools_Click); #line default #line hidden return; case 25: this.borMapUserTools = ((System.Windows.Controls.Border)(target)); return; case 26: #line 821 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DrawLenOrArea_Click); #line default #line hidden return; case 27: #line 822 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DrawLenOrArea_Click); #line default #line hidden return; case 28: #line 823 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.UserTools_Click); #line default #line hidden return; case 29: #line 824 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.UserTools_Click); #line default #line hidden return; case 30: #line 825 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.UserTools_Click); #line default #line hidden return; case 31: #line 826 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.UserTools_Click); #line default #line hidden return; case 32: #line 827 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.UserTools_Click); #line default #line hidden return; case 33: this.canvasParent = ((System.Windows.Controls.Canvas)(target)); return; case 34: this.canvasChild1 = ((System.Windows.Controls.Canvas)(target)); #line 831 "..\..\MainWindow.xaml" this.canvasChild1.MouseMove += new System.Windows.Input.MouseEventHandler(this.canvasChild1_MouseMove); #line default #line hidden #line 831 "..\..\MainWindow.xaml" this.canvasChild1.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.canvasChild1_MouseLeftButtonDown); #line default #line hidden #line 831 "..\..\MainWindow.xaml" this.canvasChild1.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.canvasChild1_MouseLeftButtonUp); #line default #line hidden return; } this._contentLoaded = true; }
/// <summary> /// Performs the relationship query. /// </summary> /// <remarks>Called from the doQuery method.</remarks> private void QueryRelationship() { // Set the popupWindow and subscribe to changes on the popupWindow.IsOpen property popupWindow = PopupInfo.Container as InfoWindow; // Set the attribute grid container and subscripbe to changes on the Visibility property attributeGridContainer = MapApplication.Current.FindObjectInLayout(CONTAINER_NAME) as FrameworkElement; ExtensionMethods.Properties.NotifyOnDependencyPropertyChanged("Visibility", attributeGridContainer, OnDataGridVisibilityChanged); // Listen for selection of a different layer in the map contents. MapApplication.Current.SelectedLayerChanged += Current_SelectedLayerChanged; // Listen for a change in the selected index of the PopupInfo (indicating the popup item has changed). PopupInfo.PropertyChanged += PopupInfo_PropertyChanged; // Locate the grid inside the popup window and remove the RelationshipView. This was initially inserted if // multiple relationships for a feature were detected. Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); infoWindowGrid.Children.Remove(RelationshipView); // Set the relationshipID for the QueryTask. int relationshipID = SelectedRelationship.Id; // Get the feature and layer info from the pop-up. The PopupItem property of OnClickPopupInfo // provides information about the item currently shown in the pop-up. Graphic inputFeature = PopupInfo.PopupItem.Graphic; relatesLayer = PopupInfo.PopupItem.Layer as FeatureLayer; // The layer to get related records for. This is used to get the RelationshipID and Query url. // Get the name of the ObjectID field. objectIDField = relatesLayer.LayerInfo.ObjectIdField; // Input parameters for QueryTask RelationshipParameter relationshipParameters = new RelationshipParameter() { ObjectIds = new int[] { (int)inputFeature.Attributes[objectIDField] }, OutFields = new string[] { "*" }, // Return all fields ReturnGeometry = true, // Return the geometry so that features can be displayed on the map if applicable RelationshipId = relationshipID, // Obtain the desired RelationshipID from the Service Details page. Here it takes the first relationship it finds if there is more than one. OutSpatialReference = map.SpatialReference }; // Specify the Feature Service url for the QueryTask. queryTask.Url = relatesLayer.Url; queryTask.ProxyURL = relatesLayer.ProxyUrl; // Events for the successful completion of the RelationshipQuery and for if the Query fails queryTask.ExecuteRelationshipQueryCompleted += QueryTask_ExecuteRelationshipQueryCompleted; queryTask.Failed += QueryTask_Failed; // Execute the Query Task with specified parameters queryTask.ExecuteRelationshipQueryAsync(relationshipParameters); // Create the BusyIndicator and insert into the grid of the popup window. indicator = new BusyIndicator(); indicator.BusyContent = Strings.RetrievingRecords; if (infoWindowGrid != null) { infoWindowGrid.Children.Add(indicator); indicator.IsBusy = true; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); #line 189 "..\..\MainWindow.xaml" this.LayoutRoot.Loaded += new System.Windows.RoutedEventHandler(this.LayoutRoot_Loaded); #line default #line hidden return; case 2: this.mainmap = ((ESRI.ArcGIS.Client.Map)(target)); #line 531 "..\..\MainWindow.xaml" this.mainmap.ExtentChanged += new System.EventHandler <ESRI.ArcGIS.Client.ExtentEventArgs>(this.mainmap_ExtentChanged); #line default #line hidden return; case 3: this.InfoWin = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; case 4: this.InfoWinMF = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; case 5: this.btnSL = ((System.Windows.Controls.Button)(target)); #line 586 "..\..\MainWindow.xaml" this.btnSL.Click += new System.Windows.RoutedEventHandler(this.btnSL_Click); #line default #line hidden return; case 6: this.btnYX = ((System.Windows.Controls.Button)(target)); #line 587 "..\..\MainWindow.xaml" this.btnYX.Click += new System.Windows.RoutedEventHandler(this.btnYX_Click); #line default #line hidden return; case 7: this.btnSY = ((System.Windows.Controls.Button)(target)); #line 588 "..\..\MainWindow.xaml" this.btnSY.Click += new System.Windows.RoutedEventHandler(this.btnSY_Click); #line default #line hidden return; } this._contentLoaded = true; }