When you are creating an application for a broad audience, integrating some kind of analytics framework is crucial, because you will need to analyze the usage data of the application and its features and most probably you will need to know about any application crashes or other errors occurred during the execution. Using Analytics you will be able to trace certain features of the controls and get statistics about their usage.
This article will discuss the following topics:
With the R1 2014 release UI for WinForms exposes the ITraceMonitor interface which represents a monitor receiving trace events from the UI for WinForms controls.
You need to implement the following methods in order to receive trace events from the controls used in your application:
- TrackAtomicFeature: This method is called when an atomic feature is executed.
- TrackFeatureStart: This method is called when a feature is initiated.
- TrackFeatureEnd: This method is called when a feature finishes execution.
- TrackFeatureCancel: This method is called when a feature is canceled.
- TrackError: Traces an error in a specified feature.
- TrackValue: This method is called when a value connected with a specific feature is tracked.
Once you've created your implementation of the interface in accordance to your provider of choice you need to set the static TraceMonitor.AnalyticsMonitor property as per the example below.
ControlTraceMonitor.AnalyticsMonitor = new CustomAnalitycsMonitor();
ControlTraceMonitor.AnalyticsMonitor = New CustomAnalitycsMonitor()
Each control has analytics enabled by default, on control basis analytics can be disabled by setting the control`s EnableAnalytics property to false. Having analytics enabled, all one needs to do to start tracing the application usage is to set the AnalyticsName property for each control. Note that the value which is set will be used in the dashboard.
this.radButton1.EnableAnalytics = true; // default value this.radButton1.AnalyticsName = "Save Button";
Me.RadButton1.EnableAnalytics = True ' default value Me.RadButton1.AnalyticsName = "Save Button"
You can then go to the dashboard of your analytics provider, where you will find information and statistics for the registered features for different periods of time.
this.radButton1.EnableAnalytics = false;
Me.RadButton1.EnableAnalytics = False
Currently only few controls support analytics out of the box. Note that only user interactions will be tracked - initial values and values from Bindings are not supported. You can find below a list of the controls and their features that support tracing:
|Control||Traceable events and methods|
|RadBindingNavigator||MoveToFirst, MoveToPrevious, MoveToNext, MoveToLast|
|RadCalendar||SelectionChaned, Navigation, ViewChanged|
|RadChartView||Zoom, Pan, SelectionChanged|
|RadCheckedDropDownList||Checked, Popup open close|
|RadContextMenu||Open, Close, Click (RadContextMenu.DropDown)|
|RadDataEntry||Editing, Insert/Delete, MoveToFirst, MoveToPrevious, MoveToNext, MoveToLast|
|RadDataLayout||Customize open, Item rearrange (via drag and drop, resize or context menu)|
|RadDiagram||Move, Resize, Add, Delete|
|RadDock||Save layout, Load layout, Float a pane, Dock a pane, Add window, Remove window|
|RadDropdownList||SelectionChanged, DropDownOpened, DropDownClosed|
|RadForm||SelectionChanged, DropDownOpened, DropDownClosed|
|RadGanttView||Collapse task, Expand task, Edit task, Selected task|
|RadGridView||MoveToFirst, MoveToPrevious, MoveToNext, MoveToLast,|
|RadGridView - Paging||MoveToFirst, MoveToPrevious, MoveToNext, MoveToLast|
|RadLayoutControl||Customize open, Item rearrange (via drag and drop, resize or context menu)|
|RadPageView - ExplorerBar||Expand, Collapse, SelectionChanged|
|RadPageView - Strip||SelectionChanged|
|RadPdfViewer||Load Document, Print, Print Preview|
|RadPivotGrid||Begin refresh, Complete refresh, Expand group header, Collapse group header, DragDrop field, Export|
|RadPopupEditor||Popup open close|
|RadPropertyGrid||Sorting, Grouping, Editing, Searching, Expanding Groups, Expanding nested definition|
|RadRichTextBox||Open Document, Save Document|
|RadRichTextEditor||New, Open, Save, Print, PrintPreview|
|RadScheduler||ViewChanged, Import, Export, Editing, Creating, DragAndDrop, Resize, ShowDialog|
|RadTreeView||SelectExpand, Collapse, SelectionChanged, Edit, RemoveionChanged|
|Exporting features in controls||All export providers(including async exports) - when export operation is completed|