Skip to content

Instantly share code, notes, and snippets.

View cromica's full-sized avatar

Romulus Crisan cromica

View GitHub Profile
@cromica
cromica / UpdateSegmentPair.cs
Created May 28, 2015 12:30
sample code showing how to update a segment pair using integration API
var segmentPair = _editorController.ActiveDocument.ActiveSegmentPair;
foreach (var markupData in segmentPair.Target)
{
var text = markupData as IText;
if (text != null)
{
text.Properties.Text = "Segment directly updated";
}
}
@cromica
cromica / UpdateSegmentPairProperties.cs
Created May 28, 2015 12:31
sample code showing how to update a segment pair properties using integration API
var segmentPair = _editorController.ActiveDocument.ActiveSegmentPair;
segmentPair.Properties.IsLocked = !segmentPair.Properties.IsLocked;
_editorController.ActiveDocument.UpdateSegmentPairProperties(segmentPair.Properties);
@cromica
cromica / UpdateParagraphProperties.cs
Created June 2, 2015 11:53
sample code showing how to update a paragraph properties using integration API
var segmentPair = _editorController.ActiveDocument.ActiveSegmentPair;
var paragraphProperties = segmentPair.GetParagraphUnitProperties();
var newComment = _editorController.ActiveDocument.PropertiesFactory.CreateComment("Test Comment", "Test author",
Severity.High);
if (paragraphProperties.Comments==null)
{
paragraphProperties.Comments = _editorController.ActiveDocument.PropertiesFactory.CreateCommentProperties();
}
@cromica
cromica / AddCommentOnSegment.cs
Created June 2, 2015 12:05
sample code showing how to add comment on segment using integration API
var editorController = GetEditorController();
var segmentId = editorController.ActiveDocument.ActiveSegmentPair.Properties.Id.Id;
editorController.ActiveDocument.AddCommentOnSegment(segmentId, string.Format("Comment {0}", ++_commentsCount), Severity.Low);
@cromica
cromica / UpdateCommentOnSegment.cs
Created June 2, 2015 12:06
sample code showing how to update comment on segment using integration API
var editorController = GetEditorController();
var segmentId = editorController.ActiveDocument.ActiveSegmentPair.Properties.Id.Id;
var c = editorController.ActiveDocument.GetCommentsFromSegment(segmentId);
editorController.ActiveDocument.UpdateCommentOnSegment(segmentId, c.ElementAt(0),
string.Format("U Comment {0}", ++_commentsCount),
Severity.Medium);
@cromica
cromica / DeleteCommentSegment.cs
Created June 2, 2015 12:21
sample code showing how to delete comment on segment using integration API
var editorController = GetEditorController();
var segmentId = editorController.ActiveDocument.ActiveSegmentPair.Properties.Id.Id;
var c = editorController.ActiveDocument.GetCommentsFromSegment(segmentId);
editorController.ActiveDocument.DeleteCommentOnSegment(segmentId, c.ElementAt(0));
@cromica
cromica / DeleteAllCommentsOnSegment.cs
Created June 2, 2015 12:23
sample code showing how to delete all comments on a segment using integration API
var editorController = GetEditorController();
var segmentId = editorController.ActiveDocument.ActiveSegmentPair.Properties.Id.Id;
editorController.ActiveDocument.DeleteAllCommentsOnSegment(segmentId);
@cromica
cromica / SegmentConfirmationLevel.cs
Created June 2, 2015 12:38
sample code showing how you can change the segment confirmation level or subscribe to the changed event using Integration API
var editorController = GetEditorController();
var segmentId = editorController.ActiveDocument.ActiveSegmentPair.Properties.Id.Id;
editorController.ActiveDocument.SegmentsConfirmationLevelChanged += ActiveDocument_SegmentsConfirmationLevelChanged;
editorController.ActiveDocument.ChangeConfirmationLevelOnSegment(segmentId, ConfirmationLevel.Translated);
@cromica
cromica / AutoSuggestIcon.cs
Created June 2, 2015 12:49
sample code on how to specify custom icon for AutoSuggest provider using Integration API
[AutoSuggestProvider(Id = "SourceCopyAutoSuggestProvider", Name = "AutoSuggest provider for copying the source words")]
public class SourceCopyAutoSuggestProvider : AbstractAutoSuggestProvider
{
private List<string> _segmentWordSuggestCandidates;
public SourceCopyAutoSuggestProvider()
{
// Set the default icon for the suggestions from this provider
Icon = new Icon(SystemIcons.Exclamation, 16, 16);
}
@cromica
cromica / CsvAuthenticationProvider.plugin.xml
Created October 29, 2015 10:12
Example to create plugin manifest for groupshare
<?xml version="1.0" encoding="utf-16"?>
<plugin id="Unique id of your plugin" name="name of your plugin" version="the plugin version">
<!--public key token has to be the same for all the plugins so do not change the value from this sample. you need to sign your plugin assembly to have this public key toke-->
<extension type="{Name of your type including the namespace}, {Assembly name}, Version={Assembly version}, Culture=neutral, PublicKeyToken=c28cdb26c445c888">
<extensionAttribute type="Sdl.StudioServer.Api.Core.CustomAuthenticationProviderExtentionAttribute, Sdl.StudioServer.Api.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888">
<constructorArgs />
<properties>
<property name="CanValidateUserExistance">True</property>
</properties>
</extensionAttribute>