How to close the active sdlxliff file opened in the Editor

Hello.

I'm trying to learn the features available in the Integration API.
The first thing that I'm trying is to close the active sdlxliff file opened in the Editor.

I've created a C# project with a form containing one button.

I've added the following references:

Sdl.Desktop.IntegrationApi
Sdl.Desktop.IntegrationApi.Extensions
Sdl.TranslationStudioAutomation.IntegrationApi

Below is the code written in Form1.cs.

When I run this code, nothing happens (the active file does not close).
What am I missing here?

Thank you in advance.

Tak Osato


====================================================
using System;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using System.Net.NetworkInformation;
using System.Globalization;
using System.Threading;
using System.ComponentModel;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sdl.Desktop.IntegrationApi;
using Sdl.Desktop.IntegrationApi.Extensions;
using Sdl.TranslationStudioAutomation.IntegrationApi;


namespace Trados_SDK_test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {

            EditorController myEditor = new EditorController();
                       

            Document myDoc;

            
            myDoc = myEditor.ActiveDocument;

            myEditor.Close(myDoc);



        }
    }
}

===========================================

Parents Reply
  • Hi Sorin

    Thanks for your reply; I realized that this DLL is only available for SDK 2014, but in our agency the main translation tool is still Studio 2011, so I need to find a solution using SDK 2011.

    I created a verification plug-in which performs several verifications, however, there are 2 ways to launch a verification task, the first one is through the batch task (which verifies all files in the same project) and the second one is with a file open in editor, press F8 (or Tools -> Verify), depending on which one was used, I want to do different treatment, like save the file already open in my editor, for example.

    I thought, the way to tell whether I am using a batch task or I am verifying an individual file in editor is to see whether the file is open in my editor, but if I don’t have access to an instance of my editor, then I won’t be able to check that.

    Or is there any other way to detect if a batch verification is launched? Or F8 is pressed (like an event handler?).

    Hope I was clear with my explanation.

    Thanks

    Marcelo

Children