Class AbstractSourceAndTargetFileRefreshablePreviewController
Implement this class for source and target (side-by-side) previews. Override the required properties and methods
Inheritance
Implements
Inherited Members
Namespace: Sdl.FileTypeSupport.Framework.IntegrationApi
Assembly: Sdl.FileTypeSupport.Framework.Core.dll
Syntax
public abstract class AbstractSourceAndTargetFileRefreshablePreviewController : ISourceAndTargetFileRefreshablePreview, ISourceAndTargetFilePreviewControl, IAbstractPreviewControl, IAbstractPreviewController, ISourceAndTargetFilePreviewController, INavigablePreview, IDisposable, IPreviewUpdatedViaRefresh, IAbstractUpdatablePreview
Constructors
AbstractSourceAndTargetFileRefreshablePreviewController()
Declaration
protected AbstractSourceAndTargetFileRefreshablePreviewController()
Properties
Control
The actual Windows Forms control for the preview display
Declaration
public virtual Control Control { get; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.Control |
Remarks
This property provides direct access to the control. It is used by host applications that host the control to set its size and other standard properties.
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 |
---|---|
System.Drawing.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.
RefreshPreview
RefreshPreview should be set to true in the controller if a full preview regeneration is needed
Declaration
public bool RefreshPreview { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SourcePreviewFile
Full path to the source language file. This should be set by the application before the first call to Launch() or Refresh().
Declaration
public virtual TempFileManager SourcePreviewFile { get; set; }
Property Value
Type | Description |
---|---|
TempFileManager |
Remarks
The file is passed through a temporary file manager, which means that it should be deleted automatically when it is no longer needed.
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 |
TargetPreviewFile
Full path to the target language file, which should be set by the application before the first call to Launch() or Refresh().
Declaration
public virtual TempFileManager TargetPreviewFile { get; set; }
Property Value
Type | Description |
---|---|
TempFileManager |
Remarks
The file is passed through a temporary file manager, which means that it should automatically get deleted when no longer needed.
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.
Dispose()
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)
Called to fire the SegmentSelected event
Declaration
public void OnSegmentSelected(SegmentSelectedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SegmentSelectedEventArgs | args |
Refresh()
Called when a document preview first needs to be been displayed and subsequently each time the document preview needs to be been updated.
Declaration
public virtual void Refresh()
Remarks
This preview control may also need to call the contained preview generator object's IAbstractPreviewGenerator.Refresh() method to ensure that a new preview file has been created or has been updated, and is ready to be viewed.
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 |
---|---|
System.EventHandler<SegmentSelectedEventArgs> |
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.