diff options
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/Functions/GrowlCommunicator.cs | 118 | ||||
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/Encode.cs | 1 | ||||
-rw-r--r-- | win/C#/HandBrakeCS.csproj | 1 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 3 |
4 files changed, 4 insertions, 119 deletions
diff --git a/win/C#/Functions/GrowlCommunicator.cs b/win/C#/Functions/GrowlCommunicator.cs deleted file mode 100644 index 5db2478d2..000000000 --- a/win/C#/Functions/GrowlCommunicator.cs +++ /dev/null @@ -1,118 +0,0 @@ -/* GrowlCommunicator.cs $
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
-
-namespace Handbrake.Functions
-{
- using System;
- using Growl.Connector;
-
- /// <summary>
- /// Provides all functionality for communicating with Growl for Windows.
- /// </summary>
- /// <remarks>
- /// This class is implemented as a static class because:
- /// 1. It allows nearly all of the Growl-related code to be in one place
- /// 2. It prevents the main form, queue handler, and any other part of Handbrake from having to declare
- /// or track any new instance variables
- /// </remarks>
- public static class GrowlCommunicator
- {
- /// <summary>
- /// The <see cref="GrowlConnector"/> that actually talks to Growl
- /// </summary>
- private static GrowlConnector growl;
-
- /// <summary>
- /// The Handbrake application instance that is registered with Growl
- /// </summary>
- private static Application application;
-
- /// <summary>
- /// Notification shown upon completion of encoding
- /// </summary>
- private static NotificationType encodeOrQueueCompleted = new NotificationType("EncodeOrQueue", "HandBrake Status");
-
- /// <summary>
- /// Checks to see if Growl is currently running on the local machine.
- /// </summary>
- /// <returns>
- /// <c>true</c> if Growl is running;
- /// <c>false</c> otherwise
- /// </returns>
- public static bool IsRunning()
- {
- Initialize();
-
- return growl.IsGrowlRunning();
- }
-
- /// <summary>
- /// Registers Handbrake with the local Growl instance
- /// </summary>
- /// <remarks>
- /// This should usually be called at application start-up
- /// </remarks>
- public static void Register()
- {
- Initialize();
- growl.Register(application, new[] {encodeOrQueueCompleted});
- }
-
- /// <summary>
- /// Sends a notification to Growl. (Since Handbrake currently only supports one type of notification with
- /// static text, this is a shortcut method).
- /// </summary>
- /// <param name="title">
- /// The title.
- /// </param>
- /// <param name="text">
- /// The text to display.
- /// </param>
- public static void Notify(string title, string text)
- {
- Notification notification = new Notification(application.Name, encodeOrQueueCompleted.Name, String.Empty,
- title, text);
- growl.Notify(notification);
- }
-
- /// <summary>
- /// Sends a notification to Growl. (This is the more generic version that could be used in the future if
- /// more notification types are implemented)
- /// </summary>
- /// <param name="notificationType">The <see cref="NotificationType">type</see> of notification to send</param>
- /// <param name="title">The notification title</param>
- /// <param name="text">The notification text</param>
- /// <param name="imageUrl">The notification image as a url</param>
- public static void Notify(NotificationType notificationType, string title, string text, string imageUrl)
- {
- Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title,
- text)
- {
- Icon = imageUrl
- };
-
- growl.Notify(notification);
- }
-
- /// <summary>
- /// Initializes the GrowlCommunicator
- /// </summary>
- private static void Initialize()
- {
- if (growl == null)
- {
- growl = new GrowlConnector
- {
- EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
- };
-
- application = new Application("Handbrake")
- {
- Icon = Properties.Resources.logo64
- };
- }
- }
- }
-}
\ No newline at end of file diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs index 9ca8cdf58..ee1673a2f 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs @@ -60,6 +60,7 @@ namespace HandBrake.ApplicationServices.Services public Encode()
{
this.EncodeStarted += Encode_EncodeStarted;
+ GrowlCommunicator.Register();
}
#region Delegates and Event Handlers
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 203886d13..7323783b4 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -268,7 +268,6 @@ <Compile Include="frmUpdater.designer.cs">
<DependentUpon>frmUpdater.cs</DependentUpon>
</Compile>
- <Compile Include="Functions\GrowlCommunicator.cs" />
<Compile Include="Functions\PresetLoader.cs" />
<Compile Include="Functions\QueryGenerator.cs" />
<Compile Include="Functions\Main.cs" />
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 642eb1f84..ef6efdf03 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -17,6 +17,7 @@ namespace Handbrake using System.Windows.Forms;
using Functions;
+ using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services;
@@ -26,6 +27,8 @@ namespace Handbrake using Presets;
using Properties;
+ using Main = Handbrake.Functions.Main;
+
/// <summary>
/// The Main Window
/// </summary>
|