Overview
The Sdl.Community.UsefulTips.Service is a service provider for updating the Useful Tips that are displayed in SDL Trados Studio 2019.
Add Sdl.Community.UsefulTips.Service to your project
Package Manager UI
1. In Solution Explorer, right-click References and choose Manage NuGet Packages
2. Choose nuget.org as the Package source, select the Browse tab, search for Sdl.Community.UsefulTips.Service, select that package in the list, and select Install:
3. Accept any license prompts.
Package Manager Console
1. Select the Tools > NuGet Package Manager > Package Manager Console menu command.
2. From the Package Manager Console, enter the command:
Install-Package Sdl.Community.
UsefulTips.Service -Version 1.1.5
Examples
The following example creates an instance of the TipsProvider and adds a new Tip for a single language (i.e. en).
using System.Collections.Generic;
using
Sdl.Community.UsefulTipsService;
using
Sdl.Community.UsefulTipsService.Model;
using
Sdl.Community.UsefulTipsService.Services;
namespace Sdl.Community.Example.Services
{
public class UsefulTipsService
{
public void AddUsefulTips()
{
var tipsProvider = new TipsProvider(new PathService());
tipsProvider.AddTips(GetTipContexts(), "[My Plugin Name]");
}
private static List<TipContext> GetTipContexts()
{
var tipContexts = new List<TipContext>
{
new TipContext
{
LanguageId = "en",
Tips = new List<Tip>
{
new Tip
{
Category = "[the plugin name]",
Context = "[the Id associated wth the plugin View]",
Content = "[full path to the Markdown File]",
Title = "My Tip",
Description = "This is an awesome Tip",
DescriptionImage = "[full path to the image file]"
}
}
}
};
return tipContexts;
}
}
}
API
Model
public class TipContext
{
/// <summary>
/// The UI language Id supported by SDL Trados Studio
/// [de, en, es, fr, it, ja, ko, ru, zh]
/// </summary>
public string LanguageId { get; set; }
/// <summary>
/// Tips available in the current language context
/// </summary>
public List<Tip> Tips { get; set; }
}
public class Tip
{
public string Id { get; set; }
/// <summary>
/// The title displayed in the 'Useful Tips' view part
/// </summary>
public string Title { get; set; }
/// <summary>
/// The description displayed in the 'Useful Tips' view part
/// </summary>
public string Description { get; set; }
/// <summary>
/// // The link text displayed in the 'Useful Tips' view part
/// </summary>
public string LinkText { get; set; }
/// <summary>
/// The View Id
/// </summary>
public string Context { get; set; }
/// <summary>
/// The category used to group the Tips; appropriate to the plugin
/// or view name
/// </summary>
public string Category { get; set; }
/// <summary>
/// Full path to the icon
/// </summary>
public string Icon { get; set; }
/// <summary>
/// Full path to the description image that is displayed in the
/// 'Useful Tips' view
/// </summary>
public string DescriptionImage { get; set; }
/// <summary>
/// Full path to the Markdown file that is loaded when the user
/// clicks on the 'Link Text' link
/// </summary>
public string Content { get; set; }
public bool IsNew { get; set; }
public bool ShowOnWelcomeWizard { get; set; }
}
Properties
/// <summary>
/// The supported UI languages for SDL Trados Studio 2019+
/// </summary>
public List<string> SupportedLanguages
Methods
/// <summary>
/// Add Tips to the 'Useful Tips' collection in SDL Trados Studio 2019+
/// </summary>
/// <param name="tipContexts">A list of Tips that you would like to add to
/// the 'Useful Tips' collection in SDL Trados Studio 2019+</param>
/// <param name="applicationName">The name of the application</param>
/// <param name="runasAdmin">Elevate the user rights via the User Account
/// Control (UAC) in Windows</param>
/// <returns>The number of Tips added to 'Useful Tips' collection in SDL Trados
/// Studio 2019+</returns>
public int AddTips(List<TipContext> tipContexts, string applicationName,
bool runasAdmin = true)
/// <summary>
/// Remove Tips from the 'Useful Tips' collection in SDL Trados Studio 2019+
/// </summary>
/// <param name="tipContexts">A list of Tips that you would like to remove from
/// the 'Useful Tips' collection.</param>
/// <param name="applicationName">The name of the application</param>
/// <param name="runasAdmin">Elevate the rights via the User Account Control (UAC)
/// in Windows</param>
/// <returns>The number of Tips that were removed</returns>
public int RemoveTips(List<TipContext> tipContexts, string applicationName,
bool runasAdmin = true)
/// <summary>
/// Get all Tips from the 'Useful Tips' collection in SDL Trados Studio 2019+
/// </summary>
/// <returns>A list of Tips</returns>
public List<TipContext> GetAllTips()
/// <summary>
/// Read the Tip Contexts from the import file; required in the transaction when
/// reading in the Tips with elevated access
/// rights via UAC.
/// </summary>
/// <param name="filePath">full path to the Tips import file</param>
/// <returns>A list of Tips</returns>
public List<TipContext> ReadTipContextsImportFile(string filePath)
/// <summary>
/// Read the Tips the import file
/// </summary>
/// <param name="filePath">full path to the Tips import file</param>
/// <returns>A list of Tips</returns>
public List<Tip> ReadTipsImportFile(string filePath)
/// <summary>
/// Creates an Tips import file, required during the transaction when reading
/// in Tips with elevated access
/// rights via UAC to update the 'Tips.xml' file in the SDL Trados Studio 2019+
/// installation directory.
/// </summary>
/// <param name="filePath">full path to the Tips import file</param>
/// <param name="tips">A list of Tips used to import to the 'Useful Tips'
/// collection</param>
/// <returns>True if the file was created successfully</returns>
public bool CreateTipContextsImportFile(string filePath, List<TipContext> tips)
/// <summary>
/// Create a Tips import file
/// </summary>
/// <param name="filePath">full path to the Tips import file</param>
/// <param name="tips">A list of Tips used to import to the 'Useful Tips'
/// collection</param>
/// <returns>Returns true if successful</returns>
public bool CreateTipsImportFile(string filePath, List<Tip> tips)