private void OnSelectedMapChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { try { if (e.NewValue != null) { if (e.NewValue.GetType() == typeof(KeyValuePair <string, MSCMapService>)) { KeyValuePair <string, MSCMapService> keyValuePair = (KeyValuePair <string, MSCMapService>)e.NewValue; AfaDocData.ActiveDocData.CurrentMapService = keyValuePair.Value; ArcGISRibbon.SetActiveRasterService(keyValuePair.Value); keyValuePair.Value.CheckForUpdates(); } else if (e.NewValue.GetType() == typeof(KeyValuePair <string, MSCImageService>)) { KeyValuePair <string, MSCImageService> keyValuePair2 = (KeyValuePair <string, MSCImageService>)e.NewValue; AfaDocData.ActiveDocData.CurrentImageService = keyValuePair2.Value; ArcGISRibbon.SetActiveRasterService(keyValuePair2.Value); keyValuePair2.Value.CheckForUpdates(); } else if (e.NewValue.GetType() == typeof(MSCMapLayer)) { MSCMapLayer mSCMapLayer = (MSCMapLayer)e.NewValue; ArcGISRibbon.SetActiveRasterService(mSCMapLayer.ParentMap); AfaDocData.ActiveDocData.CurrentMapService = mSCMapLayer.ParentMap; } } } catch { } }
private void SetActiveRaster(object obj) { if (obj == null) { return; } if (obj.GetType() == typeof(KeyValuePair <string, MSCMapService>)) { KeyValuePair <string, MSCMapService> keyValuePair = (KeyValuePair <string, MSCMapService>)obj; AfaDocData.ActiveDocData.CurrentMapService = keyValuePair.Value; AfaDocData.ActiveDocData.CurrentMapService.IsVisible(); ArcGISRibbon.SetActiveRasterService(keyValuePair.Value); keyValuePair.Value.CheckForUpdates(); return; } if (obj.GetType() == typeof(MSCMapLayer)) { MSCMapLayer mSCMapLayer = (MSCMapLayer)obj; AfaDocData.ActiveDocData.CurrentMapService = mSCMapLayer.ParentMap; AfaDocData.ActiveDocData.CurrentMapService.IsVisible(); ArcGISRibbon.SetActiveRasterService(mSCMapLayer.ParentMap); mSCMapLayer.ParentMap.CheckForUpdates(); return; } if (obj.GetType() == typeof(KeyValuePair <string, MSCImageService>)) { KeyValuePair <string, MSCImageService> keyValuePair2 = (KeyValuePair <string, MSCImageService>)obj; AfaDocData.ActiveDocData.CurrentImageService = keyValuePair2.Value; AfaDocData.ActiveDocData.CurrentImageService.IsVisible(); ArcGISRibbon.SetActiveRasterService(keyValuePair2.Value); keyValuePair2.Value.CheckForUpdates(); return; } if (obj.GetType() == typeof(MSCMapService)) { MSCMapService mSCMapService = (MSCMapService)obj; AfaDocData.ActiveDocData.CurrentMapService = mSCMapService; AfaDocData.ActiveDocData.CurrentMapService.IsVisible(); ArcGISRibbon.SetActiveRasterService(mSCMapService); mSCMapService.CheckForUpdates(); return; } if (obj.GetType() == typeof(MSCImageService)) { MSCImageService mSCImageService = (MSCImageService)obj; AfaDocData.ActiveDocData.CurrentImageService = mSCImageService; AfaDocData.ActiveDocData.CurrentImageService.IsVisible(); ArcGISRibbon.SetActiveRasterService(mSCImageService); mSCImageService.CheckForUpdates(); } }
public MapTableViewer(MSCMapService ms, Extent ext, MSCMapLayer startingLayer) { this.InitializeComponent(); Mouse.OverrideCursor = Cursors.Wait; if (ms.InitializeIdentify(ext)) { this.PopulateMapLayerList(ms); foreach (KeyValuePair <string, MSCMapLayer> keyValuePair in ((IEnumerable)this.cbMapLayers.Items)) { if (startingLayer == keyValuePair.Value) { this.cbMapLayers.SelectedItem = keyValuePair; break; } } } Mouse.OverrideCursor = null; }
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) { try { CheckBox checkBox = sender as CheckBox; MSCMapLayer mSCMapLayer = (MSCMapLayer)checkBox.Tag; MSCMapService parentMap = mSCMapLayer.ParentMap; if (parentMap != null) { this.SetActiveRaster(parentMap); parentMap.Write(); parentMap.RefreshConnectedService(); parentMap.CheckForUpdates(); } } catch { } }
private void PopulateMapLayerChildList(MSCMapLayer parentLyr, string displayName, ref Dictionary <string, MSCMapLayer> items) { foreach (MSCMapLayer current in parentLyr.Layers) { if (current.Visible && current.IdentifyResults != null) { if (current.Layers.Count == 0) { if (current.IdentifyResults.Rows.Count != 0) { items.Add(displayName + "-" + current.Name, current); } } else { this.PopulateMapLayerChildList(current, displayName + "-" + current.Name, ref items); } } } }
private void cbMapLayers_SelectionChanged(object sender, SelectionChangedEventArgs e) { MSCMapLayer value = ((KeyValuePair <string, MSCMapLayer>) this.cbMapLayers.SelectedItem).Value; this.dg.ItemsSource = value.IdentifyResults.DefaultView; }