Starts an asynchronous request to query and watch statistic values at the given keys.

Namespace: ININ.IceLib.Statistics
Assembly: ININ.IceLib.Statistics (in ININ.IceLib.Statistics.dll) Version: 0.0.0.0 (22.3.0.218)

Syntax

C#
public void StartWatchingAsync(
	StatisticKey[] keysToWatch,
	AsyncCompletedEventHandler completedCallback,
	Object userState
)
Visual Basic
Public Sub StartWatchingAsync ( _
	keysToWatch As StatisticKey(), _
	completedCallback As AsyncCompletedEventHandler, _
	userState As Object _
)

Parameters

keysToWatch
Type: array<ININ.IceLib.Statistics..::..StatisticKey>[]()[][]
The keys for the statistic values to start watching.
completedCallback
Type: System.ComponentModel..::..AsyncCompletedEventHandler
The callback to invoke when the asynchronous operation completes.
userState
Type: System..::..Object
An optional object that contains state information for this request. This object is a way for the caller to store context information which will be provided to the AsyncCompleted event. If no context information is desired then nullNothingnullptra null reference (Nothing in Visual Basic) may be supplied.

Remarks

When completed, the completedCallback delegate is invoked on a thread appropriate to the application-model, such as the GUI thread in a UI application. The Error property of the AsyncCompletedEventArgs-derived object passed to the delegate will contain any exceptions thrown while executing the asynchronous task. See the synchronous version of this method for more detailed error information. For more information on async method calls, see How Async Calls Work.

Note
All event handlers should be added before calling StartWatching(array<StatisticKey>[]()[][]) or StartWatchingAsync(array<StatisticKey>[]()[][], AsyncCompletedEventHandler, Object).
Note
For more information on watches see How Watches Work.
Note
Any requests for a statistic that has not yet been added to the cache from any session will initially return the value of 'N/A'. It will then be updated via StatisticValueUpdated when the cache is updated with the actual value.

Examples

The IceLib SDK includes example application references to the StartWatchingAsync method (or a variation). Some examples are listed below.
ProjectLocation
TutorialExampleSystemStatisticsViewModel.cs, line 119, in SystemStatisticsViewModel.StartWatchingCatalogCompleted

Exceptions

ExceptionCondition
System..::..InvalidOperationExceptionA watch has already been started for this instance of StatisticListener.
System..::..ArgumentNullExceptionkeysToWatch is nullNothingnullptra null reference (Nothing in Visual Basic).
System..::..ArgumentExceptionkeysToWatch is empty.

Version Information

Supported for IC Server version 2015 R1 and beyond.
For 4.0, supported for IC Server version 4.0 GA and beyond.

See Also