Пример #1
0
        public static void ShowProjectExplorer(bool bVisible)
        {
            // Note that the IsVisible property on the dockable window does not
            // seem to track the state of the window properly. Especially if the user
            // clicks the "Pin" icon to close the dockable window. This seems to be a reliable
            // method for re-opening the dockable window when this happens.
            // http://forums.arcgis.com/threads/11692-ArcGIS10-Add-Ins-and-Dockable-Window
            //
            ESRI.ArcGIS.esriSystem.IUID pUI = new ESRI.ArcGIS.esriSystem.UID();
            pUI.Value = ThisAddIn.IDs.GCDAddIn_ucProjectManager;

            ESRI.ArcGIS.Framework.IDockableWindow docWin = ArcMap.DockableWindowManager.GetDockableWindow((ESRI.ArcGIS.esriSystem.UID)pUI);
            if (docWin is ESRI.ArcGIS.Framework.IDockableWindow)
            {
                docWin.Show(bVisible);

                if (bVisible)
                {
                    try
                    {
                        // Try and refresh the project window.
                        ucProjectManager.AddinImpl winImpl = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID <ucProjectManager.AddinImpl>(ThisAddIn.IDs.GCDAddIn_ucProjectManager);
                        winImpl.UI.LoadTree();
                    }
                    catch (Exception ex)
                    {
                        naru.error.ExceptionUI.HandleException(ex, "Error Opening Project Explorer", GCDCore.Properties.Resources.NewIssueURL);
                    }
                }
            }
        }
