コード例 #1
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            AddMessage("Connect button clicked.");

            if (!_arcMap.HasOpenDocuments)
            {
                AddMessage("ArcMap has no documents open, trying to open a new document");
                _arcMap.StartNewDocument();
            }
            else
            {
                AddMessage("ArcMap has some documents open");
            }
            if (!_arcMap.HasOpenDocuments)
            {
                AddMessage("Unable to open an ArcMap document");
                return;
            }
            string title = _arcMap.GetTitleFromTopDocument();

            AddMessage("Title of top document = " + title);
            _controller = _arcMap.GetExtensionFromTopDocument();
            if (_controller == null)
            {
                AddMessage("Failed to get DNR GPS/ArcMap Extension");
                return;
            }

            AddMessage("Connected To ArcMap.  Proceed.");
            EnableButtons();
        }
コード例 #2
0
        private static void ArcMapLoad()
        {
            IDnrGpsController ext = Controller.GetExtensionFromTopDocument();

            if (ext == null)
            {
                throw new InvalidOperationException("Failed to load extension in ArcMap");
            }
        }