tmExporter = new ScheduledServerTranslationMemoryExport(languageDirection)
{
ContinueOnError = true
};
tmExporter.Queue();
tmExporter.Refresh();
var continueWaiting = true;
while (continueWaiting)
{
switch (tmExporter.Status)
{
case ScheduledOperationStatus.Abort:
case ScheduledOperationStatus.Aborted:
case ScheduledOperationStatus.Cancel:
case ScheduledOperationStatus.Cancelled:
case ScheduledOperationStatus.Completed:
case ScheduledOperationStatus.Error:
continueWaiting = false;
break;
case ScheduledOperationStatus.Aborting:
case ScheduledOperationStatus.Allocated:
case ScheduledOperationStatus.Cancelling:
case ScheduledOperationStatus.NotSet:
case ScheduledOperationStatus.Queued:
case ScheduledOperationStatus.Recovered:
case ScheduledOperationStatus.Recovering:
case ScheduledOperationStatus.Recovery:
continueWaiting = true;
tmExporter.Refresh();
break;
default:
continueWaiting = false;
break;
}
}
//if Status operation is completed save the tm on disk
using (Stream outputStream = new FileStream(tmFilePath, FileMode.Create))
{
var export = tmExporter.DownloadExport(outputStream);
}