Пример #2
0
        protected override void OnClick()
        {
            try
            {
                if (MessageBox.Show("Are you sure that you want to close all riverscapes projects? This will also remove the layers related to these projects from your current map document.",
                                    "Close All Riverscapes Projects?",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    ESRI.ArcGIS.esriSystem.IUID pUI = new ESRI.ArcGIS.esriSystem.UID();
                    pUI.Value = ThisAddIn.IDs.ucProjectExplorer;

                    ESRI.ArcGIS.Framework.IDockableWindow docWin = ArcMap.DockableWindowManager.GetDockableWindow((ESRI.ArcGIS.esriSystem.UID)pUI);
                    if (docWin is ESRI.ArcGIS.Framework.IDockableWindow)
                    {
                        // Try and refresh the project window.
                        ucProjectExplorer.AddinImpl winImpl = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID <ucProjectExplorer.AddinImpl>(ThisAddIn.IDs.ucProjectExplorer);
                        winImpl.UI.CloseAllProjects();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.frmException.HandleException(ex, "Error Closing RAVE Projects", string.Empty);
            }

            ArcMap.Application.CurrentTool = null;
        }
Пример #3
0
        protected override void OnClick()
        {
            try
            {
                frmOptions frm = new frmOptions();
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ESRI.ArcGIS.esriSystem.IUID pUI = new ESRI.ArcGIS.esriSystem.UID();
                    pUI.Value = ThisAddIn.IDs.ucProjectExplorer;

                    ESRI.ArcGIS.Framework.IDockableWindow docWin = ArcMap.DockableWindowManager.GetDockableWindow((ESRI.ArcGIS.esriSystem.UID)pUI);
                    if (docWin is ESRI.ArcGIS.Framework.IDockableWindow)
                    {
                        try
                        {
                            // Try and refresh the project window.
                            ucProjectExplorer.AddinImpl winImpl = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID <ucProjectExplorer.AddinImpl>(ThisAddIn.IDs.ucProjectExplorer);
                            winImpl.UI.RefreshBaseMaps();
                        }
                        catch (Exception ex)
                        {
                            ErrorHandling.frmException.HandleException(ex, "Error showing project explorer.", string.Empty);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.frmException.HandleException(ex, "Error Showing RAVE Options Form", string.Empty);
            }

            ArcMap.Application.CurrentTool = null;
        }
Пример #4
0
        protected override void OnClick()
        {
            try
            {
                OpenFileDialog f = new OpenFileDialog();
                f.DefaultExt      = "xml";
                f.Filter          = "Riverscapes Project Files (*.rs.xml)|*.rs.xml";
                f.Title           = "Open Existing Riverscapes Project";
                f.CheckFileExists = true;

                if (!string.IsNullOrEmpty(RaveAddIn.Properties.Settings.Default.LastUsedProjectFolder) && System.IO.Directory.Exists(RaveAddIn.Properties.Settings.Default.LastUsedProjectFolder))
                {
                    f.InitialDirectory = RaveAddIn.Properties.Settings.Default.LastUsedProjectFolder;

                    // Try and find the last used project in the folder
                    string[] fis = System.IO.Directory.GetFiles(RaveAddIn.Properties.Settings.Default.LastUsedProjectFolder, "*.rs.xml", System.IO.SearchOption.TopDirectoryOnly);
                    if (fis.Length > 0)
                    {
                        f.FileName = System.IO.Path.GetFileName(fis[0]);
                    }
                }

                if (f.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        ESRI.ArcGIS.esriSystem.IUID pUI = new ESRI.ArcGIS.esriSystem.UID();
                        pUI.Value = ThisAddIn.IDs.ucProjectExplorer;

                        ESRI.ArcGIS.Framework.IDockableWindow docWin = ArcMap.DockableWindowManager.GetDockableWindow((ESRI.ArcGIS.esriSystem.UID)pUI);
                        if (docWin is ESRI.ArcGIS.Framework.IDockableWindow)
                        {
                            // Try and refresh the project window.
                            ucProjectExplorer.AddinImpl winImpl = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID <ucProjectExplorer.AddinImpl>(ThisAddIn.IDs.ucProjectExplorer);
                            winImpl.UI.LoadProject(new System.IO.FileInfo(f.FileName));
                        }

                        //ProjectManager.OpenProject(new System.IO.FileInfo(f.FileName));
                        Properties.Settings.Default.LastUsedProjectFolder = System.IO.Path.GetDirectoryName(f.FileName);
                        Properties.Settings.Default.Save();

                        // This will cause the project tree to reload all open projects
                        btnProjectExplorer.ShowProjectExplorer(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(string.Format("Error reading the project file '{0}'. Ensure that the file is a valid project file with valid and complete XML contents.\n\n{1}", f.FileName, ex.Message), Properties.Resources.ApplicationNameLong, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.frmException.HandleException(ex, "Error Opening Project", string.Empty);
            }

            ArcMap.Application.CurrentTool = null;
        }
Пример #5
0
 internal ESRI.ArcGIS.Framework.IDockableWindow GetApplyDockableWindow()
 {
     if (m_dockWindowApply == null)
     {
         ESRI.ArcGIS.esriSystem.UID dockUID = new ESRI.ArcGIS.esriSystem.UIDClass();
         dockUID.Value     = ThisAddIn.IDs.ChampApplyDockableWindow;
         m_dockWindowApply = ArcMap.DockableWindowManager.GetDockableWindow(dockUID);
     }
     return(m_dockWindowApply);
 }
Пример #6
0
        public btnLaunchWindow()
        {
            ESRI.ArcGIS.esriSystem.UID dockWinID = new ESRI.ArcGIS.esriSystem.UIDClass();
            dockWinID.Value = ThisAddIn.IDs.winTextToFeature;

            // Use GetDockableWindow directly as we want the client IDockableWindow not the internal class
            ESRI.ArcGIS.Framework.IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);

            dockWindow.Show(true);
        }
        protected override void OnActivate()
        {
            try
            {
                this.Cursor = Cursors.Cross;

                CurrentDigitTool.CurrentTool.currentDigit = this;

                SetTargetLayer();

                ESRI.ArcGIS.Framework.IDockableWindowManager dockWinMgr = ArcMap.DockableWindowManager;
                UID u = new UID();
                u.Value = "DigitTool_DockableWindowCS";

                if (dockWinMgr == null)
                {
                    return;
                }

                m_dockableWindow = dockWinMgr.GetDockableWindow(u);

                if (m_dockableDigit == null)
                {
                    m_dockableDigit = CurrentDigitTool.CurrentTool.digitDockableWindow;
                }

                if (m_dockableDigit != null)
                {
                    m_dockableDigit.Init(m_schematicLayer);
                }

                m_dockableWindow.Show(true);

                CurrentDigitTool.CurrentTool.currentDockableWindow = m_dockableWindow;
            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message);
            }
        }
        protected override void OnActivate()
        {
            try
            {
                this.Cursor = Cursors.Cross;

                CurrentDigitTool.CurrentTool.currentDigit = this;

                SetTargetLayer();

                ESRI.ArcGIS.Framework.IDockableWindowManager dockWinMgr = ArcMap.DockableWindowManager;
                UID u = new UID();
                u.Value = "DigitTool_DockableWindowCS";

                if (dockWinMgr == null)
                    return;

                m_dockableWindow = dockWinMgr.GetDockableWindow(u);

                if (m_dockableDigit == null)
                    m_dockableDigit = CurrentDigitTool.CurrentTool.digitDockableWindow;

                if (m_dockableDigit != null)
                    m_dockableDigit.Init(m_schematicLayer);

                m_dockableWindow.Show(true);

                CurrentDigitTool.CurrentTool.currentDockableWindow = m_dockableWindow;
            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message);
            }
        }