protected override void OnStartup() { s_extension = this; Initialize(); UID editorUID = new UID(); editorUID.Value = "esriEditor.Editor"; this.m_editor = ArcMap.Application.FindExtensionByCLSID(editorUID) as IEditor; Events.OnStartEditing += new IEditEvents_OnStartEditingEventHandler(Events_OnStartEditing); Events.OnStopEditing += new IEditEvents_OnStopEditingEventHandler(Events_OnStopEditing); m_map = ArcMap.Document.FocusMap; try { if (CMedToolsSubs.ensureSettingsFile()) { setConstVals(); } else { System.Windows.Forms.MessageBox.Show(SConst.OrganizationName + " GIS Error: settings not found"); // //this.State = ExtensionState.Disabled; } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "STARTUP ERROR!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
public void Startup(ref object initializationData) { try { if (CMedToolsSubs.ensureSettingsFile()) { //CMedToolsSubs.returnSettingValue("Task_User_Pwd", SConst.DataSettingsLocation).ToString(); m_pApplication = initializationData as IApplication; Dictionary <string, string> dctMapLayers = new Dictionary <string, string>(); dctMapLayers = SConst.PlanningLayers; //if (CMedToolsSubs.canConnect(SConst.LXConnString)) // SConst.GotDBConn = true; //else // SConst.GotDBConn = false; // -------------------------- // 4-16-2008 // DJR // -- added so that we can listen for OnSaveEdits editor event // -- begin changes // -------------------------- UID editorUID = new UID(); editorUID.Value = "esriEditor.Editor"; if (m_pApplication == null) { return; } setConstVals(); // -------------------------- // end changes // -------------------------- //m_pExtState = esriExtensionState.esriESEnabled; this.State = esriExtensionState.esriESEnabled; } else { System.Windows.Forms.MessageBox.Show(SConst.OrganizationName + " GIS Error: settings not found"); this.State = esriExtensionState.esriESDisabled; } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "STARTUP ERROR!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }