<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.rws.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12 Non-Production</generator><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021</link><pubDate>Thu, 20 Aug 2020 12:22:53 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Current Revision posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/20/2020 12:22:53 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-03-50/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-03-50/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-03-50/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-03-50/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-03-50/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-03-50/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-03-50/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-03-50/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;p&gt;In order to use Event Aggregator in your plugin first of all&amp;nbsp;&lt;strong&gt;System.Reactive&lt;/strong&gt; needs to be installed from &lt;strong&gt;NuGet&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1213x188/__key/communityserver-wikis-components-files/00-00-00-03-50/Reactive.png" /&gt;&lt;/p&gt;
&lt;p&gt;After the&amp;nbsp;reference is added to the Visual Studio project,&amp;nbsp;include the library into the manifest file:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;lt;Include&amp;gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;lt;File&amp;gt;System.Reactive.dll&amp;lt;/File&amp;gt;&lt;br /&gt; &amp;nbsp; &amp;lt;/Include&amp;gt;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-03-50/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-03-50/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-03-50/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-03-50/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-03-50/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-03-50/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-03-50/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New&amp;nbsp;API Exposed - Versioning API&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This API allows developers to have a easy access to the following information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A list of all Studio versions installed on the machine.&lt;/li&gt;
&lt;li&gt;Version of the Studio instance, which is currently running.&lt;/li&gt;
&lt;li&gt;Different&amp;nbsp;useful information for development like: Install folder path, public version, short version&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/589x149/__key/communityserver-wikis-components-files/00-00-00-03-50/version.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/783x445/__key/communityserver-wikis-components-files/00-00-00-03-50/versionapp.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to use the new version api in the project you need to add a reference to:&amp;nbsp;&lt;strong&gt;Sdl.Versioning.dll. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Full source code can be found &lt;a href="https://github.com/sdl/Sdl-Community/tree/Studio_Wonderland/Code%20samples/StudioVersioning_CodeSample"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New controllers exposed&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the API were exposed 3 new controllers which allows you to add actions in following Studio Views:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Welcome view&lt;/li&gt;
&lt;li&gt;Translation Memories View&lt;/li&gt;
&lt;li&gt;Reports View&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/491x218/__key/communityserver-wikis-components-files/00-00-00-03-50/reportsView.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/884x234/__key/communityserver-wikis-components-files/00-00-00-03-50/welcomeAction.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/23</link><pubDate>Thu, 20 Aug 2020 12:22:05 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 23 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/20/2020 12:22:05 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;p&gt;In order to use Event Aggregator in your plugin first of all you &lt;strong&gt;System.Reactive&lt;/strong&gt; needs to be installed from NuGet.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1213x188/__key/communityserver-wikis-components-files/00-00-00-00-39/Reactive.png" /&gt;&lt;/p&gt;
&lt;p&gt;After the&amp;nbsp;reference is added to the Visual Studio project,&amp;nbsp;include the library into the manifest file:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;lt;Include&amp;gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;lt;File&amp;gt;System.Reactive.dll&amp;lt;/File&amp;gt;&lt;br /&gt; &amp;nbsp; &amp;lt;/Include&amp;gt;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New&amp;nbsp;API Exposed - Versioning API&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This API allows developers to have a easy access to the following information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A list of all Studio versions installed on the machine.&lt;/li&gt;
&lt;li&gt;Version of the Studio instance, which is currently running.&lt;/li&gt;
&lt;li&gt;Different&amp;nbsp;useful information for development like: Install folder path, public version, short version&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/589x149/__key/communityserver-wikis-components-files/00-00-00-00-39/version.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/783x445/__key/communityserver-wikis-components-files/00-00-00-00-39/versionapp.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to use the new version api in the project you need to add a reference to:&amp;nbsp;&lt;strong&gt;Sdl.Versioning.dll. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Full source code can be found &lt;a href="https://github.com/sdl/Sdl-Community/tree/Studio_Wonderland/Code%20samples/StudioVersioning_CodeSample"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New controllers exposed&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the API were exposed 3 new controllers which allows you to add actions in following Studio Views:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Welcome view&lt;/li&gt;
&lt;li&gt;Translation Memories View&lt;/li&gt;
&lt;li&gt;Reports View&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/491x218/__key/communityserver-wikis-components-files/00-00-00-00-39/reportsView.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/884x234/__key/communityserver-wikis-components-files/00-00-00-00-39/welcomeAction.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/22</link><pubDate>Thu, 06 Aug 2020 11:56:19 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 22 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 11:56:19 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New&amp;nbsp;API Exposed - Versioning API&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This API allows developers to have a easy access to the following information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A list of all Studio versions installed on the machine.&lt;/li&gt;
&lt;li&gt;Version of the Studio instance, which is currently running.&lt;/li&gt;
&lt;li&gt;Different&amp;nbsp;useful information for development like: Install folder path, public version, short version&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/589x149/__key/communityserver-wikis-components-files/00-00-00-00-39/version.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/783x445/__key/communityserver-wikis-components-files/00-00-00-00-39/versionapp.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to use the new version api in the project you need to add a reference to:&amp;nbsp;&lt;strong&gt;Sdl.Versioning.dll. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Full source code can be found &lt;a href="https://github.com/sdl/Sdl-Community/tree/Studio_Wonderland/Code%20samples/StudioVersioning_CodeSample"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New controllers exposed&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the API were exposed 3 new controllers which allows you to add actions in following Studio Views:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Welcome view&lt;/li&gt;
&lt;li&gt;Translation Memories View&lt;/li&gt;
&lt;li&gt;Reports View&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/491x218/__key/communityserver-wikis-components-files/00-00-00-00-39/reportsView.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/884x234/__key/communityserver-wikis-components-files/00-00-00-00-39/welcomeAction.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/21</link><pubDate>Thu, 06 Aug 2020 11:47:02 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 21 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 11:47:02 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New&amp;nbsp;API Exposed - Versioning API&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This API allows developers to have a easy access to the following information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A list of all Studio versions installed on the machine.&lt;/li&gt;
&lt;li&gt;Version of the Studio instance, which is currently running.&lt;/li&gt;
&lt;li&gt;Different&amp;nbsp;useful information for development like: Install folder path, public version, short version&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/589x149/__key/communityserver-wikis-components-files/00-00-00-00-39/version.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/783x445/__key/communityserver-wikis-components-files/00-00-00-00-39/versionapp.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to use the new version api in the project you need to add a reference to:&amp;nbsp;&lt;strong&gt;Sdl.Versioning.dll. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Full source code can be found &lt;a href="https://github.com/sdl/Sdl-Community/tree/Studio_Wonderland/Code%20samples/StudioVersioning_CodeSample"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New controllers exposed&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the API were exposed 3 new controllers which allows you to add actions in following Studio Views:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Welcome view&lt;/li&gt;
&lt;li&gt;Translation Memories View&lt;/li&gt;
&lt;li&gt;Reports View&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/20</link><pubDate>Thu, 06 Aug 2020 11:03:14 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 20 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 11:03:14 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New&amp;nbsp;API Exposed - Versioning API&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This API allows developers to have a easy access to the following information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A list of all Studio versions installed on the machine.&lt;/li&gt;
&lt;li&gt;Version of the Studio instance, which is currently running.&lt;/li&gt;
&lt;li&gt;Different&amp;nbsp;useful information for development like: Install folder path, public version, short version&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/589x149/__key/communityserver-wikis-components-files/00-00-00-00-39/version.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/783x445/__key/communityserver-wikis-components-files/00-00-00-00-39/versionapp.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to use the new version api in the project you need to add a reference to:&amp;nbsp;&lt;strong&gt;Sdl.Versioning.dll. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Full source code can be found &lt;a href="https://github.com/sdl/Sdl-Community/tree/Studio_Wonderland/Code%20samples/StudioVersioning_CodeSample"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/19</link><pubDate>Thu, 06 Aug 2020 10:07:13 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 19 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 10:07:13 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New&amp;nbsp;API Exposed - Versioning API&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This API allows developers to have a easy access to the following information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A list of all Studio versions installed on the machine.&lt;/li&gt;
&lt;li&gt;Version of the Studio instance, which is currently running.&lt;/li&gt;
&lt;li&gt;Different&amp;nbsp;useful information for development like: Install folder path, public version, short version&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/589x149/__key/communityserver-wikis-components-files/00-00-00-00-39/version.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to use the new version api in the project you need to add a reference to:&amp;nbsp;&lt;strong&gt;Sdl.Versioning.dll&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/18</link><pubDate>Thu, 06 Aug 2020 08:45:09 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 18 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 8:45:09 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/17</link><pubDate>Thu, 06 Aug 2020 08:43:46 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 17 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 8:43:46 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the AP&lt;strong&gt;I project icon&lt;/strong&gt; and &lt;strong&gt;project origin&amp;nbsp;&lt;/strong&gt;can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;How to get the project status and project type&lt;/h3&gt;
&lt;div class="line number12 index11 alt1"&gt;&lt;code class="c# comments"&gt;// Retrieve the needed information from the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number13 index12 alt2"&gt;&lt;code class="c# plain"&gt;var projectInfo = proj.GetProjectInfo();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number14 index13 alt1"&gt;&lt;code class="c# plain"&gt;var status = projectInfo?.Status;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the current status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number15 index14 alt2"&gt;&lt;code class="c# plain"&gt;var publicationStatus = projectInfo?.PublicationStatus;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the publication status of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# plain"&gt;var projectType = projectInfo?.ProjectType;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;code class="c# comments"&gt;// the type of the project&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number16 index15 alt1"&gt;&lt;code class="c# comments"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;Full code sample can be found &lt;a href="https://github.com/sdl/Sdl-Community/blob/Studio_Wonderland/Code%20samples/ProjectInformationSample/MyCustomTradosStudio.cs"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/16</link><pubDate>Thu, 06 Aug 2020 08:37:10 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 16 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 8:37:10 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;strong&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&amp;nbsp;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&amp;nbsp;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;strong&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Following properties were exposed in ProjectInfo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Project Origin&lt;/li&gt;
&lt;li&gt;Icon Path&lt;/li&gt;
&lt;li&gt;Project Status&lt;/li&gt;
&lt;li&gt;Project Type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this new options when a studio project is created using the API Project Icon and Path can be set:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1157x61/__key/communityserver-wikis-components-files/00-00-00-00-39/projectIcon.png" /&gt;&lt;/p&gt;
&lt;p&gt;Source Code:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;projectInfo&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;ProjectInfo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Name&amp;nbsp;=&amp;nbsp;_constants.LingotekTempProj,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; SourceLanguage&amp;nbsp;=&amp;nbsp;sourceLang,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; LocalProjectFolder&amp;nbsp;=&amp;nbsp;projectPath,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; ProjectOrigin=&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;Lingotek&amp;nbsp;project&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; IconPath&amp;nbsp;=&amp;nbsp;GetIconPath(),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; TargetLanguages&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;[]&amp;nbsp;{targetLang}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;icon&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Plugins\Unpacked&amp;nbsp;folder&amp;nbsp;and&amp;nbsp;use&amp;nbsp;the&amp;nbsp;icon&amp;#39;s&amp;nbsp;path&amp;nbsp;from&amp;nbsp;that&amp;nbsp;folder&amp;nbsp;in&amp;nbsp;order&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;project&amp;#39;s&amp;nbsp;IconPath&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;&amp;nbsp;GetIconPath()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;assemblyPath&amp;nbsp;=&amp;nbsp;Assembly.GetExecutingAssembly().Location;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;directoryInfo&amp;nbsp;=&amp;nbsp;Directory.GetParent(assemblyPath);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath&amp;nbsp;=&amp;nbsp;Path.Combine(directoryInfo.FullName,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;icon.ico&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt;&amp;nbsp;(&lt;/span&gt;&lt;span&gt;var&lt;/span&gt;&lt;span&gt;&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt;&amp;nbsp;FileStream(targetPath,&amp;nbsp;FileMode.Create))&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PluginResources.icon.Save(fs);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;targetPath;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/15</link><pubDate>Thu, 06 Aug 2020 08:13:34 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 15 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 8/6/2020 8:13:34 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm0"&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ef1cjffm1"&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm2"&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm3"&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2 id="mcetoc_1ef1cjffm4"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm5"&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ef1cjffm6"&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffm7"&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm8"&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffm9"&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3 id="mcetoc_1ef1cjffma"&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;span&gt;ChangeSourceContentSettingsEvent&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 id="mcetoc_1ef1cjffmb"&gt;&lt;span&gt;Comments Changed event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;CommentsChangedEvent&amp;nbsp;notifies the user when comments on a document have changed, it includes&amp;nbsp;information about :&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Comment event type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Comment scope&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;A list of comments&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Added event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;If the comment was added for a selection in studio:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/593x335/__key/communityserver-wikis-components-files/00-00-00-00-39/SelectionComm.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following information will be displayed by the CommentsEvent:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/1062x103/__key/communityserver-wikis-components-files/00-00-00-00-39/commentscope.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="/resized-image/__size/326x268/__key/communityserver-wikis-components-files/00-00-00-00-39/comment.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Deleted event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/527x89/__key/communityserver-wikis-components-files/00-00-00-00-39/commDeleted.png" /&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1ef1cjffmc"&gt;&lt;span&gt;Comment Changed event type&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If we are adding a comment &lt;strong&gt;to the current file scope and the file does not have any other comments set&lt;/strong&gt;, the event response will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/169x61/__key/communityserver-wikis-components-files/00-00-00-00-39/filecomm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where the comments list contains the new comment added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the file already contains comments at the file scope &lt;/strong&gt;when we add a new comment to the file, we&amp;#39;ll receive the list with all the comments from the file scope.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/178x60/__key/communityserver-wikis-components-files/00-00-00-00-39/commmultiple.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Source code&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;code class="c# plain"&gt;_eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;code class="c# plain"&gt;_eventAggregator.GetEvent&amp;lt;CommentsChangedEvent&amp;gt;().Subscribe(CommentsChanged);&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="line number5 index4 alt2"&gt;&lt;code class="c# keyword"&gt;private&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c# keyword"&gt;void&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c# plain"&gt;CommentsChanged(CommentsChangedEvent e)&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number6 index5 alt1"&gt;&lt;code class="c# plain"&gt;{&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number7 index6 alt2"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;
&lt;h2 id="mcetoc_1ef1cjffmd"&gt;&lt;strong&gt;Enahncements to ProjectInfo&amp;nbsp;&lt;/strong&gt;&lt;/h2&gt;
&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number8 index7 alt1"&gt;&lt;code class="c# plain"&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/14</link><pubDate>Wed, 06 May 2020 14:52:22 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 14 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 2:52:22 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span&gt;Segments merged event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;SegmentsMergedEvent&amp;nbsp;notifies the user when multiple segments are merged. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;Paragraph Unit Id&lt;/li&gt;
&lt;li&gt;The ID of the&amp;nbsp;new segment which resulted after merge operation&lt;/li&gt;
&lt;li&gt;The IDs of the segments which were merged&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentsMergedEvent&amp;gt;().Subscribe(SegmentsMerged);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentsMerged(SegmentsMergedEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var newSegmentId = e.NewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var oldSegmentIds = e.OldSegmentIds;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/13</link><pubDate>Wed, 06 May 2020 14:20:46 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 13 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 2:20:46 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span&gt;Segment split&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;User can subscribe to SegmentSplit event and it will be notified every time a segment is split in Studio Editor. Following details are received in the event arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Document name&lt;/li&gt;
&lt;li&gt;The original segment id which was split&lt;/li&gt;
&lt;li&gt;The ID of the first new segment&lt;/li&gt;
&lt;li&gt;The ID of the second new id&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.GetEvent&amp;lt;SegmentSplitEvent&amp;gt;().Subscribe(SegmentSplit);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;private&amp;nbsp;void&amp;nbsp;SegmentSplit(SegmentSplitEvent e)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var document = e.Document;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var originalSegId = e.OriginalSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var firstNewSegmentId = e.FirstNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var secondNewSegmentId = e.SecondNewSegmentId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;var paragraphUnit = e.ParagraphUnitId;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/12</link><pubDate>Wed, 06 May 2020 14:04:18 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 12 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 2:04:18 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span&gt;Change source content settings&amp;nbsp;event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows to change the source settings for following properties for a Project:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Allow source editing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Allow merge across paragraphs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Enable Icu Tokenization&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,true,true));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;or&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;ChangeSourceContentSettingsEvent(activeProject,false,false,true));&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/11</link><pubDate>Wed, 06 May 2020 13:59:46 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 11 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 1:59:46 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;eventAggregator.Publish(new&amp;nbsp;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/10</link><pubDate>Wed, 06 May 2020 13:57:57 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 10 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 1:57:57 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;New events exposed using IStudioEventAggregator&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Based on the feedback we received on the Community we exposed couple of events using Event Aggregator.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;&lt;span&gt;Open project for selected language event&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span&gt;This event allows user using the API to open the Files View for a specific target language.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Code sample:&lt;/span&gt;&lt;/p&gt;
&lt;div class="line number1 index0 alt2"&gt;&lt;code class="c# plain"&gt;var eventAggregator = SdlTradosStudio.Application.GetService&amp;lt;IStudioEventAggregator&amp;gt;();&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number2 index1 alt1"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="line number3 index2 alt2"&gt;&lt;code class="c# plain"&gt;eventAggregator.Publish(&lt;/code&gt;&lt;code class="c# keyword"&gt;new&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c# plain"&gt;OpenProjectForSelectedLanguageEvent(activeProject,targetLanguage));&lt;/code&gt;&lt;/div&gt;
&lt;div class="line number4 index3 alt1"&gt;&lt;code class="c# plain"&gt;eventAggregator.Publish(&lt;/code&gt;&lt;code class="c# keyword"&gt;new&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c# plain"&gt;OpenProjectForSelectedLanguageEvent(activeProject));&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Improvements in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/9</link><pubDate>Wed, 06 May 2020 10:19:07 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 9 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 10:19:07 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Changes in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/8</link><pubDate>Wed, 06 May 2020 10:17:55 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 8 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 5/6/2020 10:17:55 AM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;IStudioDocument and&lt;span&gt;&amp;nbsp;I&lt;/span&gt;&lt;span class="pl-en"&gt;DisplayFilterRowInfo interfaces&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;We exposed two new interfaces in the Integration API &amp;nbsp;that&amp;nbsp;&lt;/span&gt;&lt;span&gt;promotes a testable environment for&amp;nbsp;&lt;/span&gt;&lt;span&gt;developers integrating with the Document object.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;How to update plugins which have&amp;nbsp;references to Studio Document&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;If a plugin have a reference to &lt;strong&gt;Document&lt;/strong&gt; this error will appear in Visual Studio:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1304x387/__key/communityserver-wikis-components-files/00-00-00-00-39/doc.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To fix it is quite simple, you only need to&lt;strong&gt; change the type of the object and use the new interface exposed in the API (IStudioDocument)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="/resized-image/__size/669x267/__key/communityserver-wikis-components-files/00-00-00-00-39/ist.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The same fix applies to the plugins which have references to&amp;nbsp;DisplayFilterRowInfo, we need to use the interface instead&amp;nbsp;IDisplayFilterRowInfo.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Changes in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/7</link><pubDate>Fri, 24 Apr 2020 12:29:21 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 7 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/24/2020 12:29:21 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;View Parts Changes&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Changes in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/6</link><pubDate>Fri, 24 Apr 2020 12:27:29 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 6 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/24/2020 12:27:29 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;At this point the error form Visual Studio console should dissapear and the plugin will be successfully be displayed in Studio.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/597x143/__key/communityserver-wikis-components-files/00-00-00-00-39/dsi.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Changes in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/5</link><pubDate>Fri, 24 Apr 2020 12:24:37 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 5 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/24/2020 12:24:37 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/306x411/__key/communityserver-wikis-components-files/00-00-00-00-39/after.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item><item><title>API Changes in Studio 2021</title><link>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021/revision/4</link><pubDate>Fri, 24 Apr 2020 12:17:53 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:3c7f315a-c365-4c19-b249-5c0a6e286db3</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/5294/api-improvements-in-studio-2021#comments</comments><description>Revision 4 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/24/2020 12:17:53 PM&lt;br /&gt;
&lt;p&gt;In this release of Studio, public API were improved to make interaction with Studio more easy and more robust.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the &lt;strong&gt;feedback we received in the Community&lt;/strong&gt; we exposed couple of events for: Segment Split action, Segment Merged action.&amp;nbsp;The full list of events will be presented in a separate section of this wiki.&lt;/p&gt;
&lt;p&gt;To promote:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Automation Testing&lt;/strong&gt; we expose interfaces which will allow users to write &lt;strong&gt;Integration Tests by mocking common objects from the Integration API.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Windows Presentation Foundation (WPF),&amp;nbsp;&lt;/b&gt;plugins which have &lt;strong&gt;View Parts written using WPF&lt;/strong&gt; now are &lt;strong&gt;recognized by Studio whithout using an Windows Forms Element Host.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Before starting to update your pluginsto support API Changes, please make sure the plugin is migrated correctly to Studio 2021. More information can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/5292/how-to-update-plugins-to-studio-2021"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;How to update plugins which have View Parts&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In the bellow example we&amp;#39;ll update the &lt;a href="https://appstore.sdl.com/language/app/dsi-viewer/995/"&gt;DSI VIewer &lt;/a&gt;plugin to support the &lt;strong&gt;latest chages in the Integration API&lt;/strong&gt;. The view part of this plugin is written&amp;nbsp;using WPF and is a great example which ilustrates how easy the View Parts can be recognized by Studio.&lt;/p&gt;
&lt;p&gt;The source code of this plugin is open Source on our &lt;a href="https://github.com/sdl/Sdl-Community/tree/master/DSI%20Viewer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Plugin architecture&lt;/h3&gt;
&lt;p&gt;Before the API Changes we had to&amp;nbsp;create an Windows Forms Control which had an ElementHost control in which we added our WPF View.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/476x476/__key/communityserver-wikis-components-files/00-00-00-00-39/ElementHost.png" /&gt;&lt;/p&gt;
&lt;p&gt;After you change the references to point to Studio16 folder you&amp;#39;ll see in Visual Studio following error:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/942x696/__key/communityserver-wikis-components-files/00-00-00-00-39/UI.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this error appeared and how to fix it&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First thing we need to do is to make the WPF View to Implement the &lt;strong&gt;IUIControl interface &lt;/strong&gt;exposed by Studio&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;Second we need to &lt;strong&gt;remove the reference to WindowsForms control and use the WPF control instead. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our plugin we use MVVM design pattern, that means we need to add the data context to the view. Before it was added in the WindowsForms Control before settings the WPF control to the Element Host.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/344x246/__key/communityserver-wikis-components-files/00-00-00-00-39/str.png" /&gt;&lt;/p&gt;
&lt;p&gt;As we mentioned before we can delete the Windows Froms control and return the WPF instead. In the class which inherits from&amp;nbsp;&lt;strong&gt;AbstractViewPartController &lt;/strong&gt;we can set the data context of the view.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/571x388/__key/communityserver-wikis-components-files/00-00-00-00-39/data-cont.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: API Documentation&lt;/div&gt;
</description></item></channel></rss>