1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Presentation
8 using System.Collections.Generic;
10 using System.Diagnostics.Eventing;
12 class DesignerPerfEventProvider
14 EventProvider provider = null;
16 public DesignerPerfEventProvider()
20 this.provider = new EventProvider(new Guid("{B5697126-CBAF-4281-A983-7851DAF56454}"));
22 catch (PlatformNotSupportedException)
28 public void WorkflowDesignerApplicationIdleAfterLoad()
32 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerApplicationIdleAfterLoad);
36 public void WorkflowDesignerDeserializeEnd()
40 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerDeserializeEnd);
44 public void WorkflowDesignerDeserializeStart()
48 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerDeserializeStart);
52 public void WorkflowDesignerDrop()
56 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerDrop);
60 public void WorkflowDesignerIdleAfterDrop()
64 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerIdleAfterDrop);
68 public void WorkflowDesignerLoadComplete()
72 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerLoadComplete);
76 public void WorkflowDesignerLoadStart()
80 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerLoadStart);
84 public void WorkflowDesignerSerializeEnd()
88 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerSerializeEnd);
92 public void WorkflowDesignerSerializeStart()
96 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerSerializeStart);
100 public void WorkflowDesignerExpressionEditorCompilationEnd()
102 if (this.IsEnabled())
104 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerExpressionEditorCompilationEnd);
108 public void WorkflowDesignerExpressionEditorCompilationStart()
110 if (this.IsEnabled())
112 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerExpressionEditorCompilationStart);
116 public void WorkflowDesignerExpressionEditorLoaded()
118 if (this.IsEnabled())
120 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerExpressionEditorLoaded);
124 public void WorkflowDesignerExpressionEditorLoadStart()
126 if (this.IsEnabled())
128 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerExpressionEditorLoadStart);
132 public void WorkflowDesignerValidationEnd()
134 if (this.IsEnabled())
136 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerValidationEnd);
140 public void WorkflowDesignerValidationStart()
142 if (this.IsEnabled())
144 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerValidationStart);
148 public void FlowchartDesignerLoadEnd()
150 if (this.IsEnabled())
152 WriteEventHelper((int)DesignerPerfEvents.FlowchartDesignerLoadEnd);
156 public void FlowchartDesignerLoadStart()
158 if (this.IsEnabled())
160 WriteEventHelper((int)DesignerPerfEvents.FlowchartDesignerLoadStart);
164 public void FreeFormPanelMeasureEnd()
166 if (this.IsEnabled())
168 WriteEventHelper((int)DesignerPerfEvents.FreeFormPanelMeasureEnd);
172 public void FreeFormPanelMeasureStart()
174 if (this.IsEnabled())
176 WriteEventHelper((int)DesignerPerfEvents.FreeFormPanelMeasureStart);
180 public void WorkflowDesignerCopyStart()
182 if (this.IsEnabled())
184 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerCopyStart);
188 public void WorkflowDesignerCopyEnd()
190 if (this.IsEnabled())
192 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerCopyEnd);
196 public void WorkflowDesignerPasteStart()
198 if (this.IsEnabled())
200 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerPasteStart);
204 public void WorkflowDesignerPasteEnd()
206 if (this.IsEnabled())
208 WriteEventHelper((int)DesignerPerfEvents.WorkflowDesignerPasteEnd);
212 public void DesignerTreeViewLoadChildrenStart()
214 if (this.IsEnabled())
216 WriteEventHelper((int)DesignerPerfEvents.DesignerTreeViewLoadChildrenStart);
220 public void DesignerTreeViewLoadChildrenEnd()
222 if (this.IsEnabled())
224 WriteEventHelper((int)DesignerPerfEvents.DesignerTreeViewLoadChildrenEnd);
228 public void DesignerTreeViewUpdateStart()
230 if (this.IsEnabled())
232 WriteEventHelper((int)DesignerPerfEvents.DesignerTreeViewUpdateStart);
236 public void DesignerTreeViewUpdateEnd()
238 if (this.IsEnabled())
240 WriteEventHelper((int)DesignerPerfEvents.DesignerTreeViewUpdateEnd);
244 public void DesignerTreeViewExpandStart()
246 if (this.IsEnabled())
248 WriteEventHelper((int)DesignerPerfEvents.DesignerTreeViewExpandStart);
252 public void DesignerTreeViewExpandEnd()
254 if (this.IsEnabled())
256 WriteEventHelper((int)DesignerPerfEvents.DesignerTreeViewExpandEnd);
260 public void TypeBrowserApplicationIdleAfterShowDialog()
262 if (this.IsEnabled())
264 WriteEventHelper((int)DesignerPerfEvents.TypeBrowserApplicationIdleAfterShowDialog);
268 public void TypeBrowserOkPressed()
270 if (this.IsEnabled())
272 WriteEventHelper((int)DesignerPerfEvents.TypeBrowserOkPressed);
276 public void SelectionChangedStart()
278 if (this.IsEnabled())
280 WriteEventHelper((int)DesignerPerfEvents.SelectionChangedStart);
284 public void PropertyInspectorUpdatePropertyListStart()
286 if (this.IsEnabled())
288 WriteEventHelper((int)DesignerPerfEvents.PropertyInspectorUpdatePropertyListStart);
292 public void PropertyInspectorUpdatePropertyListEnd()
294 if (this.IsEnabled())
296 WriteEventHelper((int)DesignerPerfEvents.PropertyInspectorUpdatePropertyListEnd);
300 private bool IsEnabled()
302 bool isEnabled = false;
303 if (this.provider != null)
305 isEnabled = this.provider.IsEnabled();
310 private void WriteEventHelper(int eventId)
312 if (this.provider != null)
314 EventDescriptor descriptor = new EventDescriptor(eventId, 0, 0, 0, 0, 0, 0);
315 this.provider.WriteEvent(ref descriptor);