4
4
using Microsoft . Crm . Sdk . Messages ;
5
5
using Microsoft . Xrm . Sdk ;
6
6
using Microsoft . Xrm . Sdk . Query ;
7
- using Rappen . XTB . Helpers . Serialization ;
7
+ using Rappen . XRM . Helpers . Serialization ;
8
8
using System ;
9
9
using System . Collections . Generic ;
10
10
using System . Diagnostics ;
@@ -24,8 +24,10 @@ namespace Cinteros.XTB.PluginTraceViewer
24
24
public partial class PluginTraceViewer : PluginControlBase , IGitHubPlugin , IMessageBusHost , IHelpPlugin , IPayPalPlugin , IStatusBarMessenger , IShortcutReceiver , IAboutPlugin
25
25
{
26
26
private const string aiEndpoint = "https://dc.services.visualstudio.com/v2/track" ;
27
- //private const string aiKey = "cc7cb081-b489-421d-bb61-2ee53495c336"; // [email protected] tenant, TestAI
27
+
28
+ //private const string aiKey = "cc7cb081-b489-421d-bb61-2ee53495c336"; // [email protected] tenant, TestAI
28
29
private const string aiKey = "eed73022-2444-45fd-928b-5eebd8fa46a6" ; // [email protected] tenant, XrmToolBox
30
+
29
31
private AppInsights ai = new AppInsights ( aiEndpoint , aiKey , Assembly . GetExecutingAssembly ( ) , "Plugin Trace Viewer" ) ;
30
32
31
33
internal GridControl gridControl ;
@@ -85,14 +87,19 @@ private IDockContent dockDeSerialization(string persistString)
85
87
{
86
88
case "Cinteros.XTB.PluginTraceViewer.Controls.GridControl" :
87
89
return gridControl ;
90
+
88
91
case "Cinteros.XTB.PluginTraceViewer.Controls.FilterControl" :
89
92
return filterControl ;
93
+
90
94
case "Cinteros.XTB.PluginTraceViewer.Controls.StatsControl" :
91
95
return statsControl ;
96
+
92
97
case "Cinteros.XTB.PluginTraceViewer.Controls.TraceControl" :
93
98
return traceControl ;
99
+
94
100
case "Cinteros.XTB.PluginTraceViewer.Controls.ExceptionControl" :
95
101
return exceptionControl ;
102
+
96
103
default :
97
104
return null ;
98
105
}
@@ -109,6 +116,7 @@ private IDockContent dockDeSerialization(string persistString)
109
116
public string EmailAccount => "[email protected] " ;
110
117
111
118
public event EventHandler < MessageBusEventArgs > OnOutgoingMessage ;
119
+
112
120
public event EventHandler < StatusBarMessageEventArgs > SendMessageToStatusBar ;
113
121
114
122
public void OnIncomingMessage ( MessageBusEventArgs message )
@@ -144,78 +152,93 @@ private PTVFilter ParseFilterArgs(string strarg)
144
152
case "plugin" :
145
153
result . Plugin = value ;
146
154
break ;
155
+
147
156
case "message" :
148
157
result . Message = value ;
149
158
break ;
159
+
150
160
case "entity" :
151
161
result . Entity = value ;
152
162
break ;
163
+
153
164
case "correlationid" :
154
165
result . CorrelationId = value ;
155
166
break ;
167
+
156
168
case PluginTraceLog . RequestId :
157
169
result . RequestId = value ;
158
170
break ;
171
+
159
172
case "exceptionsonly" :
160
173
if ( bool . TryParse ( value , out bool exceptions ) )
161
174
{
162
175
result . Exceptions = exceptions ;
163
176
}
164
177
break ;
178
+
165
179
case "plugins" :
166
180
if ( bool . TryParse ( value , out bool plugins ) )
167
181
{
168
182
result . Exceptions = plugins ;
169
183
}
170
184
break ;
185
+
171
186
case "workflows" :
172
187
if ( bool . TryParse ( value , out bool workflows ) )
173
188
{
174
189
result . Exceptions = workflows ;
175
190
}
176
191
break ;
192
+
177
193
case "sync" :
178
194
if ( bool . TryParse ( value , out bool sync ) )
179
195
{
180
196
result . Exceptions = sync ;
181
197
}
182
198
break ;
199
+
183
200
case "async" :
184
201
if ( bool . TryParse ( value , out bool async ) )
185
202
{
186
203
result . Exceptions = async;
187
204
}
188
205
break ;
206
+
189
207
case "preval" :
190
208
if ( bool . TryParse ( value , out bool preval ) )
191
209
{
192
210
result . Exceptions = preval ;
193
211
}
194
212
break ;
213
+
195
214
case "preop" :
196
215
if ( bool . TryParse ( value , out bool preop ) )
197
216
{
198
217
result . Exceptions = preop ;
199
218
}
200
219
break ;
220
+
201
221
case "postop" :
202
222
if ( bool . TryParse ( value , out bool postop ) )
203
223
{
204
224
result . Exceptions = postop ;
205
225
}
206
226
break ;
227
+
207
228
case "durationmin" :
208
229
if ( int . TryParse ( value , out int durationmin ) )
209
230
{
210
231
result . MinDuration = durationmin ;
211
232
}
212
233
break ;
234
+
213
235
case "durationmax" :
214
236
if ( int . TryParse ( value , out int durationmax ) )
215
237
{
216
238
result . MinDuration = durationmax ;
217
239
}
218
240
break ;
241
+
219
242
case "records" :
220
243
if ( int . TryParse ( value , out int records ) )
221
244
{
@@ -318,17 +341,20 @@ private void ShowLogSettingWarning(PluginCloseInfo info)
318
341
case DialogResult . Yes :
319
342
UpdateLogSetting ( 0 ) ;
320
343
break ;
344
+
321
345
case DialogResult . No :
322
346
switch ( MessageBox . Show ( "Continue showing this warning for this organization?" , "Trace Log Setting" , MessageBoxButtons . YesNoCancel , MessageBoxIcon . Question ) )
323
347
{
324
348
case DialogResult . No :
325
349
tsmiSuppressLogSettingWarning . Checked = true ;
326
350
break ;
351
+
327
352
case DialogResult . Cancel :
328
353
info . Cancel = true ;
329
354
break ;
330
355
}
331
356
break ;
357
+
332
358
case DialogResult . Cancel :
333
359
info . Cancel = true ;
334
360
break ;
@@ -496,25 +522,27 @@ private void RefreshNewTraces(bool forcerefresh)
496
522
}
497
523
else
498
524
{
499
- var logs = gridControl . crmGridView . DataSource as DataCollection < Entity > ;
500
- foreach ( var log in logs )
525
+ if ( gridControl . crmGridView . DataSource is DataCollection < Entity > logs )
501
526
{
502
- newlogs . Remove ( log . Id ) ;
503
- }
504
- UpdateRefreshButton ( newlogs . Entities . Count ) ;
527
+ foreach ( var log in logs )
528
+ {
529
+ newlogs . Remove ( log . Id ) ;
530
+ }
531
+ UpdateRefreshButton ( newlogs . Entities . Count ) ;
505
532
506
- if ( ( forcerefresh || comboRefreshMode . SelectedIndex == 2 ) && newlogs . Entities . Count > 0 )
507
- {
508
- foreach ( var log in newlogs . Entities . Reverse ( ) )
533
+ if ( ( forcerefresh || comboRefreshMode . SelectedIndex == 2 ) && newlogs . Entities . Count > 0 )
509
534
{
510
- logs . Insert ( 0 , log ) ;
535
+ foreach ( var log in newlogs . Entities . Reverse ( ) )
536
+ {
537
+ logs . Insert ( 0 , log ) ;
538
+ }
539
+ FriendlyfyCorrelationIds ( logs ) ;
540
+ SimplifyPluginTypes ( logs ) ;
541
+ SetTraceSizes ( logs ) ;
542
+ ExtractExceptionSummaries ( logs ) ;
543
+ gridControl . crmGridView . Refresh ( ) ;
544
+ UpdateRefreshButton ( 0 ) ;
511
545
}
512
- FriendlyfyCorrelationIds ( logs ) ;
513
- SimplifyPluginTypes ( logs ) ;
514
- SetTraceSizes ( logs ) ;
515
- ExtractExceptionSummaries ( logs ) ;
516
- gridControl . crmGridView . Refresh ( ) ;
517
- UpdateRefreshButton ( 0 ) ;
518
546
}
519
547
}
520
548
StartRefreshTimer ( false ) ;
@@ -1182,4 +1210,4 @@ private static void OpenLogTrace(Entity record)
1182
1210
Process . Start ( filename ) ;
1183
1211
}
1184
1212
}
1185
- }
1213
+ }
0 commit comments