forked from pavel-mxsf/EventLister
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListControl.xaml.cs
215 lines (207 loc) · 8.3 KB
/
ListControl.xaml.cs
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
using System;
using System.Windows;
using System.Windows.Controls;
using Autodesk.Max;
using Autodesk.Max.Plugins;
namespace EventsListControl
{
public partial class ListControl : UserControl
{
public ListControl()
{
InitializeComponent();
foreach (SystemNotificationCode systemNotificationCode in Enum.GetValues(typeof(SystemNotificationCode)))
{
GlobalInterface.Instance.RegisterNotification((new GlobalDelegates.Delegate5(OnChanged)), null, systemNotificationCode);
}
MyCallback cb = new MyCallback(listView);
IISceneEventManager sceneEventMgr = Global.ISceneEventManager;
sceneEventMgr.RegisterCallback(cb, false, 50, true);
}
private void OnChanged(IntPtr obj, IntPtr info)
{
string str = DateTime.Now.ToShortTimeString() + "Notification: ";
INotifyInfo inf = Global.NotifyInfo.Marshal(info);
str += inf.CallParam + " .. ";
str += (SystemNotificationCode) inf.Intcode;
listView.Items.Add(str);
listView.ScrollIntoView(listView.Items[listView.Items.Count - 1]);
}
private class MyCallback : INodeEventCallback
{
private ListView listView;
public MyCallback(ListView lv)
{
listView = lv;
}
private void DoLog(ITab<UIntPtr> nodes, string name)
{
string str = DateTime.Now.ToShortTimeString() + "CallbackEvent: " + name + " .. ";
str += nodes.Count + " node(s) -- ";
for (int i = 0; i < nodes.Count; i++)
{
using (var n = Global.NodeEventNamespace.GetNodeByKey(nodes[(IntPtr)i]))
{
if (n == null) throw new ArgumentNullException("nodes");
str += n.Name+" ";
}
}
listView.Items.Add(str);
listView.ScrollIntoView(listView.Items[listView.Items.Count - 1]);
}
public override void Added(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void Deleted(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void LinkChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void LayerChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void GroupChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void HierarchyOtherEvent(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void ModelStructured(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void GeometryChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void TopologyChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void MappingChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void ExtentionChannelChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void ModelOtherEvent(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void MaterialStructured(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void MaterialOtherEvent(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void ControllerStructured(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void ControllerOtherEvent(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void NameChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void WireColorChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void RenderPropertiesChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void DisplayPropertiesChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void UserPropertiesChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void PropertiesOtherEvent(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void SubobjectSelectionChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void SelectionChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void HideChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void FreezeChanged(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
public override void DisplayOtherEvent(ITab<UIntPtr> nodes)
{
string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
DoLog(nodes, name);
}
}
public static IInterface14 Interface
{
get
{
return Global.COREInterface14;
}
}
public static IGlobal Global
{
get
{
return GlobalInterface.Instance;
}
}
private void OnClearClick(object sender, RoutedEventArgs e)
{
listView.Items.Clear();
}
}
}