// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The Notification Service (Growl Connector) // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Services { using HandBrake.ApplicationServices.Services.Interfaces; using HandBrakeWPF.Helpers; using HandBrakeWPF.Services.Interfaces; /// /// The Notification Service (Growl Connector) /// public class NotificationService : INotificationService { /// /// The user setting service. /// private readonly IUserSettingService userSettingService; /// /// Initializes a new instance of the class. /// /// /// The encode Service. /// /// /// The queue Processor. /// /// /// The user Setting Service. /// public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService) { this.userSettingService = userSettingService; encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted; queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted; GrowlCommunicator.Register(); } /// /// The queue processor_ queue completed. /// /// /// The sender. /// /// /// The EventArgs. /// private void QueueProcessorQueueCompleted(object sender, System.EventArgs e) { // Growl if (userSettingService.GetUserSetting(UserSettingConstants.GrowlQueue)) { GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done."); } } /// /// The encode service_ encode completed. /// /// /// The sender. /// /// /// The EncodeCompletedEventArgs. /// private void EncodeServiceEncodeCompleted(object sender, HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs e) { // Growl if (userSettingService.GetUserSetting(UserSettingConstants.GrowlEncode)) { GrowlCommunicator.Notify( "Encode Completed", "Put down that cocktail...\nyour Handbrake encode is done."); } } } }