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(); }
private static void ArcMapLoad() { IDnrGpsController ext = Controller.GetExtensionFromTopDocument(); if (ext == null) { throw new InvalidOperationException("Failed to load extension in ArcMap"); } }