Class AbstractSingleFileRefreshablePreviewController
Implements
Inherited Members
Namespace: SdlSdl.FileTypeSupportFrameworkIntegrationApi
Assembly: Sdl.FileTypeSupport.Framework.Core.dll
Syntax
public abstract class AbstractSingleFileRefreshablePreviewController : AbstractSettingsBundleAware, ISettingsBundleAware, ISingleFileRefreshablePreview, ISingleFilePreviewControl, IAbstractPreviewControl, IAbstractPreviewController, ISingleFilePreviewController, INavigablePreview, IDisposable, IFileTypeDefinitionAware, IPreviewUpdatedViaSegmentFile, IPreviewUpdatedViaRefresh, IAbstractUpdatablePreview
Constructors
AbstractSingleFileRefreshablePreviewController()
Declaration
protected AbstractSingleFileRefreshablePreviewController()
Properties
Control
Declaration
public virtual Control Control { get; }
Property Value
Type | Description |
---|---|
Control |
FileTypeDefinition
The framework sets this property for components that are instantiated from a file type definition.
Declaration
public IFileTypeDefinition FileTypeDefinition { get; set; }
Property Value
Type | Description |
---|---|
IFileTypeDefinition |
Remarks
This property may be null
, e.g. if the
component is not instantiated from a file type definition.
PreferredHighlightColor
Set by the host application to indicate the preferred color to be used for highlighting the current segment in the preview when NavigateToSegment(SegmentReference) is called.
Declaration
public virtual Color PreferredHighlightColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Remarks
Using the highlight color is optional, but leads to an enhanced user experience. This will typically be the same color as the background color that is used for the active segment row in the editor, which makes it easier for the user to see that the two segments (i.e. from the bilingual document and the preview) relate to each other.
PreviewFile
Full path to the file that should be displayed in the preview
Declaration
public virtual TempFileManager PreviewFile { get; set; }
Property Value
Type | Description |
---|---|
TempFileManager |
Remarks
The host application sets this path after generating the preview file before calling IAbstractPreviewControl.Refresh or Launch() in order to display the file.
The file is passed through a temporary file manager, which means that it should be deleted automatically when it is no longer needed.
RefreshPreview
Declaration
public bool RefreshPreview { get; set; }
Property Value
Type | Description |
---|---|
bool |
TargetFilePath
Full path to the target language file that is overwritten when the preview is refreshed. This path is typically set once and stays unchanged during the lifetime of the preview.
Declaration
public virtual TempFileManager TargetFilePath { get; set; }
Property Value
Type | Description |
---|---|
TempFileManager |
Methods
AfterFileRefresh()
Called by the host application after the preview file has been successfully overwritten.
Declaration
public virtual void AfterFileRefresh()
Remarks
The implementation typically re-loads (refreshes) the file in the preview and (if necessary) navigates to the previously displaying content.
BeforeFileRefresh()
Called by the host application when the preview is about to be updated, before the file at TargetFilePath is overwritten.
Declaration
public virtual void BeforeFileRefresh()
Remarks
This call allows the implementation to release any file locks and/or try to 'remember' the current location of the file before it is overwritten.
CreateSegmentFile(SegmentReference)
Called by the host application to create a native source document containing the source language content of the specified segment. The implementation returns the full path to the file created.
Declaration
public virtual TempFileManager CreateSegmentFile(SegmentReference segment)
Parameters
Type | Name | Description |
---|---|---|
SegmentReference | segment | Identifies the segment to create a file for. |
Returns
Type | Description |
---|---|
TempFileManager | Temporary file that has been created. The lifetime of the file is controlled by the returned manager instance. All components that need access to the file should reference this. The file will automatically be deleted when this instance is disposed or garbage collection takes place. |
Dispose()
Declaration
public virtual void Dispose()
NavigateToSegment(SegmentReference)
Called by the host application to request that the preview should scroll to the specified segment.
Declaration
public virtual void NavigateToSegment(SegmentReference segment)
Parameters
Type | Name | Description |
---|---|---|
SegmentReference | segment |
Remarks
The implementation may specifically highlight the segment in the preview (if possible).
OnSegmentSelected(SegmentSelectedEventArgs)
Declaration
public void OnSegmentSelected(SegmentSelectedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SegmentSelectedEventArgs | args |
Refresh()
Declaration
public virtual void Refresh()
UpdatePreviewFromSegmentFile(SegmentReference, TempFileManager)
Called by the host application to update the preview with the content of a segment file. The implementation should update the preview by replacing the segment content with the content in the segment file.
Declaration
public virtual void UpdatePreviewFromSegmentFile(SegmentReference segment, TempFileManager translatedSegmentFile)
Parameters
Type | Name | Description |
---|---|---|
SegmentReference | segment | |
TempFileManager | translatedSegmentFile | Reference to a native file containing the updated target language version of the segment. The implementation may dispose of this when it is no longer needed. |
Events
SegmentSelected
Raised when the user interacts with the preview, selecting a different segment than the one that is currently highlighted.
Declaration
public event EventHandler<SegmentSelectedEventArgs> SegmentSelected
Event Type
Type | Description |
---|---|
EventHandlerSegmentSelectedEventArgs |
Remarks
The host application typically handles this event by changing the active segment in the editor to the one that the user has selected in the preview.