I would like to get the Source segment and Target segment which are active( are edited) in the editor view.
private void Form1_Shown(object sender, EventArgs e)
{
ISegmentPair activeSegmentPair = document.ActiveSegmentPair;
IAbstractMarkupData markupData = activeSegmentPair.Target.Find(IsIText); // IsItext is a function: bool IsItext(IAbstractMarkupData x) { return x is IText; }
IText targetText = markupData as IText;
if (targetText != null)
{
targetText.Properties.Text = activeSourceText.ToString();
}
------------
ISegmentPair activeSegmentPair = document.ActiveSegmentPair;
document.ProcessSegmentPairs("Copy Source to Target", (sp, args) =>
{
if (sp.Properties.Id.Id == activeSegmentPair.Properties.Id.Id)
{
foreach (IAbstractMarkupData targetMarkupData in sp.Target)
{
var targetText = targetMarkupData as IText;
if (targetText != null)
{
targetText.Properties.Text = activeSourceText.ToString();
}
}
}
);
}