Class EditorController
Implement the controller for the editor view and provide access to common editor operations.
Inheritance
Implements
Inherited Members
Namespace: Sdl.TranslationStudioAutomation.IntegrationApi
Assembly: Sdl.TranslationStudioAutomation.IntegrationApi.dll
Syntax
[BindController("EditorView")]
public class EditorController : AbstractBindedController, IViewController, IBindedController
Constructors
EditorController()
Declaration
public EditorController()
Properties
ActiveDocument
Get the active document.
Declaration
public Document ActiveDocument { get; }
Property Value
Type | Description |
---|---|
Document |
Methods
Activate(Document)
Activates the specified document
Declaration
public void Activate(Document document)
Parameters
Type | Name | Description |
---|---|---|
Document | document | Document to be activated. |
Close(Document)
Performs the closing of the document.
Declaration
public void Close(Document document)
Parameters
Type | Name | Description |
---|---|---|
Document | document | The document for which the operation is executed. |
GetDocuments()
Gets all the opened documents.
Declaration
public IEnumerable<Document> GetDocuments()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Document> | Returns an enumerable document collection of all the opened documents. |
Initialize(IViewContext)
Implements the editor controller initialization
Declaration
protected override void Initialize(IViewContext context)
Parameters
Type | Name | Description |
---|---|---|
IViewContext | context | The context of the editor controller when initialized |
Overrides
Open(ProjectFile, EditingMode)
Open a document from a project file in the specified editing mode.
Declaration
public Document Open(ProjectFile projectFile, EditingMode mode)
Parameters
Type | Name | Description |
---|---|---|
ProjectFile | projectFile | Project file to open. |
EditingMode | mode | The editing mode in which the document will be loaded. |
Returns
Type | Description |
---|---|
Document | The opened document. |
Open(IEnumerable<ProjectFile>, EditingMode)
Open multiple project files.
Declaration
public Document Open(IEnumerable<ProjectFile> projectFiles, EditingMode mode)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ProjectFile> | projectFiles | Project files to be opened. |
EditingMode | mode | The editing mode in which the document will be loaded. |
Returns
Type | Description |
---|---|
Document | The opened document. |
Open(String)
Open a document from a physical file path.
Declaration
public Document Open(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | Phath to the phisical file which should be opened. |
Returns
Type | Description |
---|---|
Document | The opened document. |
Save(Document)
Perform the saving of the document.
Declaration
public void Save(Document document)
Parameters
Type | Name | Description |
---|---|---|
Document | document | The document for which the operation is executed. |
SaveAs(Document, Boolean)
Show the Save As dialog.
Declaration
public void SaveAs(Document document, bool saveProjectSettings = false)
Parameters
Type | Name | Description |
---|---|---|
Document | document | The document for which the Save As operation is executed. |
System.Boolean | saveProjectSettings | True for saving the project settings |
SaveAs(Document, IEnumerable<String>, Boolean)
Save the document to the specified absolute path
Declaration
public void SaveAs(Document document, IEnumerable<string> filePaths, bool saveProjectSettings = false)
Parameters
Type | Name | Description |
---|---|---|
Document | document | The document for which the Save As operation is executed. |
System.Collections.Generic.IEnumerable<System.String> | filePaths | The absolute paths to save the content to. |
System.Boolean | saveProjectSettings | True for saving the project settings |
SaveSourceAs(Document)
Show the Save Source As dialog.
Declaration
public void SaveSourceAs(Document document)
Parameters
Type | Name | Description |
---|---|---|
Document | document | The document for which the Save Source As operation is executed. |
SaveTargetAs(Document)
Show the Save Target As dialog.
Declaration
public void SaveTargetAs(Document document)
Parameters
Type | Name | Description |
---|---|---|
Document | document | The document for which the Save Target As operation is executed. |
Events
ActiveDocumentChanged
Triggered when the active document has been changed.
Declaration
public event EventHandler<DocumentEventArgs> ActiveDocumentChanged
Event Type
Type | Description |
---|---|
System.EventHandler<DocumentEventArgs> |
Closed
Triggered after a document is closed.
Declaration
public event EventHandler<DocumentEventArgs> Closed
Event Type
Type | Description |
---|---|
System.EventHandler<DocumentEventArgs> |
Closing
Triggered before a document is closed.
Declaration
public event EventHandler<CancelDocumentEventArgs> Closing
Event Type
Type | Description |
---|---|
System.EventHandler<CancelDocumentEventArgs> |
Opened
Triggered after a document is opened.
Declaration
public event EventHandler<DocumentEventArgs> Opened
Event Type
Type | Description |
---|---|
System.EventHandler<DocumentEventArgs> |
Opening
Triggered before a document is opened.
Declaration
public event EventHandler<CancelDocumentEventArgs> Opening
Event Type
Type | Description |
---|---|
System.EventHandler<CancelDocumentEventArgs> |
Saved
Triggered after a document is saved.
Declaration
public event EventHandler<DocumentEventArgs> Saved
Event Type
Type | Description |
---|---|
System.EventHandler<DocumentEventArgs> |
SaveFailed
Triggered if the save is failing
Declaration
public event EventHandler<DocumentErrorEventArgs> SaveFailed
Event Type
Type | Description |
---|---|
System.EventHandler<DocumentErrorEventArgs> |
Saving
Triggered before a document is saved.
Declaration
public event EventHandler<CancelDocumentEventArgs> Saving
Event Type
Type | Description |
---|---|
System.EventHandler<CancelDocumentEventArgs> |