public int OnDocClose(int destroyType) { if (manager != null && manager.Visible == true) { manager.Close(); manager = null; } if (settings.Visible == true) { settings.Close(); settings = null; } if (exporter != null && !exporter.IsClosed()) { exporter.CloseExporter(); exporter = null; } currentRobot = null; RobotInfo.WriteToLogFile("Doc closed (SwAddin)\n"); return 0; }
public int OnDocChange() { currentRobot = null; currentDoc = null; ModelDoc2 activeDoc = iSwApp.ActiveDoc; if (activeDoc.GetType() == (int)swDocumentTypes_e.swDocASSEMBLY) { currentDoc = (AssemblyDoc)activeDoc; currentDoc.DestroyNotify2 += new DAssemblyDocEvents_DestroyNotify2EventHandler(OnDocClose); currentRobot = new RobotModel(currentDoc, iSwApp); if (manager != null && manager.Visible == true) { manager.Close(); } if (settings!= null && settings.Visible == true) { settings.Close(); } if (exporter != null && !exporter.IsClosed()) { exporter.CloseExporter(); exporter = null; } manager = new ManageRobot(currentRobot); settings = new SettingsForm(manager); } RobotInfo.WriteToLogFile("Doc changed (SwAddin)"); return 0; }