Class WorkspaceEditorState
Mutates persisted layout information for the currently selected workspace view.
public sealed class WorkspaceEditorState
- Inheritance
-
WorkspaceEditorState
- Inherited Members
Constructors
WorkspaceEditorState(Workspace, string?)
Creates editing state for a workspace and selects an initial view.
public WorkspaceEditorState(Workspace workspace, string? selectedViewKey = null)
Parameters
workspaceWorkspaceThe workspace whose layout should be edited.
selectedViewKeystringThe initially selected view key, or
nullto select the first available view.
Properties
SelectedViewKey
Identifies the view currently being edited.
public string SelectedViewKey { get; }
Property Value
Workspace
Gets the updated workspace supplied to a host save callback.
public Workspace Workspace { get; }
Property Value
Methods
AddRelationshipVertex(string, int, int)
Inserts a relationship vertex at the nearest segment within the selected view.
public void AddRelationshipVertex(string relationshipId, int x, int y)
Parameters
relationshipIdstringThe identifier of the relationship to edit.
xintThe X coordinate of the new vertex.
yintThe Y coordinate of the new vertex.
Exceptions
- ArgumentException
Thrown when the relationship does not exist in the selected view.
GetViewKeys()
Lists the keys of all editable views in the workspace.
public IEnumerable<string> GetViewKeys()
Returns
- IEnumerable<string>
The ordered set of editable view keys.
MoveElement(string, int, int)
Moves an element within the selected view.
public void MoveElement(string elementId, int x, int y)
Parameters
elementIdstringThe identifier of the element to move.
xintThe new X coordinate.
yintThe new Y coordinate.
Exceptions
- ArgumentException
Thrown when the element does not exist in the selected view.
MoveRelationshipLabel(string, int, int)
Repositions a relationship label along the selected view's connector path.
public void MoveRelationshipLabel(string relationshipId, int x, int y)
Parameters
relationshipIdstringThe identifier of the relationship to edit.
xintThe target X coordinate used to project the label onto the connector.
yintThe target Y coordinate used to project the label onto the connector.
Exceptions
- ArgumentException
Thrown when the relationship does not exist in the selected view.
MoveRelationshipVertex(string, int, int, int)
Moves an existing relationship vertex within the selected view.
public void MoveRelationshipVertex(string relationshipId, int index, int x, int y)
Parameters
relationshipIdstringThe identifier of the relationship to edit.
indexintThe zero-based vertex index.
xintThe new X coordinate.
yintThe new Y coordinate.
Exceptions
- ArgumentException
Thrown when the relationship does not exist in the selected view.
- ArgumentOutOfRangeException
Thrown when
indexdoes not identify an existing vertex.
RemoveRelationshipVertex(string, int)
Removes an existing relationship vertex from the selected view.
public void RemoveRelationshipVertex(string relationshipId, int index)
Parameters
relationshipIdstringThe identifier of the relationship to edit.
indexintThe zero-based vertex index.
Exceptions
- ArgumentException
Thrown when the relationship does not exist in the selected view.
- ArgumentOutOfRangeException
Thrown when
indexdoes not identify an existing vertex.
SelectView(string)
Changes the selected view.
public void SelectView(string viewKey)
Parameters
viewKeystringThe key of the view to edit.
Exceptions
- ArgumentException
Thrown when
viewKeyis missing or does not exist in the workspace.