Skip to content

Instantly share code, notes, and snippets.

@andreaGhisa
Last active July 26, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreaGhisa/ff50e709c09bb366bc857b6f9dcbaac4 to your computer and use it in GitHub Desktop.
Save andreaGhisa/ff50e709c09bb366bc857b6f9dcbaac4 to your computer and use it in GitHub Desktop.
Norification
//get Studio Event Aggregator
_eventAggregator = SdlTradosStudio.Application.GetService<IStudioEventAggregator>();
//create event group
_notificationGroup = new InSourceNotificationGroup(NotificationGroupId)
{
Title = "InSource Notifications"
};
//create notification
var notification = new InSourceNotification(id)
{
Title = "Notification Title",
AlwaysVisibleDetails = new List<string>
{
"Fist description",
"Second description"
},
IsActionVisible = true // set to true because we want to show a button with an action
};
//create the action for notification button
Action action = ()=>CreateProjectFromNotification(notification);
_createProjectCommand = new InSourceCommand(action)
{
CommandText = "Create project"
};
notification.Action = _createProjectCommand;
notificationGroup.Notifications.Add(notification)
//publish notification in Studio
var groupEvent = new AddStudioGroupNotificationEvent(_notificationGroup);
_eventAggregator.Publish(groupEvent);
var showNotification = new ShowStudioNotificationsViewEvent(true,true);
_eventAggregator.Publish(showNotification);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment