Table of Contents

Class WorkspaceEditorState

Namespace
C4.Net.Editor
Assembly
C4.Net.Editor.dll

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

workspace Workspace

The workspace whose layout should be edited.

selectedViewKey string

The initially selected view key, or null to select the first available view.

Properties

SelectedViewKey

Identifies the view currently being edited.

public string SelectedViewKey { get; }

Property Value

string

Workspace

Gets the updated workspace supplied to a host save callback.

public Workspace Workspace { get; }

Property Value

Workspace

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

relationshipId string

The identifier of the relationship to edit.

x int

The X coordinate of the new vertex.

y int

The 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

elementId string

The identifier of the element to move.

x int

The new X coordinate.

y int

The 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

relationshipId string

The identifier of the relationship to edit.

x int

The target X coordinate used to project the label onto the connector.

y int

The 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

relationshipId string

The identifier of the relationship to edit.

index int

The zero-based vertex index.

x int

The new X coordinate.

y int

The new Y coordinate.

Exceptions

ArgumentException

Thrown when the relationship does not exist in the selected view.

ArgumentOutOfRangeException

Thrown when index does 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

relationshipId string

The identifier of the relationship to edit.

index int

The zero-based vertex index.

Exceptions

ArgumentException

Thrown when the relationship does not exist in the selected view.

ArgumentOutOfRangeException

Thrown when index does not identify an existing vertex.

SelectView(string)

Changes the selected view.

public void SelectView(string viewKey)

Parameters

viewKey string

The key of the view to edit.

Exceptions

ArgumentException

Thrown when viewKey is missing or does not exist in the workspace.