How can open a file at Editor view ?

Looks like easy, but I do not how to do this.

Let's say, I'm at Files view and selected a file.
Now, I'd like to have it opened at Editor view.

Tips please (SendKeys is not an option)

Thanks

2 Replies Latest Replies: 10 Dec 2018 10:03 AM by Andreas Galambos
  • First you need to get control of the files view, e.g. like this:

    private FilesController GetFilesController()
    {
        return SdlTradosStudio.Application.GetController<FilesController>();
    }

    Then you need to hook into the event, when a file is selected/selection changed:

    GetFilesController().SelectedFilesChanged += MyFilesViewPartControl_SelectedFilesChanged;

    Then you can do your desired action in your event handler:

    private void MyFilesViewPartControl_SelectedFilesChanged(object sender, EventArgs e)
    {
        var editController = SdlTradosStudio.Application.GetController<EditorController>();
        // some code to get the selected file/files.
        editController.Open(pFile, EditingMode.Translation);
    }

    That about what you need?

    Regards,
    Andreas


Related