/// <summary> /// Implement this method to implement the external application which should be called when /// Revit starts before a file or default template is actually loaded. /// </summary> /// <param name="application">An object that is passed to the external application /// which contains the controlled application.</param> /// <returns>Return the status of the external application. /// A result of Succeeded means that the external application successfully started. /// Cancelled can be used to signify that the user cancelled the external operation at /// some point. /// If false is returned then Revit should inform the user that the external application /// failed to load and the release the internal reference.</returns> public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { // initialize member variables. m_ctrlApp = application; m_logManager = new LogManager(); m_infWindows = new EventsInfoWindows(m_logManager); m_settingDialog = new EventsSettingForm(); m_appEventsSelection = new List <string>(); m_appEventMgr = new EventManager(m_ctrlApp); #if !(Debug || DEBUG) m_journalProcessor = new JournalProcessor(); #endif try { #if !(Debug || DEBUG) // playing journal. if (m_journalProcessor.IsReplay) { m_appEventsSelection = m_journalProcessor.EventsList; } // running the sample form UI. else { #endif m_settingDialog.ShowDialog(); if (DialogResult.OK == m_settingDialog.DialogResult) { //get what user select. m_appEventsSelection = m_settingDialog.AppSelectionList; } #if !(Debug || DEBUG) // dump what user select to a file in order to autotesting. m_journalProcessor.DumpEventsListToFile(m_appEventsSelection); } #endif // update the events according to the selection. m_appEventMgr.Update(m_appEventsSelection); // track the selected events by showing the information in the information windows. m_infWindows.Show(); // add menu item in Revit menu bar to provide an approach to // retrieve events setting form. User can change his choices // by calling the setting form again. AddCustomPanel(application); } catch (Exception) { return(Autodesk.Revit.UI.Result.Failed); } return(Autodesk.Revit.UI.Result.Succeeded); }
/// <summary> /// Dispose some resource. /// </summary> public static void Dispose() { if (m_infWindows != null) { m_infWindows.Close(); m_infWindows = null; } if (m_settingDialog != null) { m_settingDialog.Close(); m_settingDialog = null; } m_appEventMgr = null; m_logManager.CloseLogFile(); m_logManager = null; }
/// <summary> /// Implement this method to implement the external application which should be called when /// Revit starts before a file or default template is actually loaded. /// </summary> /// <param name="application">An object that is passed to the external application /// which contains the controlled application.</param> /// <returns>Return the status of the external application. /// A result of Succeeded means that the external application successfully started. /// Cancelled can be used to signify that the user cancelled the external operation at /// some point. /// If false is returned then Revit should inform the user that the external application /// failed to load and the release the internal reference.</returns> public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { // initialize member variables. m_ctrlApp = application; m_logManager = new LogManager(); m_infWindows = new EventsInfoWindows(m_logManager); m_settingDialog = new EventsSettingForm(); m_appEventsSelection = new List<string>(); m_appEventMgr = new EventManager(m_ctrlApp); #if !(Debug || DEBUG) m_journalProcessor = new JournalProcessor(); #endif try { #if !(Debug || DEBUG) // playing journal. if (m_journalProcessor.IsReplay) { m_appEventsSelection = m_journalProcessor.EventsList; } // running the sample form UI. else { #endif m_settingDialog.ShowDialog(); if (DialogResult.OK == m_settingDialog.DialogResult) { //get what user select. m_appEventsSelection = m_settingDialog.AppSelectionList; } #if !(Debug || DEBUG) // dump what user select to a file in order to autotesting. m_journalProcessor.DumpEventsListToFile(m_appEventsSelection); } #endif // update the events according to the selection. m_appEventMgr.Update(m_appEventsSelection); // track the selected events by showing the information in the information windows. m_infWindows.Show(); // add menu item in Revit menu bar to provide an approach to // retrieve events setting form. User can change his choices // by calling the setting form again. AddCustomPanel(application); } catch (Exception) { return Autodesk.Revit.UI.Result.Failed; } return Autodesk.Revit.UI.Result.Succeeded; }