chr
2024-08-07 22beee93f14d042aa184148c53efb79e23416526
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using SolidWorks.Interop.sldworks;
 
namespace PdmSwPlugin.Main.EventHandler
{
    public class DocViewEventHandler
    {
        ISldWorks iSwApp;
        IEventAttacher userAddin;
        ModelView mView;
        BaseEventHandler parent;
 
        public DocViewEventHandler(IEventAttacher addin, IModelView mv, BaseEventHandler parent)
        {
            userAddin = addin;
            mView = (ModelView)mv;
            iSwApp = userAddin.SwApp;
            this.parent = parent;
        }
 
        public bool AttachEventHandlers()
        {
            mView.DestroyNotify2 += new DModelViewEvents_DestroyNotify2EventHandler(OnDestroy);
            mView.RepaintNotify += new DModelViewEvents_RepaintNotifyEventHandler(OnRepaint);
            return true;
        }
 
        public bool DetachEventHandlers()
        {
            mView.DestroyNotify2 -= new DModelViewEvents_DestroyNotify2EventHandler(OnDestroy);
            mView.RepaintNotify -= new DModelViewEvents_RepaintNotifyEventHandler(OnRepaint);
            parent.DetachModelViewEventHandler(mView);
            return true;
        }
 
        //EventHandlers
        public int OnDestroy(int destroyType)
        {
            return 0;
        }
 
        public int OnRepaint(int repaintType)
        {
            return 0;
        }
    }
}