/// <summary>
        /// Given a map project item's path (URL) this method opens a map if it has not already been opened
        /// this method is important since some functionality like bookmarks are not accessible if the map
        /// has not been opened and activated
        /// </summary>
        /// <param name="url"></param>
        internal static async void OpenAndActivateMap(string url)
        {
            Map map = MapView.Active.Map;

            bool bAlreadyOpen = false;

            // if not null - it may be open
            if (map != null)
            {
                // see if its already open
                //IList<IMapPane> mapPanes = MappingModule.GetMapPanes(map);
                PaneCollection mapPanes = FrameworkApplication.Panes;
                if ((mapPanes != null) && (mapPanes.Count > 0))
                {
                    bAlreadyOpen = true;

                    // activate the first one
                    Pane pane = mapPanes[0] as Pane;
                    if (pane != FrameworkApplication.Panes.ActivePane)
                    {
                        pane.Activate();
                    }
                }
            }

            // if not open - open it
            if (!bAlreadyOpen)
            {
                var mapItem = Project.Current.Items.FirstOrDefault(i => i.Path == url) as MapProjectItem;
                map = mapItem.GetMap();
                await ProApp.Panes.CreateMapPaneAsync(map);
            }
        }
Ejemplo n.º 2
0
 /// <include file='CodeDoc\DockContent.xml' path='//CodeDoc/Class[@name="DockContent"]/Method[@name="Activate()"]/*'/>
 public new void Activate()
 {
     if (DockPanel == null)
     {
         base.Activate();
     }
     else if (Pane == null)
     {
         Show(DockPanel);
     }
     else
     {
         IsHidden           = false;
         Pane.ActiveContent = this;
         Pane.Activate();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// utility function to open and activate a map given the map url.
        /// </summary>
        /// <param name="url">unique map identifier</param>
        internal static async void OpenAndActivateMap(string url)
        {
            // find the map; returns null if map has never been opened in the Pro session
            Map map = MappingModule.FindMap(url);

            // default viewing mode
            MapViewingMode mode         = MapViewingMode.Item2D;
            bool           bAlreadyOpen = false;

            // if returns null - it has never been opened
            if (map == null)
            {
                // find the map mode (2d / 3d from the project items)
                MapProjectItem mapPI = ProjectModule.CurrentProject.GetMaps().FirstOrDefault(m => m.Path == url);
                if (mapPI != null)
                {
                    mode = mapPI.ViewingMode;
                }
            }
            else
            {
                mode = map.ViewingMode;

                // see if its already open
                IList <IMapPane> mapPanes = MappingModule.GetMapPanes(map);
                if ((mapPanes != null) && (mapPanes.Count > 0))
                {
                    bAlreadyOpen = true;

                    // activate the first one
                    Pane pane = mapPanes[0] as Pane;
                    if (pane != FrameworkApplication.Panes.ActivePane)
                    {
                        pane.Activate();
                    }
                }
            }

            // open it with the correct mode
            if (!bAlreadyOpen)
            {
                var mapPane = MappingModule.OpenMapView(url, mode);
                await Utils.BlockUntil(() => mapPane.MapView != null && mapPane.MapView.ViewerID >= 0);
            }
        }
Ejemplo n.º 4
0
        private static void InstallRibbonTab(Window ewI, string captionString, Microsoft.Office.Interop.Excel.Application eA)
        {
            dynamic a  = eA.ActiveSheet;
            Pane    aa = ewI.ActivePane;

            Microsoft.Office.Interop.Excel.Workbook b = eA.ActiveWorkbook;
            MenuBar c       = eA.ActiveMenuBar;
            String  Caption = ewI.Caption;

            Debug.WriteLine(String.Format("Window #		{0} ", ewI.WindowNumber));
            Debug.WriteLine(String.Format("Caption		{0} ", Caption));
            Debug.WriteLine(String.Format("Window State	{0} ", ewI.WindowState));
            Debug.WriteLine(String.Format("Names.Count  {0} ", eA.Names.Count));
            Ribbon uuu = eA.ActiveMenuBar as Ribbon;

            foreach (object n in eA.Names)
            {
                String nameString = n.ToString( );
                Debug.WriteLine(String.Format("Application.Name	{0} ", nameString));
            }
            Debug.WriteLine(String.Format("pane index	{0} ", aa.Index));
            Debug.WriteLine(String.Format("Menus Count	{0} ", c.Menus.Count));
            Menus ccc = c.Menus;

            foreach (object ra in ccc)
            {
                RibbonApplicationMenuItem dd = ra as RibbonApplicationMenuItem;
                String ddd = dd.ToolTipDescription;

                System.Diagnostics.Debug.WriteLine(String.Format("{0} {1} ", dd, (((System.Environment.StackTrace).Split('\n')) [2].Trim( ))));
            }
            var d = c.Menus;
            var e = d.Add("my Menu");
            var f = e.MenuItems.Add("my Menu Items Added");

            ewI.Activate( );
            aa.Activate( );
        }
Ejemplo n.º 5
0
 public void Activate()
 {
     Pane.Activate();
 }
Ejemplo n.º 6
0
 public void Clear()
 {
     Pane.Clear();
     Pane.Activate();
 }
Ejemplo n.º 7
0
 private void ActivePane()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     Pane.Activate();
 }