diff options
20 files changed, 62 insertions, 484 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 7b0c96fd8..bb00bc266 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -88,10 +88,7 @@ </ItemGroup>
<ItemGroup>
<Compile Include="Converters\EnumToDescConverter.cs" />
- <Compile Include="EventArgs\QueueCompletedEventArgs.cs" />
- <Compile Include="EventArgs\SettingChangedEventArgs.cs" />
<Compile Include="Exceptions\GeneralApplicationException.cs" />
- <Compile Include="EventArgs\QueueProgressEventArgs.cs" />
<Compile Include="Interop\Attributes\ShortName.cs" />
<Compile Include="Interop\EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="Interop\EventArgs\EncodeProgressEventArgs.cs" />
@@ -216,10 +213,8 @@ <Compile Include="Services\Encode\Model\Models\Video\VideoProfile.cs" />
<Compile Include="Services\Encode\Model\Models\Video\VideoTune.cs" />
<Compile Include="Services\Interfaces\IHbServiceCallback.cs" />
- <Compile Include="Services\Interfaces\IServerService.cs" />
<Compile Include="Services\Scan\EventArgs\ScanCompletedEventArgs.cs" />
<Compile Include="Services\Scan\EventArgs\ScanProgressEventArgs.cs" />
- <Compile Include="Services\ServerService.cs" />
<Compile Include="Utilities\Converters.cs" />
<Compile Include="Utilities\EnumHelper.cs" />
<Compile Include="Utilities\InteropModelCreator.cs" />
@@ -249,14 +244,11 @@ <DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
- <Compile Include="ServicesWindsorInstaller.cs" />
<Compile Include="Services\Encode\EncodeBase.cs" />
<Compile Include="Services\Encode\Interfaces\IEncode.cs" />
- <Compile Include="Services\Interfaces\IQueueProcessor.cs" />
<Compile Include="Services\Scan\Interfaces\IScan.cs" />
<Compile Include="Services\Encode\LibEncode.cs" />
<Compile Include="Services\Scan\LibScan.cs" />
- <Compile Include="Services\QueueProcessor.cs" />
<Compile Include="Utilities\CharCodesUtilities.cs" />
<Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\LanguageUtilities.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs deleted file mode 100644 index 367555418..000000000 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs +++ /dev/null @@ -1,96 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IServerService.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>
-// Defines the IServerService type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Services.Interfaces
-{
- using System.Runtime.Serialization;
- using System.ServiceModel;
-
- using HandBrake.ApplicationServices.Model;
-
- /// <summary>
- /// The HandBrakeService interface.
- /// </summary>
- [ServiceContract(CallbackContract = typeof(IHbServiceCallback), SessionMode = SessionMode.Required)]
- public interface IServerService
- {
- /// <summary>
- /// Gets the activity log.
- /// </summary>
- [DataMember]
- string EncodeActivityLog { get; }
-
- /// <summary>
- /// Gets a value indicating whether is encoding.
- /// </summary>
- bool IsEncoding
- {
- [OperationContract]
- get;
- }
-
- /// <summary>
- /// Start the WCF Service
- /// </summary>
- /// <param name="port">
- /// The port.
- /// </param>
- void Start(string port);
-
- /// <summary>
- /// Stop the WCF Service
- /// </summary>
- void Stop();
-
- /// <summary>
- /// Start and Encode
- /// </summary>
- /// <param name="job">
- /// The job.
- /// </param>
- [OperationContract]
- void StartEncode(QueueTask job);
-
- /// <summary>
- /// The process encode logs.
- /// </summary>
- /// <param name="destination">
- /// The destination.
- /// </param>
- /// <param name="configuration">
- /// The configuration.
- /// </param>
- [OperationContract]
- void ProcessEncodeLogs(string destination, HBConfiguration configuration);
-
- /// <summary>
- /// Stop and Encode
- /// </summary>
- [OperationContract]
- void StopEncode();
-
- /// <summary>
- /// Subscribe for callbacks from the called functions
- /// </summary>
- /// <returns>
- /// The System.Boolean.
- /// </returns>
- [OperationContract]
- bool Subscribe();
-
- /// <summary>
- /// Unsubscribe from callbacks.
- /// </summary>
- /// <returns>
- /// The System.Boolean.
- /// </returns>
- [OperationContract]
- bool Unsubscribe();
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs deleted file mode 100644 index d0f1b6a99..000000000 --- a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs +++ /dev/null @@ -1,296 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="ServerService.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>
-// HandBrake WCF Service
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Services
-{
- using System;
- using System.Collections.Generic;
- using System.ServiceModel;
- using System.Threading;
-
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Services.Encode;
- using HandBrake.ApplicationServices.Services.Encode.EventArgs;
- using HandBrake.ApplicationServices.Services.Encode.Interfaces;
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- /// <summary>
- /// HandBrake WCF Service
- /// </summary>
- [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode.Single)]
- public class ServerService : IServerService
- {
- #region Constants and Fields
-
- /// <summary>
- /// List of connected Clients. For now, this should only be one.
- /// </summary>
- private static readonly List<IHbServiceCallback> Subscribers = new List<IHbServiceCallback>();
-
- /// <summary>
- /// The encode service.
- /// </summary>
- private static IEncode encodeService;
-
- /// <summary>
- /// The host.
- /// </summary>
- private static ServiceHost host;
-
- /// <summary>
- /// The shutdown flag.
- /// </summary>
- private static ManualResetEvent shutdownFlag;
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets the activity log.
- /// </summary>
- public string EncodeActivityLog { get; private set; }
-
- /// <summary>
- /// Gets a value indicating whether is encoding.
- /// </summary>
- public bool IsEncoding { get; private set; }
-
- /// <summary>
- /// Gets the activity log.
- /// </summary>
- public string ScanActivityLog { get; private set; }
-
- #endregion
-
- #region Implemented Interfaces
-
- #region IServerService
-
- /// <summary>
- /// The process encode logs.
- /// </summary>
- /// <param name="destination">
- /// The destination.
- /// </param>
- /// <param name="configuration">
- /// The configuration.
- /// </param>
- public void ProcessEncodeLogs(string destination, HBConfiguration configuration)
- {
- encodeService.ProcessLogs(destination, configuration);
- }
-
- /// <summary>
- /// Start the service
- /// </summary>
- /// <param name="port">
- /// The port.
- /// </param>
- public void Start(string port)
- {
- using (host = new ServiceHost(typeof(ServerService), new Uri(string.Format("net.tcp://127.0.0.1:{0}", port))))
- {
- // Setup a listener
- host.AddServiceEndpoint(typeof(IServerService), new NetTcpBinding(), "IHbService");
- host.Open();
- Console.WriteLine("::: HandBrake Isolation Server - Debug Console:::");
- Console.WriteLine("Service Started. Waiting for Clients...");
-
- // Setup the services we are going to use.
- encodeService = new LibEncode();
- shutdownFlag = new ManualResetEvent(false);
- shutdownFlag.WaitOne();
- }
- }
-
- /// <summary>
- /// Start and Encode
- /// </summary>
- /// <param name="job">
- /// The job.
- /// </param>
- public void StartEncode(QueueTask job)
- {
- Console.WriteLine("Starting Source Encode for: " + job.Task.Source);
- encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
- encodeService.EncodeStarted += this.encodeService_EncodeStarted;
- encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;
- encodeService.Start(job);
- }
-
- /// <summary>
- /// Stop this service
- /// </summary>
- public void Stop()
- {
- if (host != null)
- {
- host.BeginClose(null, null);
- // host.Abort();
- shutdownFlag.Set();
- }
- }
-
- /// <summary>
- /// Stop and Encode
- /// </summary>
- public void StopEncode()
- {
- encodeService.Stop();
- }
-
- /// <summary>
- /// The subscribe.
- /// </summary>
- /// <returns>
- /// The System.Boolean.
- /// </returns>
- public bool Subscribe()
- {
- try
- {
- // Get the hashCode of the connecting app and store it as a connection
- var callback = OperationContext.Current.GetCallbackChannel<IHbServiceCallback>();
- if (!Subscribers.Contains(callback))
- {
- Console.WriteLine("Client Connected");
- Subscribers.Add(callback);
- }
- return true;
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- return false;
- }
- }
-
- /// <summary>
- /// The unsubscribe.
- /// </summary>
- /// <returns>
- /// The System.Boolean.
- /// </returns>
- public bool Unsubscribe()
- {
- try
- {
- var callback = OperationContext.Current.GetCallbackChannel<IHbServiceCallback>();
- if (Subscribers.Contains(callback))
- {
- Subscribers.Remove(callback);
- if (Subscribers.Count == 0)
- {
- Console.WriteLine("Client Disconnected, Shutting down...");
-
- // Shutdown the service. We no longer have any clients to serve.
- // It is the responsibility of the UI to maintain a subscription while this service is in use.
- this.Stop();
- }
- }
- return true;
- }
- catch
- {
- return false;
- }
- }
-
- #endregion
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// The encode service_ encode completed.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
- {
- encodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
- encodeService.EncodeStarted -= this.encodeService_EncodeStarted;
- encodeService.EncodeStatusChanged -= this.encodeService_EncodeStatusChanged;
-
- Subscribers.ForEach(
- delegate(IHbServiceCallback callback)
- {
- if (((ICommunicationObject)callback).State == CommunicationState.Opened)
- {
- Console.WriteLine("Encode Completed Callback");
- callback.EncodeCompletedCallback(e);
- }
- else
- {
- Subscribers.Remove(callback);
- }
- });
- }
-
- /// <summary>
- /// The encode service_ encode started.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void encodeService_EncodeStarted(object sender, EventArgs e)
- {
- Subscribers.ForEach(
- delegate(IHbServiceCallback callback)
- {
- if (((ICommunicationObject)callback).State == CommunicationState.Opened)
- {
- Console.WriteLine("Encode Started Callback");
- callback.EncodeStartedCallback();
- }
- else
- {
- Subscribers.Remove(callback);
- }
- });
- }
-
- /// <summary>
- /// The encode service_ encode status changed.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void encodeService_EncodeStatusChanged(object sender, EncodeProgressEventArgs e)
- {
- Subscribers.ForEach(
- delegate(IHbServiceCallback callback)
- {
- if (((ICommunicationObject)callback).State == CommunicationState.Opened)
- {
- Console.WriteLine("Encode Status Callback");
- callback.EncodeProgressCallback(e);
- }
- else
- {
- Subscribers.Remove(callback);
- }
- });
- }
-
- #endregion
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/ServicesWindsorInstaller.cs b/win/CS/HandBrake.ApplicationServices/ServicesWindsorInstaller.cs deleted file mode 100644 index 72b32ef7f..000000000 --- a/win/CS/HandBrake.ApplicationServices/ServicesWindsorInstaller.cs +++ /dev/null @@ -1,37 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="ServicesWindsorInstaller.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 Windsor Installer Interface Implementation
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices
-{
- using Castle.MicroKernel.Registration;
- using Castle.MicroKernel.SubSystems.Configuration;
- using Castle.Windsor;
-
- using HandBrake.ApplicationServices.Services;
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- /// <summary>
- /// An Implimentation of IWindsorInstaller for this library.
- /// </summary>
- public class ServicesWindsorInstaller : IWindsorInstaller
- {
- #region Implementation of IWindsorInstaller
-
- /// <summary>
- /// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
- /// </summary>
- /// <param name="container">The container.</param><param name="store">The configuration store.</param>
- public void Install(IWindsorContainer container, IConfigurationStore store)
- {
- container.Register(Component.For<IQueueProcessor>().ImplementedBy<QueueProcessor>());
- }
-
- #endregion
- }
-}
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/QueueCompletedEventArgs.cs b/win/CS/HandBrakeWPF/EventArgs/QueueCompletedEventArgs.cs index a98e784c3..e7e1fc813 100644 --- a/win/CS/HandBrake.ApplicationServices/EventArgs/QueueCompletedEventArgs.cs +++ b/win/CS/HandBrakeWPF/EventArgs/QueueCompletedEventArgs.cs @@ -7,7 +7,7 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.ApplicationServices.EventArgs
+namespace HandBrakeWPF.EventArgs
{
using System;
using System.Runtime.Serialization;
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/QueueProgressEventArgs.cs b/win/CS/HandBrakeWPF/EventArgs/QueueProgressEventArgs.cs index 016b853fa..3fa93fe7e 100644 --- a/win/CS/HandBrake.ApplicationServices/EventArgs/QueueProgressEventArgs.cs +++ b/win/CS/HandBrakeWPF/EventArgs/QueueProgressEventArgs.cs @@ -7,7 +7,7 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.ApplicationServices.EventArgs
+namespace HandBrakeWPF.EventArgs
{
using System;
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/SettingChangedEventArgs.cs b/win/CS/HandBrakeWPF/EventArgs/SettingChangedEventArgs.cs index 2687508b2..edd27b11c 100644 --- a/win/CS/HandBrake.ApplicationServices/EventArgs/SettingChangedEventArgs.cs +++ b/win/CS/HandBrakeWPF/EventArgs/SettingChangedEventArgs.cs @@ -7,7 +7,7 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.ApplicationServices.EventArgs
+namespace HandBrakeWPF.EventArgs
{
/// <summary>
/// The setting changed event args.
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index a5bde0f97..e44fd25d7 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -140,12 +140,16 @@ <Compile Include="Converters\Subtitles\SubtitleBehaviourConverter.cs" />
<Compile Include="Converters\Video\VideoOptionsTooltipConverter.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
+ <Compile Include="EventArgs\QueueCompletedEventArgs.cs" />
+ <Compile Include="EventArgs\QueueProgressEventArgs.cs" />
+ <Compile Include="EventArgs\SettingChangedEventArgs.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Model\Audio\AudioBehaviourModes.cs" />
<Compile Include="Model\Audio\AudioBehaviours.cs" />
<Compile Include="Model\Picture\PresetPictureSettingsMode.cs" />
<Compile Include="Model\Subtitles\SubtitleBehaviourModes.cs" />
<Compile Include="Model\Subtitles\SubtitleBehaviours.cs" />
+ <Compile Include="Services\Interfaces\IQueueProcessor.cs" />
<Compile Include="Services\Presets\Factories\PlistPresetFactory.cs" />
<Compile Include="Helpers\FileHelper.cs" />
<Compile Include="Services\Presets\Model\Preset.cs" />
@@ -155,6 +159,7 @@ <Compile Include="Services\Interfaces\IUserSettingService.cs" />
<Compile Include="Services\Presets\Model\PresetContainer.cs" />
<Compile Include="Services\Presets\PresetService.cs" />
+ <Compile Include="Services\QueueProcessor.cs" />
<Compile Include="Services\UserSettingService.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
<Compile Include="Utilities\DelayedActionProcessor.cs" />
diff --git a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs index 53ab407e2..ceb8943b8 100644 --- a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs @@ -24,6 +24,8 @@ namespace HandBrakeWPF.Helpers using HandBrakeWPF.Services.Interfaces;
+ using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+
/// <summary>
/// Queue Recovery Helper
/// </summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IQueueProcessor.cs index 4e5b51d93..b04c825d9 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs +++ b/win/CS/HandBrakeWPF/Services/Interfaces/IQueueProcessor.cs @@ -7,7 +7,7 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.ApplicationServices.Services.Interfaces
+namespace HandBrakeWPF.Services.Interfaces
{
using System;
using System.ComponentModel;
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs index d2f433bc1..c8b34b7cd 100644 --- a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs @@ -9,7 +9,7 @@ namespace HandBrakeWPF.Services.Interfaces
{
- using HandBrake.ApplicationServices.EventArgs;
+ using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs;
/// <summary>
/// The setting event handler.
diff --git a/win/CS/HandBrakeWPF/Services/NotificationService.cs b/win/CS/HandBrakeWPF/Services/NotificationService.cs index 1a647a970..0f387fec3 100644 --- a/win/CS/HandBrakeWPF/Services/NotificationService.cs +++ b/win/CS/HandBrakeWPF/Services/NotificationService.cs @@ -15,6 +15,8 @@ namespace HandBrakeWPF.Services using HandBrakeWPF.Services.Interfaces;
+ using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+
/// <summary>
/// The Notification Service (Growl Connector)
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs index c57935239..b8501b999 100644 --- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs +++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs @@ -9,21 +9,19 @@ namespace HandBrakeWPF.Services
{
+ using System;
using System.Diagnostics;
using System.Windows.Forms;
using Caliburn.Micro;
- using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Services.Encode.EventArgs;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
+ using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
- using Application = System.Windows.Application;
-
/// <summary>
/// The when done service.
/// </summary>
@@ -76,7 +74,7 @@ namespace HandBrakeWPF.Services /// <param name="e">
/// The e.
/// </param>
- private void EncodeService_EncodeStarted(object sender, System.EventArgs e)
+ private void EncodeService_EncodeStarted(object sender, EventArgs e)
{
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
{
@@ -134,7 +132,7 @@ namespace HandBrakeWPF.Services // Give the user the ability to cancel the shutdown. Default 60 second timer.
ICountdownAlertViewModel titleSpecificView = IoC.Get<ICountdownAlertViewModel>();
- Caliburn.Micro.Execute.OnUIThread(
+ Execute.OnUIThread(
() =>
{
titleSpecificView.SetAction(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction));
@@ -153,16 +151,16 @@ namespace HandBrakeWPF.Services Win32.ExitWindowsEx(0, 0);
break;
case "Suspend":
- System.Windows.Forms.Application.SetSuspendState(PowerState.Suspend, true, true);
+ Application.SetSuspendState(PowerState.Suspend, true, true);
break;
case "Hibernate":
- System.Windows.Forms.Application.SetSuspendState(PowerState.Hibernate, true, true);
+ Application.SetSuspendState(PowerState.Hibernate, true, true);
break;
case "Lock System":
Win32.LockWorkStation();
break;
case "Quit HandBrake":
- Execute.OnUIThread(() => Application.Current.Shutdown());
+ Execute.OnUIThread(() => System.Windows.Application.Current.Shutdown());
break;
}
}
@@ -180,8 +178,8 @@ namespace HandBrakeWPF.Services !string.IsNullOrEmpty(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo)))
{
string args = string.Format(
- "{0} \"{1}\"",
- this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs),
+ "{0} \"{1}\"",
+ this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs),
file);
var vlc =
new ProcessStartInfo(
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/QueueProcessor.cs index ba6a3a92e..414113d2f 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/CS/HandBrakeWPF/Services/QueueProcessor.cs @@ -7,7 +7,7 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.ApplicationServices.Services
+namespace HandBrakeWPF.Services
{
using System;
using System.Collections.Generic;
@@ -18,14 +18,16 @@ namespace HandBrake.ApplicationServices.Services using Caliburn.Micro;
- using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.EventArgs;
using HandBrake.ApplicationServices.Services.Encode.Interfaces;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
+ using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+ using QueueCompletedEventArgs = HandBrakeWPF.EventArgs.QueueCompletedEventArgs;
+ using QueueProgressEventArgs = HandBrakeWPF.EventArgs.QueueProgressEventArgs;
+
/// <summary>
/// The HandBrake Queue
/// </summary>
@@ -444,7 +446,7 @@ namespace HandBrake.ApplicationServices.Services throw new Exception("Already Processing the Queue");
}
- clearCompleted = isClearCompleted;
+ this.clearCompleted = isClearCompleted;
this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
this.EncodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
@@ -480,7 +482,7 @@ namespace HandBrake.ApplicationServices.Services this.LastProcessedJob.Status = QueueItemStatus.Completed;
// Clear the completed item of the queue if the setting is set.
- if (clearCompleted)
+ if (this.clearCompleted)
{
this.ClearCompleted();
}
diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs index 6b7d87f1b..6c5c6629b 100644 --- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs @@ -16,11 +16,12 @@ namespace HandBrakeWPF.Services using System.Reflection;
using System.Xml.Serialization;
- using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Exceptions;
using HandBrakeWPF.Services.Interfaces;
+ using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs;
+
/// <summary>
/// The User Setting Serivce
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index c8b327cd3..617413bc8 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -56,8 +56,8 @@ namespace HandBrakeWPF.Startup this.windsorContainer.Register(Component.For<IEventAggregator>().ImplementedBy<EventAggregator>());
// Initialise the ApplicationServices IWindsorInstaller
- this.windsorContainer.Register(Component.For<IWindsorInstaller>().ImplementedBy<ServicesWindsorInstaller>());
- this.windsorContainer.Install(windsorContainer.ResolveAll<IWindsorInstaller>());
+ // this.windsorContainer.Register(Component.For<IWindsorInstaller>().ImplementedBy<ServicesWindsorInstaller>());
+ // this.windsorContainer.Install(windsorContainer.ResolveAll<IWindsorInstaller>());
// Services
this.windsorContainer.Register(Component.For<IUpdateService>().ImplementedBy<UpdateService>().LifeStyle.Is(LifestyleType.Singleton));
@@ -67,6 +67,7 @@ namespace HandBrakeWPF.Startup this.windsorContainer.Register(Component.For<IPrePostActionService>().ImplementedBy<PrePostActionService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IUserSettingService>().ImplementedBy<UserSettingService>());
this.windsorContainer.Register(Component.For<IPresetService>().ImplementedBy<PresetService>());
+ this.windsorContainer.Register(Component.For<IQueueProcessor>().ImplementedBy<QueueProcessor>());
// Commands
this.windsorContainer.Register(Component.For<IAdvancedEncoderOptionsCommand>().ImplementedBy<AdvancedEncoderOptionsCommand>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index f204b084d..08662882c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -34,6 +34,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Interop;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Factories;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
@@ -52,6 +53,8 @@ namespace HandBrakeWPF.ViewModels using Ookii.Dialogs.Wpf;
+ using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+
/// <summary>
/// HandBrakes Main Window
/// </summary>
@@ -2104,7 +2107,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="e">
/// The e.
/// </param>
- void QueueProcessorJobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)
+ void QueueProcessorJobProcessingStarted(object sender, QueueProgressEventArgs e)
{
Execute.OnUIThread(
() =>
@@ -2194,7 +2197,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="e">
/// The e.
/// </param>
- private void UserSettingServiceSettingChanged(object sender, HandBrake.ApplicationServices.EventArgs.SettingChangedEventArgs e)
+ private void UserSettingServiceSettingChanged(object sender, SettingChangedEventArgs e)
{
if (e.Key == UserSettingConstants.ShowAdvancedTab)
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 7f5ba9b00..7191ad9b5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -15,12 +15,11 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
- using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.EventArgs;
using HandBrake.ApplicationServices.Services.Encode.Model;
- using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -245,7 +244,7 @@ namespace HandBrakeWPF.ViewModels this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
this.IsEncoding = false;
- MessageBox.Show("The Queue has been paused. The currently running job will run to completion and no further jobs will start.", "Queue",
+ MessageBox.Show("The Queue has been paused. The currently running job will run to completion and no further jobs will start.", "Queue",
MessageBoxButton.OK, MessageBoxImage.Information);
}
@@ -261,9 +260,9 @@ namespace HandBrakeWPF.ViewModels {
MessageBoxResult result =
this.errorService.ShowMessageBox(
- "This encode is currently in progress. If you delete it, the encode will be stopped. Are you sure you wish to proceed?",
- Resources.Warning,
- MessageBoxButton.YesNo,
+ "This encode is currently in progress. If you delete it, the encode will be stopped. Are you sure you wish to proceed?",
+ Resources.Warning,
+ MessageBoxButton.YesNo,
MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
@@ -317,9 +316,9 @@ namespace HandBrakeWPF.ViewModels {
SaveFileDialog dialog = new SaveFileDialog
{
- Filter = "HandBrake Queue Files (*.hbq)|*.hbq",
- OverwritePrompt = true,
- DefaultExt = ".hbq",
+ Filter = "HandBrake Queue Files (*.hbq)|*.hbq",
+ OverwritePrompt = true,
+ DefaultExt = ".hbq",
AddExtension = true
};
if (dialog.ShowDialog() == true)
@@ -349,9 +348,9 @@ namespace HandBrakeWPF.ViewModels public void EditJob(QueueTask task)
{
MessageBoxResult result = this.errorService.ShowMessageBox(
- "Are you sure you wish to edit this job? It will be removed from the queue and sent to the main window.",
- "Modify Job?",
- MessageBoxButton.YesNo,
+ "Are you sure you wish to edit this job? It will be removed from the queue and sent to the main window.",
+ "Modify Job?",
+ MessageBoxButton.YesNo,
MessageBoxImage.Question);
if (result != MessageBoxResult.Yes)
@@ -420,17 +419,17 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void EncodeService_EncodeStatusChanged(object sender, EncodeProgressEventArgs e)
{
- Caliburn.Micro.Execute.OnUIThread(() =>
+ Execute.OnUIThread(() =>
{
this.JobStatus =
string.Format(
- "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
- e.Task,
- e.TaskCount,
- e.PercentComplete,
- e.CurrentFrameRate,
- e.AverageFrameRate,
- e.EstimatedTimeLeft,
+ "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
+ e.Task,
+ e.TaskCount,
+ e.PercentComplete,
+ e.CurrentFrameRate,
+ e.AverageFrameRate,
+ e.EstimatedTimeLeft,
e.ElapsedTime);
});
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index e297db422..6d4fcc84a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -20,6 +20,8 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
+ using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+
/// <summary>
/// The Shell View Model
/// </summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index a975a8bcd..5f1193cc7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -17,7 +17,6 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
- using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
@@ -33,6 +32,7 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.ViewModels.Interfaces;
using Clipboard = System.Windows.Clipboard;
+ using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs;
/// <summary>
/// The Video View Model
|