ConfigSaver Object |
||
|
The ConfigSaver object provides methods to save the configuration of an MPX object.
|
ConfigSaver IncludeChildren PropertyErrorEvent |
Visual Basic
Syntax
Class ConfigSaver
Sample Code
' Save the entire Controller configuration, including child objects. ' ' Handle PropertyStatus events in order to display progress ' and exclude Can and CanNode objects from being saved. ' ' Handle PropertyError events in order to display errors. Public Sub SaveController() Dim controller As Mpx.Controller = New Mpx.Controller(0) Dim saver As Mpx.ConfigSaver = New Mpx.ConfigSaver() ' Have the OnSavePropertyError method handle ' PropertyError(events) AddHandler saver.PropertyErrorEvent, AddressOf OnSavePropertyError ' Have the OnSavePropertyStatus method handle ' PropertyStatus events AddHandler saver.PropertyStatusEvent, AddressOf OnSavePropertyStatus Try saver.SaveToFile(controller, "controllerConfig.xml") Catch exc As System.Exception If Not (exc.InnerException Is Nothing) Then exc = exc.InnerException End If System.Console.WriteLine(exc.Message) System.Console.WriteLine(exc.StackTrace) End Try End Sub |
Sample Application
C#
Syntax
class ConfigSaver
Sample Code
// Save the entire Controller configuration, including child objects. // Have the OnSavePropertyError method handle PropertyError events // Have the OnSavePropertyStatus method handle saver.SaveToFile(controller, "controllerConfig.xml"); |
See Also
Serialization Overview | ConfigSaveErrorCode | ConfigSavePropertyErrorEventArgs | ConfigSavePropertyStatusEventArgs