summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-03-03 19:59:35 +0000
committersr55 <[email protected]>2015-03-03 19:59:35 +0000
commite008f370034803a0ca3d1389d919f2a145c0d605 (patch)
tree3569a3da1e712d096550576da4b60cd74a9a52ba /win
parentbb8c2ed96d9054391dea5908047b76f40bde0648 (diff)
WinGui: Remove the EncodeServiceWrapper
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6963 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj1
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs266
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs3
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs3
4 files changed, 4 insertions, 269 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 166d6782a..2e3aaf53e 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -209,7 +209,6 @@
<Compile Include="Helpers\PictureSize.cs" />
<Compile Include="Model\OptionsTab.cs" />
<Compile Include="Model\SelectionTitle.cs" />
- <Compile Include="Services\EncodeServiceWrapper.cs" />
<Compile Include="Model\ShellWindow.cs" />
<Compile Include="Model\SourceMenuItem.cs" />
<Compile Include="Model\UpdateCheckInformation.cs" />
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
deleted file mode 100644
index 867f523c8..000000000
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ /dev/null
@@ -1,266 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="EncodeServiceWrapper.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>
-// We have multiple implementations of IEncode. This is a wrapper class for the GUI so that the
-// implementation used is controllable via user settings.
-// Over time, this class will go away when the LibHB and process isolation code matures.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Services
-{
- using System;
-
- using HandBrake.ApplicationServices.Exceptions;
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Services.Encode;
- using HandBrake.ApplicationServices.Services.Encode.EventArgs;
- using HandBrake.ApplicationServices.Services.Encode.Interfaces;
-
- /// <summary>
- /// We have multiple implementations of Iencode. This is a wrapper class for the GUI so that the
- /// implementation used is controllable via user settings.
- /// Over time, this class will go away when the LibHB and process isolation code matures.
- /// </summary>
- public class EncodeServiceWrapper : IEncode
- {
- #region Constants and Fields
-
- /// <summary>
- /// The encode service.
- /// </summary>
- private readonly IEncode encodeService;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="EncodeServiceWrapper"/> class.
- /// </summary>
- public EncodeServiceWrapper()
- {
- try
- {
- this.encodeService = new LibEncode();
- }
- catch (Exception exc)
- {
- // Try to recover from errors.
- throw new GeneralApplicationException(
- "Unable to initialise LibHB or Background worker service",
- "HandBrake will not be able to operate correctly.",
- exc);
- }
-
- this.encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
- this.encodeService.EncodeStarted += this.EncodeServiceEncodeStarted;
- this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
- }
-
- #endregion
-
- #region Events
-
- /// <summary>
- /// The encode completed.
- /// </summary>
- public event EncodeCompletedStatus EncodeCompleted;
-
- /// <summary>
- /// The encode started.
- /// </summary>
- public event EventHandler EncodeStarted;
-
- /// <summary>
- /// The encode status changed.
- /// </summary>
- public event EncodeProgessStatus EncodeStatusChanged;
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets ActivityLog.
- /// </summary>
- public string ActivityLog
- {
- get
- {
- return this.encodeService.ActivityLog;
- }
- }
-
- /// <summary>
- /// Gets the log index.
- /// </summary>
- public int LogIndex
- {
- get
- {
- return this.encodeService.LogIndex;
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether can pause.
- /// </summary>
- public bool CanPause
- {
- get
- {
- return this.encodeService.CanPause;
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether is pasued.
- /// </summary>
- public bool IsPasued
- {
- get
- {
- return this.encodeService.IsPasued;
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether IsEncoding.
- /// </summary>
- public bool IsEncoding
- {
- get
- {
- return this.encodeService.IsEncoding;
- }
- }
-
- #endregion
-
- #region Implemented Interfaces
-
- #region IEncode
-
- /// <summary>
- /// Copy the log file to the desired destinations
- /// </summary>
- /// <param name="destination">
- /// The destination.
- /// </param>
- /// <param name="configuration">
- /// The configuration.
- /// </param>
- public void ProcessLogs(string destination, HBConfiguration configuration)
- {
- this.encodeService.ProcessLogs(destination, configuration);
- }
-
- /// <summary>
- /// Shutdown the service.
- /// </summary>
- public void Shutdown()
- {
- this.encodeService.Stop();
- this.encodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
- this.encodeService.EncodeStarted -= this.EncodeServiceEncodeStarted;
- this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;
- }
-
- /// <summary>
- /// Start with a LibHb EncodeJob Object
- /// </summary>
- /// <param name="job">
- /// The job.
- /// </param>
- public void Start(QueueTask job)
- {
- this.encodeService.Start(job);
- }
-
- /// <summary>
- /// The pause.
- /// </summary>
- public void Pause()
- {
- this.encodeService.Pause();
- }
-
- /// <summary>
- /// The resume.
- /// </summary>
- public void Resume()
- {
- this.encodeService.Resume();
- }
-
- /// <summary>
- /// Kill the CLI process
- /// </summary>
- public void Stop()
- {
- this.encodeService.Stop();
- }
-
- #endregion
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// The encode service_ encode completed.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The EncodeCompletedEventArgs.
- /// </param>
- private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
- {
- if (EncodeCompleted != null)
- {
- this.EncodeCompleted(sender, e);
- }
- }
-
- /// <summary>
- /// The encode service_ encode started.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The EventArgs
- /// </param>
- private void EncodeServiceEncodeStarted(object sender, EventArgs e)
- {
- if (EncodeStarted != null)
- {
- this.EncodeStarted(sender, e);
- }
- }
-
- /// <summary>
- /// The encode service_ encode status changed.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The EncodeProgressEventArgs.
- /// </param>
- private void EncodeServiceEncodeStatusChanged(object sender, EncodeProgressEventArgs e)
- {
- if (EncodeStatusChanged != null)
- {
- this.EncodeStatusChanged(sender, e);
- }
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index 617413bc8..406bbdbe7 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -21,6 +21,7 @@ namespace HandBrakeWPF.Startup
using Castle.Windsor;
using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Encode;
using HandBrake.ApplicationServices.Services.Encode.Interfaces;
using HandBrake.ApplicationServices.Services.Scan;
using HandBrake.ApplicationServices.Services.Scan.Interfaces;
@@ -62,7 +63,7 @@ namespace HandBrakeWPF.Startup
// Services
this.windsorContainer.Register(Component.For<IUpdateService>().ImplementedBy<UpdateService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IScan>().ImplementedBy<LibScan>().LifeStyle.Is(LifestyleType.Singleton));
- this.windsorContainer.Register(Component.For<IEncode>().ImplementedBy<EncodeServiceWrapper>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IEncode>().ImplementedBy<LibEncode>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<INotificationService>().ImplementedBy<NotificationService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IPrePostActionService>().ImplementedBy<PrePostActionService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IUserSettingService>().ImplementedBy<UserSettingService>());
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
index 012a4c15b..3a3b4e6eb 100644
--- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
@@ -27,6 +27,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Services.Scan.Interfaces;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Services.Encode;
using HandBrakeWPF.Factories;
using HandBrakeWPF.Properties;
@@ -133,7 +134,7 @@ namespace HandBrakeWPF.ViewModels
// Live Preview
this.userSettingService = userSettingService;
- this.encodeService = new EncodeServiceWrapper(); // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point
+ this.encodeService = new LibEncode(); // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point
this.Title = "Preview";
this.Percentage = "0.00%";