using SolidWorks.Interop.sldworks; namespace PdmSwPlugin.Main.EventHandler { public class DrwDocEventHandler : BaseEventHandler { DrawingDoc doc; BaseAttacher swPlugin; public DrwDocEventHandler(ModelDoc2 modDoc, BaseAttacher addin) : base(modDoc, addin) { doc = (DrawingDoc)document; swPlugin = addin; } override public bool AttachEventHandlers() { doc.DestroyNotify += new DDrawingDocEvents_DestroyNotifyEventHandler(OnDestroy); doc.NewSelectionNotify += new DDrawingDocEvents_NewSelectionNotifyEventHandler(OnNewSelection); doc.ChangeCustomPropertyNotify += new DDrawingDocEvents_ChangeCustomPropertyNotifyEventHandler(swPlugin.OnActiveDocCustomPropertyChanged); ConnectModelViews(); return true; } override public bool DetachEventHandlers() { doc.DestroyNotify -= new DDrawingDocEvents_DestroyNotifyEventHandler(OnDestroy); doc.NewSelectionNotify -= new DDrawingDocEvents_NewSelectionNotifyEventHandler(OnNewSelection); doc.ChangeCustomPropertyNotify -= new DDrawingDocEvents_ChangeCustomPropertyNotifyEventHandler(swPlugin.OnActiveDocCustomPropertyChanged); DisconnectModelViews(); userAddIn.DetachModelEventHandler(document); return true; } //Event Handlers public int OnDestroy() { DetachEventHandlers(); return 0; } public int OnNewSelection() { return 0; } } }