Class Project
Base class for all project types. Available project types will differ depending on the product that this API is used within.
Inherited Members
Namespace: ABB.Robotics.RobotStudio
Assembly: ABB.Robotics.RobotStudio.dll
Syntax
public abstract class Project : ProjectObject
Constructors
Project(PimDocument)
Declaration
protected Project(PimDocument doc)
Parameters
Type | Name | Description |
---|---|---|
RobotStudio.API.Persistence.PimDocument | doc |
Project(String)
Declaration
protected Project(string docType)
Parameters
Type | Name | Description |
---|---|---|
String | docType |
Fields
_isDirty
Declaration
Compliant(false)]
protected bool _isDirty
Field Value
Type | Description |
---|---|
Boolean |
Properties
ActiveProject
Gets the project that is currently active.
Declaration
public static Project ActiveProject { get; set; }
Property Value
Type | Description |
---|---|
Project | The Project that is currently active. Only one project can be active at a given time. |
DocumentInfo
Gets an object which contains properties about the project file
Declaration
public DocumentInfo DocumentInfo { get; }
Property Value
Type | Description |
---|---|
DocumentInfo | A DocumentInfo objcet which contains properties about the project file |
FileInfo
Gets information about the file where the project is stored.
Declaration
public FileInfo FileInfo { get; }
Property Value
Type | Description |
---|---|
FileInfo | A FileInfo object with information about the file where the project is persisted. If the project has not been saved yet, null is returned. |
Format
Gets the format of the project storage.
Declaration
public ProjectFormat Format { get; }
Property Value
Type | Description |
---|---|
ProjectFormat |
IsDirty
Determines if the project has unsaved changes.
Declaration
public bool IsDirty { get; set; }
Property Value
Type | Description |
---|---|
Boolean | True means that some state in the project has been changed since it was loaded or saved last time. False means that no change to the state has been done. When the project is saved, this value is reset to false. Only change of persistent state will affect this property. |
OpenProjects
Gets a collection of all currently open Projects.
Declaration
public static ReadOnlyCollection<Project> OpenProjects { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<Project> |
ReadOnly
Gets or sets a value indicating if the corresponding project file is readonly or in use. If the value is true it is not possible to call Save().
Declaration
public virtual bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
The value can only be set to true. Trying to set the value to false will cause an exception.
SavedStates
Gets a SavedStateCollection that contains saved states for this object.
Declaration
public SavedStateCollection SavedStates { get; }
Property Value
Type | Description |
---|---|
SavedStateCollection |
Selection
This property is obsolete. Use SelectedObjects instead.
Declaration
olete("Use Selection.SelectedObjects instead")]
public ProjectSelection Selection { get; }
Property Value
Type | Description |
---|---|
ProjectSelection |
UndoContext
Gets an object giving access to the undo system for the project. which gives information about selected objects and makes it possible to select objects.
Declaration
public static UndoContext UndoContext { get; }
Property Value
Type | Description |
---|---|
UndoContext | A UndoContext objcet giving access to the undo system for the project. It gives access to the state based undo support that is built in to all objects deriving from ProjectObject. |
Methods
AfterLoad(PimDocument)
Declaration
protected override void AfterLoad(PimDocument doc)
Parameters
Type | Name | Description |
---|---|---|
RobotStudio.API.Persistence.PimDocument | doc |
Overrides
AutoSave()
Saves any pending changes to the auto-save stream in the Project file.
Declaration
public bool AutoSave()
Returns
Type | Description |
---|---|
Boolean | True if the changes were saved. False if there were no changes, or if the project was opened as read-only. |
BeforeSaveProject()
Called before the project is saved. The difference from ProjectObject.BeforeSave() is that this is called before the list of objects to be saved is created
Declaration
protected virtual void BeforeSaveProject()
Close()
Closes the project without saving changes.
Declaration
public virtual void Close()
Remarks
Note that unsaved changes are lost when closing the project. The locks on the project file are released. Save()
FromFileName(String)
Returns the Project with the given file name if it already is loaded, otherwise null.
Declaration
public static Project FromFileName(string fileName)
Parameters
Type | Name | Description |
---|---|---|
String | fileName |
Returns
Type | Description |
---|---|
Project | The Project if already loaded, otherwise null.> |
GetObjectFromUniqueId(String)
Declaration
public ProjectObject GetObjectFromUniqueId(string uniqueId)
Parameters
Type | Name | Description |
---|---|---|
String | uniqueId |
Returns
Type | Description |
---|---|
ProjectObject |
OnCreatingObject()
Declaration
protected override void OnCreatingObject()
Overrides
OnDelete()
Declaration
protected override void OnDelete()
Overrides
Save()
Saves the project to its corresponding project file.
Declaration
public virtual void Save()
Exceptions
Type | Condition |
---|---|
Exception | The project has not been saved before, so there is no corresponding project file. You must call SaveAs(String) before you can call save. |
SaveAs(String)
Saves the project to a project file on a new location.
Declaration
public virtual void SaveAs(string fileName)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | Path to the project file |
Remarks
If the project has been saved before, the old project file will remain on the file system. When Save() is called next time, the project will be saved to the new location. To make a copy of the project, but then continue to use the original file, use SaveCopyAs(String). SaveCopyAs(String)
Exceptions
Type | Condition |
---|---|
ArgumentException | The specified file name is invalid. |
SaveAs(String, ProjectFormat)
Saves the project to a project file on a new location.
Declaration
public virtual void SaveAs(string fileName, ProjectFormat format)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | Path to the project file |
ProjectFormat | format | Format of the project |
Remarks
If the project has been saved before, the old project file will remain on the file system. When Save() is called next time, the project will be saved to the new location. To make a copy of the project, but then continue to use the original file, use SaveCopyAs(String). SaveCopyAs(String)
Exceptions
Type | Condition |
---|---|
ArgumentException | The specified file name is invalid. |
SaveCopyAs(String)
Saves a copy of the project file.
Declaration
public virtual void SaveCopyAs(string fileName)
Parameters
Type | Name | Description |
---|---|---|
String | fileName |
Remarks
Saving a copy will not affect the location where the project is saved next time SaveAs(String) is called. SaveAs(String)Save()
Exceptions
Type | Condition |
---|---|
ArgumentException | The specified file name is invalid. |
Events
ActiveProjectChanged
Occurs when the ActiveProject property has changed.
Declaration
public static event EventHandler ActiveProjectChanged
Event Type
Type | Description |
---|---|
EventHandler |
AutoSaveAvailable
Occurs if autosave data is available for a Project being loaded.
Declaration
public static event AutoSaveAvailableEventHandler AutoSaveAvailable
Event Type
Type | Description |
---|---|
AutoSaveAvailableEventHandler |
BeforeLoadProjectFile
Occurs before a Project is loaded from file.
Declaration
public static event ProjectFileEventHandler BeforeLoadProjectFile
Event Type
Type | Description |
---|---|
ProjectFileEventHandler |
Closed
Occurs after a Project is closed.
Declaration
public event EventHandler Closed
Event Type
Type | Description |
---|---|
EventHandler |
ProjectAdded
Occurs when a Project is loaded or created.
Declaration
public static event EventHandler ProjectAdded
Event Type
Type | Description |
---|---|
EventHandler |
ProjectFileDifferentVersion
Occurs when a file that was created by a different application version is being loaded.
Declaration
public static event EventHandler<ProjectVersionEventArgs> ProjectFileDifferentVersion
Event Type
Type | Description |
---|---|
EventHandler<ProjectVersionEventArgs> |
ProjectFileLocked
Occurs if a Project file being loaded in read-write mode cannot be opened for writing.
Declaration
public static event ProjectFileLockedEventHandler ProjectFileLocked
Event Type
Type | Description |
---|---|
ProjectFileLockedEventHandler |
ProjectObjectRemoved
Occurs when the ContainingProject property has changed to null. This will occur when an ProjectObject object is removed from a Project project. For example when an object removed from its owning collection.
Declaration
public event ProjectObjectRemovedEventHandler ProjectObjectRemoved
Event Type
Type | Description |
---|---|
ProjectObjectRemovedEventHandler |
ProjectRemoved
Occurs when a Project is closed.
Declaration
public static event EventHandler ProjectRemoved
Event Type
Type | Description |
---|---|
EventHandler |
ReferencedProjectFileNotFound
Occurs when a file referenced by a Project being loaded is not found in the expected location.
Declaration
public static event ReferencedProjectFileNotFoundEventHandler ReferencedProjectFileNotFound
Event Type
Type | Description |
---|---|
ReferencedProjectFileNotFoundEventHandler |
ReferencedProjectFileNotSame
Occurs when a file referenced by a Project being loaded is not the same as when the project was saved.
Declaration
public static event ReferencedProjectFileNotSameEventHandler ReferencedProjectFileNotSame
Event Type
Type | Description |
---|---|
ReferencedProjectFileNotSameEventHandler |
Saved
Occurs after a Project has been saved to file.
Declaration
public event EventHandler Saved
Event Type
Type | Description |
---|---|
EventHandler |
Saving
Occurs before a Project is saved to file.
Declaration
public event SavingProjectEventHandler Saving
Event Type
Type | Description |
---|---|
SavingProjectEventHandler |