Last active
July 26, 2018 11:53
-
-
Save andreaGhisa/ff50e709c09bb366bc857b6f9dcbaac4 to your computer and use it in GitHub Desktop.
Norification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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