Hey there,
I would like my map document to save a user chosen symbol. Therefore I want to implement persistence in my AddIn. There is an example in ArcObjects 10.1 Help, which is unfortunately missing an important piece: PersistHelper class. Does anybody have an example of persisting custom types in AddIns?
Thanks and best regards
S. Reuther
http://resources.arcgis.com/en/help/...00000zz000000/
Quote of help content:
[... To store custom types and object graphs, use the ArcObjects PersistHelper class. The following code example shows an extension writing a private struct, which manages an ArcObjects type:[C#]private MyPersistentData _data;
protected override void OnLoad(Stream inStrm)
{
// Initialize the struct.
_data.Location = "";
_data.Point = new ESRI.ArcGIS.Geometry.PointClass();
PersistHelper.Load < MyPersistentData > (inStrm, ref _data);
}
protected override void OnSave(Stream outStrm)
{
PersistHelper.Save < MyPersistentData > (outStrm, _data);
}
[Serializable()]
private struct MyPersistentData
{
public string Location;
public ESRI.ArcGIS.Geometry.PointClass Point;
} ...]
I would like my map document to save a user chosen symbol. Therefore I want to implement persistence in my AddIn. There is an example in ArcObjects 10.1 Help, which is unfortunately missing an important piece: PersistHelper class. Does anybody have an example of persisting custom types in AddIns?
Thanks and best regards
S. Reuther
http://resources.arcgis.com/en/help/...00000zz000000/
Quote of help content:
[... To store custom types and object graphs, use the ArcObjects PersistHelper class. The following code example shows an extension writing a private struct, which manages an ArcObjects type:[C#]private MyPersistentData _data;
protected override void OnLoad(Stream inStrm)
{
// Initialize the struct.
_data.Location = "";
_data.Point = new ESRI.ArcGIS.Geometry.PointClass();
PersistHelper.Load < MyPersistentData > (inStrm, ref _data);
}
protected override void OnSave(Stream outStrm)
{
PersistHelper.Save < MyPersistentData > (outStrm, _data);
}
[Serializable()]
private struct MyPersistentData
{
public string Location;
public ESRI.ArcGIS.Geometry.PointClass Point;
} ...]