public void Undo() { if (m_bDone == false) { return; } else { m_bDone = false; } try { IDictionaryEnumerator docsEnumerator = m_docsTable.GetEnumerator(); while (docsEnumerator.MoveNext()) { DictionaryEntry entry = (DictionaryEntry)docsEnumerator.Current; CBoolClass boolClassVar = (CBoolClass)entry.Value; // Continue if events have alrealy been removed from the specific doc if (boolClassVar.ToString().ToLower() == "false") { continue; } m_doc = (Document)entry.Key; m_doc.BeginDocumentClose -= new DocumentBeginCloseEventHandler(callback_BeginDocumentClose); m_doc.CloseAborted -= new EventHandler(callback_CloseAborted); m_doc.CloseWillStart -= new EventHandler(callback_CloseWillStart); m_doc.CommandCancelled -= new CommandEventHandler(callback_CommandCancelled); m_doc.CommandEnded -= new CommandEventHandler(callback_CommandEnded); m_doc.CommandFailed -= new CommandEventHandler(callback_CommandFailed); m_doc.CommandWillStart -= new CommandEventHandler(callback_CommandWillStart); m_doc.LispCancelled -= new EventHandler(callback_LispCancelled); m_doc.LispEnded -= new EventHandler(callback_LispEnded); m_doc.LispWillStart -= new LispWillStartEventHandler(callback_LispWillStart); m_doc.UnknownCommand -= new UnknownCommandEventHandler(callback_UnknownCommand); boolClassVar.val = false; } } catch (System.Exception ex) { Helper.Message(ex); } }
private bool m_bDone; // A flag to indicate if events have been planted. // A counterpart flag to the On option in the UI. public void Do() { if (m_bDone == false) { m_bDone = true; } else // Don't return because we may need to address some new docs. { } try { foreach (DictionaryEntry entry in m_docsTable) { CBoolClass boolClassVar = (CBoolClass)entry.Value; // Continue if events have alrealy planted for the specific doc if (boolClassVar.ToString().ToLower() == "true") { continue; } m_doc = (Document)entry.Key; m_doc.BeginDocumentClose += new DocumentBeginCloseEventHandler(callback_BeginDocumentClose); m_doc.CloseAborted += new EventHandler(callback_CloseAborted); m_doc.CloseWillStart += new EventHandler(callback_CloseWillStart); m_doc.CommandCancelled += new CommandEventHandler(callback_CommandCancelled); m_doc.CommandEnded += new CommandEventHandler(callback_CommandEnded); m_doc.CommandFailed += new CommandEventHandler(callback_CommandFailed); m_doc.CommandWillStart += new CommandEventHandler(callback_CommandWillStart); m_doc.LispCancelled += new EventHandler(callback_LispCancelled); m_doc.LispEnded += new EventHandler(callback_LispEnded); m_doc.LispWillStart += new LispWillStartEventHandler(callback_LispWillStart); m_doc.UnknownCommand += new UnknownCommandEventHandler(callback_UnknownCommand); boolClassVar.val = true; } } catch (System.Exception ex) { Helper.Message(ex); } }
public void UndoADoc(ref Document doc) { try { if (!m_docsTable.Contains(doc)) { return; } CBoolClass boolClassVar = (CBoolClass)m_docsTable[doc]; // Return if events have not been planted for it. if (boolClassVar.ToString().ToLower() == "false") { return; } m_doc = doc; m_doc.BeginDocumentClose -= new DocumentBeginCloseEventHandler(callback_BeginDocumentClose); m_doc.CloseAborted -= new EventHandler(callback_CloseAborted); m_doc.CloseWillStart -= new EventHandler(callback_CloseWillStart); m_doc.CommandCancelled -= new CommandEventHandler(callback_CommandCancelled); m_doc.CommandEnded -= new CommandEventHandler(callback_CommandEnded); m_doc.CommandFailed -= new CommandEventHandler(callback_CommandFailed); m_doc.CommandWillStart -= new CommandEventHandler(callback_CommandWillStart); m_doc.LispCancelled -= new EventHandler(callback_LispCancelled); m_doc.LispEnded -= new EventHandler(callback_LispEnded); m_doc.LispWillStart -= new LispWillStartEventHandler(callback_LispWillStart); m_doc.UnknownCommand -= new UnknownCommandEventHandler(callback_UnknownCommand); boolClassVar.val = false; } catch (System.Exception ex) { Helper.Message(ex); } }
private bool m_bDone; // A flag to indicate if events have been planted. // A counterpart flag to the On option in the UI. public void Do() { if (m_bDone == false) { m_bDone = true; } else // Don't return because we may need to address some new dbs. { } try { foreach (DictionaryEntry entry in m_dbsTable) { CBoolClass boolClassVar = (CBoolClass)entry.Value; // Continue if events have alrealy planted for the specific db if (boolClassVar.ToString().ToLower() == "true") { continue; } m_db = (Database)entry.Key; m_db.AbortDxfIn += new EventHandler(callback_AbortDxfIn); m_db.AbortDxfOut += new EventHandler(callback_AbortDxfOut); m_db.AbortSave += new EventHandler(callback_AbortSave); m_db.BeginDeepClone += new IdMappingEventHandler(callback_BeginDeepClone); m_db.BeginDeepCloneTranslation += new IdMappingEventHandler(callback_BeginDeepCloneTranslation); m_db.BeginDxfIn += new EventHandler(callback_BeginDxfIn); m_db.BeginDxfOut += new EventHandler(callback_BeginDxfOut); m_db.BeginInsert += new BeginInsertEventHandler(callback_BeginInsert); m_db.BeginSave += new DatabaseIOEventHandler(callback_BeginSave); m_db.BeginWblockBlock += new BeginWblockBlockEventHandler(callback_BeginWblockBlock); m_db.BeginWblockEntireDatabase += new BeginWblockEntireDatabaseEventHandler(callback_BeginWblockEntireDatabase); m_db.BeginWblockObjects += new BeginWblockObjectsEventHandler(callback_BeginWblockObjects); m_db.BeginWblockSelectedObjects += new BeginWblockSelectedObjectsEventHandler(callback_BeginWblockSelectedObjects); m_db.DatabaseConstructed += new EventHandler(callback_DatabaseConstructed); m_db.DatabaseToBeDestroyed += new EventHandler(callback_DatabaseToBeDestroyed); m_db.DeepCloneAborted += new EventHandler(callback_DeepCloneAborted); m_db.DeepCloneEnded += new EventHandler(callback_DeepCloneEnded); m_db.Disposed += new EventHandler(callback_Disposed); m_db.DwgFileOpened += new DatabaseIOEventHandler(callback_DwgFileOpened); m_db.DxfInComplete += new EventHandler(callback_DxfInComplete); m_db.DxfOutComplete += new EventHandler(callback_DxfOutComplete); m_db.InitialDwgFileOpenComplete += new EventHandler(callback_InitialDwgFileOpenComplete); m_db.InsertAborted += new EventHandler(callback_InsertAborted); m_db.InsertEnded += new EventHandler(callback_InsertEnded); m_db.InsertMappingAvailable += new IdMappingEventHandler(callback_InsertMappingAvailable); m_db.ObjectAppended += new ObjectEventHandler(callback_ObjectAppended); m_db.ObjectErased += new ObjectErasedEventHandler(callback_ObjectErased); m_db.ObjectModified += new ObjectEventHandler(callback_ObjectModified); m_db.ObjectOpenedForModify += new ObjectEventHandler(callback_ObjectOpenedForModify); m_db.ObjectReappended += new ObjectEventHandler(callback_ObjectReappended); m_db.ObjectUnappended += new ObjectEventHandler(callback_ObjectUnappended); m_db.PartialOpenNotice += new EventHandler(callback_PartialOpenNotice); m_db.ProxyResurrectionCompleted += new ProxyResurrectionCompletedEventHandler(callback_ProxyResurrectionCompleted); m_db.SaveComplete += new DatabaseIOEventHandler(callback_SaveComplete); // Full name to avoid the error of ambiguous reference m_db.SystemVariableChanged += new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangedEventHandler(callback_SystemVariableChanged); // Full name to avoid the error of ambiguous reference m_db.SystemVariableWillChange += new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangingEventHandler(callback_SystemVariableWillChange); m_db.WblockAborted += new EventHandler(callback_WblockAborted); m_db.WblockEnded += new EventHandler(callback_WblockEnded); m_db.WblockMappingAvailable += new IdMappingEventHandler(callback_WblockMappingAvailable); m_db.WblockNotice += new WblockNoticeEventHandler(callback_WblockNotice); m_db.XrefAttachAborted += new EventHandler(callback_XrefAttachAborted); m_db.XrefAttachEnded += new EventHandler(callback_XrefAttachEnded); m_db.XrefBeginAttached += new XrefBeginOperationEventHandler(callback_XrefBeginAttached); m_db.XrefBeginOtherAttached += new XrefBeginOperationEventHandler(callback_XrefBeginOtherAttached); m_db.XrefBeginRestore += new XrefBeginOperationEventHandler(callback_XrefBeginRestore); m_db.XrefComandeered += new XrefComandeeredEventHandler(callback_XrefComandeered); m_db.XrefRedirected += new XrefRedirectedEventHandler(callback_XrefRedirected); m_db.XrefRestoreAborted += new EventHandler(callback_XrefRestoreAborted); m_db.XrefRestoreEnded += new EventHandler(callback_XrefRestoreEnded); boolClassVar.val = true; } } catch (System.Exception ex) { Helper.Message(ex); } }
public void UndoADb(ref Database db) { if (m_bDone == false) { return; } else { m_bDone = false; } try { if (!m_dbsTable.Contains(db)) { return; } CBoolClass boolClassVar = (CBoolClass)m_dbsTable[db]; // Return if events have not been planted for it. if (boolClassVar.ToString().ToLower() == "false") { return; } m_db = db; m_db.AbortDxfIn -= new EventHandler(callback_AbortDxfIn); m_db.AbortDxfOut -= new EventHandler(callback_AbortDxfOut); m_db.AbortSave -= new EventHandler(callback_AbortSave); m_db.BeginDeepClone -= new IdMappingEventHandler(callback_BeginDeepClone); m_db.BeginDeepCloneTranslation -= new IdMappingEventHandler(callback_BeginDeepCloneTranslation); m_db.BeginDxfIn -= new EventHandler(callback_BeginDxfIn); m_db.BeginDxfOut -= new EventHandler(callback_BeginDxfOut); m_db.BeginInsert -= new BeginInsertEventHandler(callback_BeginInsert); m_db.BeginSave -= new DatabaseIOEventHandler(callback_BeginSave); m_db.BeginWblockBlock -= new BeginWblockBlockEventHandler(callback_BeginWblockBlock); m_db.BeginWblockEntireDatabase -= new BeginWblockEntireDatabaseEventHandler(callback_BeginWblockEntireDatabase); m_db.BeginWblockObjects -= new BeginWblockObjectsEventHandler(callback_BeginWblockObjects); m_db.BeginWblockSelectedObjects -= new BeginWblockSelectedObjectsEventHandler(callback_BeginWblockSelectedObjects); m_db.DatabaseConstructed -= new EventHandler(callback_DatabaseConstructed); m_db.DatabaseToBeDestroyed -= new EventHandler(callback_DatabaseToBeDestroyed); m_db.DeepCloneAborted -= new EventHandler(callback_DeepCloneAborted); m_db.DeepCloneEnded -= new EventHandler(callback_DeepCloneEnded); m_db.Disposed -= new EventHandler(callback_Disposed); m_db.DwgFileOpened -= new DatabaseIOEventHandler(callback_DwgFileOpened); m_db.DxfInComplete -= new EventHandler(callback_DxfInComplete); m_db.DxfOutComplete -= new EventHandler(callback_DxfOutComplete); m_db.InitialDwgFileOpenComplete -= new EventHandler(callback_InitialDwgFileOpenComplete); m_db.InsertAborted -= new EventHandler(callback_InsertAborted); m_db.InsertEnded -= new EventHandler(callback_InsertEnded); m_db.InsertMappingAvailable -= new IdMappingEventHandler(callback_InsertMappingAvailable); m_db.ObjectAppended -= new ObjectEventHandler(callback_ObjectAppended); m_db.ObjectErased -= new ObjectErasedEventHandler(callback_ObjectErased); m_db.ObjectModified -= new ObjectEventHandler(callback_ObjectModified); m_db.ObjectOpenedForModify -= new ObjectEventHandler(callback_ObjectOpenedForModify); m_db.ObjectReappended -= new ObjectEventHandler(callback_ObjectReappended); m_db.ObjectUnappended -= new ObjectEventHandler(callback_ObjectUnappended); m_db.PartialOpenNotice -= new EventHandler(callback_PartialOpenNotice); m_db.ProxyResurrectionCompleted -= new ProxyResurrectionCompletedEventHandler(callback_ProxyResurrectionCompleted); m_db.SaveComplete -= new DatabaseIOEventHandler(callback_SaveComplete); // Full name to avoid the error of ambiguous reference m_db.SystemVariableChanged -= new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangedEventHandler(callback_SystemVariableChanged); // Full name to avoid the error of ambiguous reference m_db.SystemVariableWillChange -= new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangingEventHandler(callback_SystemVariableWillChange); m_db.WblockAborted -= new EventHandler(callback_WblockAborted); m_db.WblockEnded -= new EventHandler(callback_WblockEnded); m_db.WblockMappingAvailable -= new IdMappingEventHandler(callback_WblockMappingAvailable); m_db.WblockNotice -= new WblockNoticeEventHandler(callback_WblockNotice); m_db.XrefAttachAborted -= new EventHandler(callback_XrefAttachAborted); m_db.XrefAttachEnded -= new EventHandler(callback_XrefAttachEnded); m_db.XrefBeginAttached -= new XrefBeginOperationEventHandler(callback_XrefBeginAttached); m_db.XrefBeginOtherAttached -= new XrefBeginOperationEventHandler(callback_XrefBeginOtherAttached); m_db.XrefBeginRestore -= new XrefBeginOperationEventHandler(callback_XrefBeginRestore); m_db.XrefComandeered -= new XrefComandeeredEventHandler(callback_XrefComandeered); m_db.XrefRedirected -= new XrefRedirectedEventHandler(callback_XrefRedirected); m_db.XrefRestoreAborted -= new EventHandler(callback_XrefRestoreAborted); m_db.XrefRestoreEnded -= new EventHandler(callback_XrefRestoreEnded); boolClassVar.val = false; } catch (System.Exception ex) { Helper.Message(ex); } }
public void Undo() { if (m_bDone == false) { return; } else { m_bDone = false; } try { IDictionaryEnumerator docsEnumerator = m_dbsTable.GetEnumerator(); while (docsEnumerator.MoveNext()) { DictionaryEntry entry = (DictionaryEntry)docsEnumerator.Current; CBoolClass boolClassVar = (CBoolClass)entry.Value; // Continue if events have alrealy been removed from the specific doc if (boolClassVar.ToString().ToLower() == "false") { continue; } m_db = (Database)entry.Key; m_db.AbortDxfIn -= new EventHandler(callback_AbortDxfIn); m_db.AbortDxfOut -= new EventHandler(callback_AbortDxfOut); m_db.AbortSave -= new EventHandler(callback_AbortSave); m_db.BeginDeepClone -= new IdMappingEventHandler(callback_BeginDeepClone); m_db.BeginDeepCloneTranslation -= new IdMappingEventHandler(callback_BeginDeepCloneTranslation); m_db.BeginDxfIn -= new EventHandler(callback_BeginDxfIn); m_db.BeginDxfOut -= new EventHandler(callback_BeginDxfOut); m_db.BeginInsert -= new BeginInsertEventHandler(callback_BeginInsert); m_db.BeginSave -= new DatabaseIOEventHandler(callback_BeginSave); m_db.BeginWblockBlock -= new BeginWblockBlockEventHandler(callback_BeginWblockBlock); m_db.BeginWblockEntireDatabase -= new BeginWblockEntireDatabaseEventHandler(callback_BeginWblockEntireDatabase); m_db.BeginWblockObjects -= new BeginWblockObjectsEventHandler(callback_BeginWblockObjects); m_db.BeginWblockSelectedObjects -= new BeginWblockSelectedObjectsEventHandler(callback_BeginWblockSelectedObjects); m_db.DatabaseConstructed -= new EventHandler(callback_DatabaseConstructed); m_db.DatabaseToBeDestroyed -= new EventHandler(callback_DatabaseToBeDestroyed); m_db.DeepCloneAborted -= new EventHandler(callback_DeepCloneAborted); m_db.DeepCloneEnded -= new EventHandler(callback_DeepCloneEnded); m_db.Disposed -= new EventHandler(callback_Disposed); m_db.DwgFileOpened -= new DatabaseIOEventHandler(callback_DwgFileOpened); m_db.DxfInComplete -= new EventHandler(callback_DxfInComplete); m_db.DxfOutComplete -= new EventHandler(callback_DxfOutComplete); m_db.InitialDwgFileOpenComplete -= new EventHandler(callback_InitialDwgFileOpenComplete); m_db.InsertAborted -= new EventHandler(callback_InsertAborted); m_db.InsertEnded -= new EventHandler(callback_InsertEnded); m_db.InsertMappingAvailable -= new IdMappingEventHandler(callback_InsertMappingAvailable); m_db.ObjectAppended -= new ObjectEventHandler(callback_ObjectAppended); m_db.ObjectErased -= new ObjectErasedEventHandler(callback_ObjectErased); m_db.ObjectModified -= new ObjectEventHandler(callback_ObjectModified); m_db.ObjectOpenedForModify -= new ObjectEventHandler(callback_ObjectOpenedForModify); m_db.ObjectReappended -= new ObjectEventHandler(callback_ObjectReappended); m_db.ObjectUnappended -= new ObjectEventHandler(callback_ObjectUnappended); m_db.PartialOpenNotice -= new EventHandler(callback_PartialOpenNotice); m_db.ProxyResurrectionCompleted -= new ProxyResurrectionCompletedEventHandler(callback_ProxyResurrectionCompleted); m_db.SaveComplete -= new DatabaseIOEventHandler(callback_SaveComplete); // Full name to avoid the error of ambiguous reference m_db.SystemVariableChanged -= new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangedEventHandler(callback_SystemVariableChanged); // Full name to avoid the error of ambiguous reference m_db.SystemVariableWillChange -= new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangingEventHandler(callback_SystemVariableWillChange); m_db.WblockAborted -= new EventHandler(callback_WblockAborted); m_db.WblockEnded -= new EventHandler(callback_WblockEnded); m_db.WblockMappingAvailable -= new IdMappingEventHandler(callback_WblockMappingAvailable); m_db.WblockNotice -= new WblockNoticeEventHandler(callback_WblockNotice); m_db.XrefAttachAborted -= new EventHandler(callback_XrefAttachAborted); m_db.XrefAttachEnded -= new EventHandler(callback_XrefAttachEnded); m_db.XrefBeginAttached -= new XrefBeginOperationEventHandler(callback_XrefBeginAttached); m_db.XrefBeginOtherAttached -= new XrefBeginOperationEventHandler(callback_XrefBeginOtherAttached); m_db.XrefBeginRestore -= new XrefBeginOperationEventHandler(callback_XrefBeginRestore); m_db.XrefComandeered -= new XrefComandeeredEventHandler(callback_XrefComandeered); m_db.XrefRedirected -= new XrefRedirectedEventHandler(callback_XrefRedirected); m_db.XrefRestoreAborted -= new EventHandler(callback_XrefRestoreAborted); m_db.XrefRestoreEnded -= new EventHandler(callback_XrefRestoreEnded); boolClassVar.val = false; } } catch (System.Exception ex) { Helper.Message(ex); } }