ConfigLoadPropertyErrorEventArgs Class |
||
|
Provides data for the ConfigLoader.PropertyErrorEventHandler delegate. A ConfigLoadPropertyError event happens when an error occurs while loading object configuration. The ConfigLoadPropertyErrorEventArgs class provides information such as the error type and the string representation of the property that generated the error.
|
ConfigLoadPropertyErrorEventArgs ErrorCode Message PropertyPath InnerException |
Visual Basic
Syntax
Class ConfigLoadPropertyErrorEventArgs
Sample Code
' This method handles PropertyError events that occur while ' loading the configuration of an object. Public Sub OnLoadPropertyError(ByVal loader As Mpx.ConfigLoader, ByVal e As Mpx.ConfigLoadPropertyErrorEventArgs) Dim msg As String = "Warning: " Select Case e.ErrorCode Case Mpx.ConfigLoadErrorCode.Missing If e.PropertyPath.StartsWith("Controller.Can") Then ' Ignore missing Can and CanNode objects Return End If Case Mpx.ConfigLoadErrorCode.Unsupported Case Else ' For all other errors, print an error message and ' cancel the load. msg = "Error: " ' Cancel the load operation loader.Cancel() End Select ' Print an informative message ' Example output: ' Error: Controller.Axis[2]: Axis is not enabled msg += e.PropertyPath msg += ": " msg += e.Message System.Console.WriteLine(msg) End Sub |
Sample Application
C#
Syntax
class ConfigLoadPropertyErrorEventArgs
Sample Code
// This method handles PropertyError events that occur while loading if (e.ErrorCode == Mpx.ConfigLoadErrorCode.Missing) // A property is missing in the config file. Print a warning. // Cancel the load operation // Print an informative message |