Пример #1
0
            public void Execute(object param)
            {
                RibbonButton ribbonButton = param as RibbonButton;

                if (ribbonButton != null)
                {
                    if (Application.DocumentManager.MdiActiveDocument == null)
                    {
                        return;
                    }
                    MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
                    if (activeRasterService == null)
                    {
                        Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(AfaStrings.NoCurrentMapServiceFound);
                        return;
                    }
                    if (activeRasterService.GetType() == typeof(MSCMapService))
                    {
                        MSCMapService mSCMapService = (MSCMapService)activeRasterService;
                        mSCMapService.DeleteService();
                        return;
                    }
                    if (activeRasterService.GetType() == typeof(MSCImageService))
                    {
                        MSCImageService mSCImageService = (MSCImageService)activeRasterService;
                        mSCImageService.DeleteService();
                        return;
                    }
                    Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(AfaStrings.NoCurrentMapServiceFound);
                }
            }
 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();
     }
 }
 private void OnDeleteMapService(object sender, RoutedEventArgs e)
 {
     try
     {
         MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
         if (activeRasterService != null)
         {
             if (activeRasterService.GetType() == typeof(MSCMapService))
             {
                 MSCMapService mSCMapService = (MSCMapService)activeRasterService;
                 mSCMapService.DeleteService();
             }
             else if (activeRasterService.GetType() == typeof(MSCImageService))
             {
                 MSCImageService mSCImageService = (MSCImageService)activeRasterService;
                 mSCImageService.DeleteService();
             }
             MSCDataset.SetDefaultActiveRasterServices();
         }
     }
     catch
     {
     }
 }