'Declaration Public Overrides Property UserData As Object
'Usage Dim instance As ImGearARTImageEmb Dim value As Object instance.UserData = value value = instance.UserData
public override object UserData {get; set;}
'Declaration Public Overrides Property UserData As Object
'Usage Dim instance As ImGearARTImageEmb Dim value As Object instance.UserData = value value = instance.UserData
public override object UserData {get; set;}
In order to do that you need to declare serializable class, create and initialize an object of that class, and attach it to ImGearARTMark.UserData.
[Serializable] public class UserData { private string _textData; private int _integerData; public UserData(string textData, int integerData) { this.TextData = textData; this.IntegerData = integerData; } public string TextData { get { return _textData; } private set { _textData = value; } } public int IntegerData { get { return _integerData; } private set { _integerData = value; } } }
<SerializableAttribute()> _ Public Class UserData Private _textData As String Private _integerData As String Public Sub New(ByVal textData As String, ByVal integerData As Integer) Me.TextData = textData Me.IntegerData = integerData End Sub Public Property TextData() As String Get Return _textData End Get Set(ByVal Value As String) _textData = Value End Set End Property Public Property IntegerData() As Integer Get Return _integerData End Get Set(ByVal Value As Integer) _integerData = Value End Set End Property End Class
// Create user data. UserData userData = new UserData("Text data to export to XML.", 99); // Get annotation to assign user data to. ImGearARTMark mark = igARTPage.MarkGet(markId); // Set corresponding property of the mark. mark.UserData = userData; // Save page with annotation and user data to a stream. ImGearART.SavePage(igARTPage, stream, 0, ImGearSavingModes.OVERWRITE, ImGearARTSaveType.XML); stream.Seek(0, SeekOrigin.Begin); // Create new ART Page from the stream and get the annotation with the user data. ImGearARTPage newArtPage = ImGearART.LoadPage(stream, 0); ImGearARTMark newMark = newArtPage.MarkGet(markId); UserData newUserData = (UserData)newMark.UserData; System.Diagnostics.Debug.Assert(newUserData.IntegerData == userData.IntegerData); System.Diagnostics.Debug.Assert(newUserData.TextData == userData.TextData);
' Create user data. Dim userData As UserData = New UserData("Textual data to export to XML", 99) ' Get annotation to assign user data to. Dim mark As ImGearARTMark = igARTPage.MarkGet(markId) ' Set corresponding property of the mark. mark.UserData = userData ' Save page with annotation and user data to a stream. ImGearART.SavePage(igARTPage, stream, 0, ImGearSavingModes.OVERWRITE, ImGearARTSaveType.XML) stream.Seek(0, SeekOrigin.Begin) ' Create new ART Page from the stream and get the annotation with the user data. Dim newArtPage As ImGearARTPage = ImGearART.LoadPage(stream, 0) Dim newMark As ImGearARTMark = newArtPage.MarkGet(markId) Dim newUserData As UserData = CType(newMark.UserData, UserData) System.Diagnostics.Debug.Assert(newUserData.IntegerData = userData.IntegerData) System.Diagnostics.Debug.Assert(newUserData.TextData = userData.TextData)