示例#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 VisibleMenuItem_Loaded(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = (MenuItem)sender;

            try
            {
                MSCRasterService mSCRasterService = null;
                try
                {
                    mSCRasterService = ((KeyValuePair <string, MSCMapService>)menuItem.DataContext).Value;
                }
                catch
                {
                    mSCRasterService = ((KeyValuePair <string, MSCImageService>)menuItem.DataContext).Value;
                }
                if (mSCRasterService != null)
                {
                    menuItem.IsChecked = mSCRasterService.Visible;
                }
            }
            catch
            {
                menuItem.IsEnabled = false;
            }
        }
        private void OnToggleVisibility(object sender, RoutedEventArgs e)
        {
            MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();

            if (activeRasterService == null)
            {
                return;
            }
            activeRasterService.ToggleVisiblity();
        }
        private void OnZoomMapService(object sender, RoutedEventArgs e)
        {
            MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();

            if (activeRasterService == null)
            {
                return;
            }
            activeRasterService.ZoomExtents();
        }
        private void OnRefreshMapService(object sender, RoutedEventArgs e)
        {
            MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();

            if (activeRasterService == null)
            {
                return;
            }
            activeRasterService.RefreshService();
            activeRasterService.CheckForUpdates();
        }
        private void OnSendBehind(object sender, RoutedEventArgs e)
        {
            MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();

            if (activeRasterService == null)
            {
                return;
            }
            if (activeRasterService != null)
            {
                activeRasterService.SendBehind();
            }
        }
        public void Execute(object param)
        {
            btnTransparencyPercent btnTransparencyPercent = param as btnTransparencyPercent;

            if (btnTransparencyPercent != null)
            {
                int percentValue = btnTransparencyPercent.PercentValue;
                MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
                if (activeRasterService != null)
                {
                    activeRasterService.SetTransparency(percentValue);
                }
            }
        }
 private void btnTransparency_DropDownOpened(object sender, EventArgs e)
 {
     //try
     //{
     //	MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
     //	if (activeRasterService != null)
     //	{
     //		byte transparency = activeRasterService.GetTransparency();
     //		int num = Convert.ToInt32(10.0 * Math.Floor((double)transparency / 10.0));
     //		using (IEnumerator<RibbonItem> enumerator = base.Items.GetEnumerator())
     //		{
     //			while (enumerator.MoveNext())
     //			{
     //				btnTransparencyPercent btnTransparencyPercent = (btnTransparencyPercent)enumerator.Current;
     //				if (num == btnTransparencyPercent.PercentValue)
     //				{
     //					btnTransparencyPercent.IsChecked=(true);
     //				}
     //				else
     //				{
     //					btnTransparencyPercent.IsChecked=(false);
     //				}
     //			}
     //		}
     //	}
     //}
     //catch
     //{
     //}
     try
     {
         MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
         if (activeRasterService != null)
         {
             int num2 = Convert.ToInt32((double)(10.0 * Math.Floor((double)(((double)activeRasterService.GetTransparency()) / 10.0))));
             foreach (btnTransparencyPercent percent in base.Items)
             {
                 if (num2 == percent.PercentValue)
                 {
                     percent.IsChecked = true;
                     continue;
                 }
                 percent.IsChecked = false;
             }
         }
     }
     catch
     {
     }
 }
示例#9
0
            public void Execute(object param)
            {
                if (Application.DocumentManager.MdiActiveDocument == null)
                {
                    return;
                }
                RibbonButton ribbonButton = param as RibbonButton;

                if (ribbonButton != null)
                {
                    MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
                    if (activeRasterService == null)
                    {
                        Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(AfaStrings.NoCurrentMapServiceFound);
                        return;
                    }
                    activeRasterService.ToggleVisiblity();
                }
            }
示例#10
0
            public void Execute(object param)
            {
                if (Application.DocumentManager.MdiActiveDocument == null)
                {
                    return;
                }
                RibbonButton ribbonButton = param as RibbonButton;

                if (ribbonButton != null)
                {
                    Editor           arg_31_0            = AfaDocData.ActiveDocData.DocDataset.ParentDocument.Editor;
                    MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();
                    if (activeRasterService == null)
                    {
                        Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(AfaStrings.NoCurrentMapServiceFound);
                        return;
                    }
                    activeRasterService.ZoomExtents();
                }
            }
        private void OnToggleDynamicMap(object sender, RoutedEventArgs e)
        {
            MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService();

            if (activeRasterService == null)
            {
                return;
            }
            if (activeRasterService.ParentService == null)
            {
                return;
            }
            if (activeRasterService != null)
            {
                activeRasterService.Dynamic = !activeRasterService.Dynamic;
                activeRasterService.ExportOptions.Dynamic = activeRasterService.Dynamic;
                activeRasterService.Write();
                if (activeRasterService.Dynamic)
                {
                    activeRasterService.RefreshConnectedService();
                }
            }
        }
 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
     {
     }
 }