Upgrading plugins for Studio 2021

Hi there,

I am referring to this article that describes how to use WPF in Studio 2021 compatible plugins:

https://community.sdl.com/developers-more/developers/language-developers/w/wiki/5294/api-improvements-in-studio-2021

I read through this piece of documentation and I have tried to use the information and create a view for one of my plugins using WPF. But I not getting anywhere with this description. 

Question: If upgrading existing plugins that implement views and view parts - are we forced to use WPF from now on or can we still use Windows forms as before?

Can you describe what would be necessary to upgrade the plugins and keep existing views/view parts intact?

thanks

Tom

Parents Reply
  • Hello Andrea, 

    I had a look at the CleanupTasks plugin and there I found that you initialize the view with this command:

    var control = GetControl() as CleanUpSourceSettingsControl;

    Is that correct?

    Question: The interface in Studio 2021 is set to type IUIControl and not Control as the line above would suggest:

    Screenshot of Trados Studio code with a line highlighted showing the initialization of a view with a command in VB.net.

    Accordingly, I construct it like this:

    Screenshot of Trados Studio code with a function 'GetContentControl' returning 'ViewContent.Value' in VB.net.

    The plugin then compiles fine, but when I launch Studio 2021, I am getting:

    Error message in Trados Studio stating 'Unable to cast object of type 'DailyDilbert.ViewControl' to type 'Sdl.Desktop.IntegrationApi.Interfaces.IUIControl'.

    If I change the code to this (resembling the line above "var control = GetControl() as CleanUpSourceSettingsControl;" in VB.net, i.e. using the Control interface and a Function (not a Protected override function), like this:

    Screenshot of Trados Studio code with a function 'GetContentControl' returning 'ViewContent.Value' and highlighted to show the use of 'Control' interface in VB.net.

    I am getting the same error when Studio 2021 is launched with the plugin:

    Error message in Trados Studio identical to alt_text_3, indicating a persistent issue with casting object types.

    Can you tell me what I am doing wrong?

    Many thanks in advance!

    Tom



    Generated Image Alt-Text
    [edited by: Trados AI at 1:23 PM (GMT 0) on 5 Mar 2024]
Children