Persistence
RobotStudio persists the changes that have been made in the station. RobotStudio persists all the necessary data required to continue working. The figure below shows an example of persistant data in RobotStudio.
Attributes are used to persist information. Attributes allow the add-in to add custom information to any persistent object in the API (any object deriving from ProjectObject).
Robot Studio provides properties in the form of Attributes where the information can be stored. All the RobotStudio objects that are inheriting from Project Object can be used to store the data.
Data that can be stored in the form of attributes are as mentioned below:
Project Object is an abstract base class for all objects and is a part of a Robot Studio Project. It cannot be instantiated. Some examples of Classes that are inherited from ProjectObject are as shown below.
So a class created in add-in which instantiates the classes inheriting from ProjectObject must implement the Undo Redo functionality. Calls to methods and properties that changes the state of a ProjectObject must be enclosed in BeginUndoStep/EndUndoStep. Any data stored in attributes (i.e. using the ProjectObject.Attributes collection) will support undo/redo.
Attributes are stored as a key/value pair. Keys can be associated with a Guid. A key with a Guid can only be modified by a client that knows the Guid.
Add-Ins should consider associating attribute keys with a Guid to make sure that the attribute is not removed by accident by another Add-In.
To avoid conflicts with attribute keys defined by RobotStudio or other Add-Ins, prefix the key with the Add-In name.