summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-10-10 20:13:19 +0000
committersr55 <[email protected]>2012-10-10 20:13:19 +0000
commit1bbc7702f0d57f826ae359dfd519e2c1400f84da (patch)
tree714e36990eb8cac4f866c287dd93916374edc493 /win/CS/HandBrakeWPF/Services
parent7602fc9323c7e2f73fde18363e1abc44f99dd392 (diff)
WinGui: API Tidyup Part 2 of many. Growl Support.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5011 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r--win/CS/HandBrakeWPF/Services/Interfaces/INotificationService.cs6
-rw-r--r--win/CS/HandBrakeWPF/Services/NotificationService.cs84
2 files changed, 90 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/INotificationService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/INotificationService.cs
new file mode 100644
index 000000000..d955bb55c
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/Interfaces/INotificationService.cs
@@ -0,0 +1,6 @@
+namespace HandBrakeWPF.Services.Interfaces
+{
+ public interface INotificationService
+ {
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/NotificationService.cs b/win/CS/HandBrakeWPF/Services/NotificationService.cs
new file mode 100644
index 000000000..234130b72
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/NotificationService.cs
@@ -0,0 +1,84 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="NotificationService.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Notification Service (Growl Connector)
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services
+{
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.Helpers;
+ using HandBrakeWPF.Services.Interfaces;
+
+ /// <summary>
+ /// The Notification Service (Growl Connector)
+ /// </summary>
+ public class NotificationService : INotificationService
+ {
+ /// <summary>
+ /// The user setting service.
+ /// </summary>
+ private readonly IUserSettingService userSettingService;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="NotificationService"/> class.
+ /// </summary>
+ /// <param name="encodeService">
+ /// The encode Service.
+ /// </param>
+ /// <param name="queueProcessor">
+ /// The queue Processor.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
+ {
+ this.userSettingService = userSettingService;
+ encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
+ queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
+ GrowlCommunicator.Register();
+ }
+
+ /// <summary>
+ /// The queue processor_ queue completed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EventArgs.
+ /// </param>
+ private void QueueProcessorQueueCompleted(object sender, System.EventArgs e)
+ {
+ // Growl
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlQueue))
+ {
+ GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
+ }
+ }
+
+ /// <summary>
+ /// The encode service_ encode completed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EncodeCompletedEventArgs.
+ /// </param>
+ private void EncodeServiceEncodeCompleted(object sender, HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs e)
+ {
+ // Growl
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlEncode))
+ {
+ GrowlCommunicator.Notify(
+ "Encode Completed", "Put down that cocktail...\nyour Handbrake encode is done.");
+ }
+ }
+ }
+}