summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/Controls/SplitButton/SplitMenuButton.cs8
-rw-r--r--win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs2
-rw-r--r--win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs2
-rw-r--r--win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs3
-rw-r--r--win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs4
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs46
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs18
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoLevel.cs28
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoPreset.cs28
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoProfile.cs28
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoTune.cs56
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs28
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs10
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/PresetService.cs6
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs28
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs50
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/LibScan.cs25
-rw-r--r--win/CS/HandBrakeWPF/Services/UserSettingService.cs2
-rw-r--r--win/CS/HandBrakeWPF/Utilities/Execute.cs42
-rw-r--r--win/CS/HandBrakeWPF/Utilities/PropertyChangedBase.cs26
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs36
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs30
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs54
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs20
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml.cs57
26 files changed, 324 insertions, 325 deletions
diff --git a/win/CS/HandBrakeWPF/Controls/SplitButton/SplitMenuButton.cs b/win/CS/HandBrakeWPF/Controls/SplitButton/SplitMenuButton.cs
index adf17eb46..fb05bc967 100644
--- a/win/CS/HandBrakeWPF/Controls/SplitButton/SplitMenuButton.cs
+++ b/win/CS/HandBrakeWPF/Controls/SplitButton/SplitMenuButton.cs
@@ -36,7 +36,7 @@ namespace HandBrakeWPF.Controls.SplitButton
/// <summary>
/// The is mouse over split element.
/// </summary>
- private bool IsMouseOverSplitElement;
+ private bool isMouseOverSplitElement;
/// <summary>
/// The context menu.
@@ -156,7 +156,7 @@ namespace HandBrakeWPF.Controls.SplitButton
/// </summary>
protected override void OnClick()
{
- if (this.IsMouseOverSplitElement)
+ if (this.isMouseOverSplitElement)
{
this.OpenButtonMenu();
}
@@ -259,7 +259,7 @@ namespace HandBrakeWPF.Controls.SplitButton
/// </param>
private void SplitElement_MouseEnter(object sender, MouseEventArgs e)
{
- this.IsMouseOverSplitElement = true;
+ this.isMouseOverSplitElement = true;
}
/// <summary>
@@ -273,7 +273,7 @@ namespace HandBrakeWPF.Controls.SplitButton
/// </param>
private void SplitElement_MouseLeave(object sender, MouseEventArgs e)
{
- this.IsMouseOverSplitElement = false;
+ this.isMouseOverSplitElement = false;
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs b/win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs
index 7989d6b06..4fa4b209c 100644
--- a/win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs
@@ -9,10 +9,10 @@
namespace HandBrakeWPF.Converters
{
+ using System;
using System.Globalization;
using System.IO;
using System.Windows.Data;
- using System;
/// <summary>
/// Converts a Full Path to Filename only.
diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs
index 54897e19c..c7837efd4 100644
--- a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs
@@ -19,7 +19,7 @@ namespace HandBrakeWPF.Converters.Options
/// <summary>
/// The Options Tab Converter. Controls which tab is dispalyed.
/// </summary>
- class OptionsTabConverter : IValueConverter
+ public class OptionsTabConverter : IValueConverter
{
/// <summary>
/// Converts a value.
diff --git a/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs
index f882728e7..c5691b2c5 100644
--- a/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs
@@ -9,11 +9,10 @@
namespace HandBrakeWPF.Converters
{
+ using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
- using System;
-
using HandBrakeWPF.Services.Queue.Model;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs
index 01dd64667..83494ee36 100644
--- a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs
@@ -56,14 +56,14 @@ namespace HandBrakeWPF.Helpers
}
List<string> removeFiles = new List<string>();
- XmlSerializer Ser = new XmlSerializer(typeof(List<QueueTask>));
+ XmlSerializer ser = new XmlSerializer(typeof(List<QueueTask>));
foreach (FileInfo file in logFiles)
{
try
{
using (FileStream strm = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
{
- List<QueueTask> list = Ser.Deserialize(strm) as List<QueueTask>;
+ List<QueueTask> list = ser.Deserialize(strm) as List<QueueTask>;
if (list != null && list.Count == 0)
{
removeFiles.Add(file.FullName);
diff --git a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs
index 0e84c3650..8f7dee945 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs
@@ -170,53 +170,53 @@ namespace HandBrakeWPF.Services.Encode
}
/// <summary>
- /// The write file.
+ /// Verify the Encode Destination path exists and if not, create it.
/// </summary>
- /// <param name="content">
- /// The content.
- /// </param>
- /// <param name="fileName">
- /// The file name.
+ /// <param name="task">
+ /// The task.
/// </param>
- private void WriteFile(string content, string fileName)
+ /// <exception cref="Exception">
+ /// If the creation fails, an exception is thrown.
+ /// </exception>
+ protected void VerifyEncodeDestinationPath(EncodeTask task)
{
+ // Make sure the path exists, attempt to create it if it doesn't
try
{
- using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true })
+ string path = Directory.GetParent(task.Destination).ToString();
+ if (!Directory.Exists(path))
{
- fileWriter.Write(content);
+ Directory.CreateDirectory(path);
}
}
catch (Exception exc)
{
- Debug.WriteLine(exc);
+ throw new GeneralApplicationException(
+ "Unable to create directory for the encoded output.", "Please verify that you have a valid path.", exc);
}
}
/// <summary>
- /// Verify the Encode Destination path exists and if not, create it.
+ /// The write file.
/// </summary>
- /// <param name="task">
- /// The task.
+ /// <param name="content">
+ /// The content.
/// </param>
- /// <exception cref="Exception">
- /// If the creation fails, an exception is thrown.
- /// </exception>
- protected void VerifyEncodeDestinationPath(EncodeTask task)
+ /// <param name="fileName">
+ /// The file name.
+ /// </param>
+ private void WriteFile(string content, string fileName)
{
- // Make sure the path exists, attempt to create it if it doesn't
try
{
- string path = Directory.GetParent(task.Destination).ToString();
- if (!Directory.Exists(path))
+ using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true })
{
- Directory.CreateDirectory(path);
+ fileWriter.Write(content);
}
}
catch (Exception exc)
{
- throw new GeneralApplicationException(
- "Unable to create directory for the encoded output.", "Please verify that you have a valid path.", exc);
+ Debug.WriteLine(exc);
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
index d8f25373a..03763d448 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
@@ -152,6 +152,15 @@ namespace HandBrakeWPF.Services.Encode
#region HandBrakeInstance Event Handlers.
/// <summary>
+ /// Service Log Message.
+ /// </summary>
+ /// <param name="message">Log message content</param>
+ protected void ServiceLogMessage(string message)
+ {
+ this.log.LogMessage(string.Format("{0}# {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
+ }
+
+ /// <summary>
/// Encode Progress Event Handler
/// </summary>
/// <param name="sender">
@@ -200,15 +209,6 @@ namespace HandBrakeWPF.Services.Encode
? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination)
: new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination));
}
-
- /// <summary>
- /// Service Log Message.
- /// </summary>
- /// <param name="message">Log message content</param>
- protected void ServiceLogMessage(string message)
- {
- this.log.LogMessage(string.Format("{0}# {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
- }
#endregion
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoLevel.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoLevel.cs
index e7ca53e06..4cf6724a3 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoLevel.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoLevel.cs
@@ -67,20 +67,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
/// <summary>
/// The equals.
/// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoLevel other)
- {
- return string.Equals(this.ShortName, other.ShortName);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
/// <param name="obj">
/// The obj.
/// </param>
@@ -114,5 +100,19 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
{
return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoLevel other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoPreset.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoPreset.cs
index 8efdf5b58..887540c31 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoPreset.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoPreset.cs
@@ -67,20 +67,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
/// <summary>
/// The equals.
/// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoPreset other)
- {
- return string.Equals(this.ShortName, other.ShortName);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
/// <param name="obj">
/// The obj.
/// </param>
@@ -117,5 +103,19 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
{
return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoPreset other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoProfile.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoProfile.cs
index 80d3fe26d..4091e4cfb 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoProfile.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoProfile.cs
@@ -67,20 +67,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
/// <summary>
/// The equals.
/// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoProfile other)
- {
- return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
/// <param name="obj">
/// The obj.
/// </param>
@@ -117,5 +103,19 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
return ((this.DisplayName != null ? this.DisplayName.GetHashCode() : 0) * 397) ^ (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoProfile other)
+ {
+ return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoTune.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoTune.cs
index deba2a56f..d202cf51d 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoTune.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/Video/VideoTune.cs
@@ -72,34 +72,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
/// <summary>
/// The equals.
/// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(HandBrakeWPF.Services.Encode.Model.Models.Video.VideoProfile other)
- {
- return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoTune other)
- {
- return string.Equals(this.ShortName, other.ShortName);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
/// <param name="obj">
/// The obj.
/// </param>
@@ -133,5 +105,33 @@ namespace HandBrakeWPF.Services.Encode.Model.Models.Video
{
return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoTune other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoProfile other)
+ {
+ return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs
index 5f179f67e..8c0ff34c8 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs
@@ -188,20 +188,6 @@ namespace HandBrakeWPF.Services.Presets.Model
/// <summary>
/// The equals.
/// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(Preset other)
- {
- return string.Equals(this.Name, other.Name);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
/// <param name="obj">
/// The obj.
/// </param>
@@ -235,5 +221,19 @@ namespace HandBrakeWPF.Services.Presets.Model
{
return (this.Name != null ? this.Name.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(Preset other)
+ {
+ return string.Equals(this.Name, other.Name);
+ }
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs
index 95d2213fb..f70fd4680 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs
@@ -57,11 +57,6 @@ namespace HandBrakeWPF.Services.Presets.Model
}
}
- protected bool Equals(PresetDisplayCategory other)
- {
- return string.Equals(this.Category, other.Category);
- }
-
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
@@ -74,5 +69,10 @@ namespace HandBrakeWPF.Services.Presets.Model
{
return (this.Category != null ? this.Category.GetHashCode() : 0);
}
+
+ protected bool Equals(PresetDisplayCategory other)
+ {
+ return string.Equals(this.Category, other.Category);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
index a90bf1543..61e051fcd 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
@@ -816,8 +816,10 @@ namespace HandBrakeWPF.Services.Presets
// Orgamise the Presets list into Json Equivilent objects.
Dictionary<string, PresetCategory> presetCategories = new Dictionary<string, PresetCategory>();
- List<HBPreset> uncategorisedPresets = new List<HBPreset>();
- foreach (Preset item in this.flatPresetList.Values.OrderBy(o => o.IsBuildIn)) // Handle User Presets first.
+ List<HBPreset> uncategorisedPresets = new List<HBPreset>();
+
+ // Handle User Presets first.
+ foreach (Preset item in this.flatPresetList.Values.OrderBy(o => o.IsBuildIn))
{
if (string.IsNullOrEmpty(item.Category))
{
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs
index 572300dd6..ac1b28d94 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs
@@ -96,20 +96,6 @@ namespace HandBrakeWPF.Services.Queue.Model
/// <summary>
/// The equals.
/// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(QueueTask other)
- {
- return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status;
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
/// <param name="obj">
/// The obj.
/// </param>
@@ -152,5 +138,19 @@ namespace HandBrakeWPF.Services.Queue.Model
return hashCode;
}
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(QueueTask other)
+ {
+ return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status;
+ }
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs
index 02a378da7..f7e38d5e0 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs
@@ -520,6 +520,31 @@ namespace HandBrakeWPF.Services.Queue
#region Methods
/// <summary>
+ /// The on queue completed.
+ /// </summary>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ protected virtual void OnQueueCompleted(QueueCompletedEventArgs e)
+ {
+ QueueCompletedEventDelegate handler = this.QueueCompleted;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+
+ this.IsProcessing = false;
+ }
+
+ /// <summary>
+ /// The on low diskspace detected.
+ /// </summary>
+ protected virtual void OnLowDiskspaceDetected()
+ {
+ this.LowDiskspaceDetected?.Invoke(this, EventArgs.Empty);
+ }
+
+ /// <summary>
/// After an encode is complete, move onto the next job.
/// </summary>
/// <param name="sender">
@@ -611,31 +636,6 @@ namespace HandBrakeWPF.Services.Queue
handler(this, e);
}
}
-
- /// <summary>
- /// The on queue completed.
- /// </summary>
- /// <param name="e">
- /// The e.
- /// </param>
- protected virtual void OnQueueCompleted(QueueCompletedEventArgs e)
- {
- QueueCompletedEventDelegate handler = this.QueueCompleted;
- if (handler != null)
- {
- handler(this, e);
- }
-
- this.IsProcessing = false;
- }
-
- /// <summary>
- /// The on low diskspace detected.
- /// </summary>
- protected virtual void OnLowDiskspaceDetected()
- {
- this.LowDiskspaceDetected?.Invoke(this, EventArgs.Empty);
- }
/// <summary>
/// Run through all the jobs on the queue.
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
index ea81a9c03..7be5db8f0 100644
--- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
+++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
@@ -217,6 +217,17 @@ namespace HandBrakeWPF.Services.Scan
#region Private Methods
/// <summary>
+ /// The service log message.
+ /// </summary>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ protected void ServiceLogMessage(string message)
+ {
+ this.log.LogMessage(string.Format("{0} # {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
+ }
+
+ /// <summary>
/// Start a scan for a given source path and title
/// </summary>
/// <param name="sourcePath">
@@ -263,6 +274,7 @@ namespace HandBrakeWPF.Services.Scan
#endregion
#region HandBrakeInstance Event Handlers
+
/// <summary>
/// Scan Completed Event Handler
/// </summary>
@@ -347,7 +359,7 @@ namespace HandBrakeWPF.Services.Scan
/// <returns>
/// The convert titles.
/// </returns>
- internal static List<Title> ConvertTitles(JsonScanObject titles)
+ private static List<Title> ConvertTitles(JsonScanObject titles)
{
List<Title> titleList = new List<Title>();
foreach (SourceTitle title in titles.TitleList)
@@ -434,17 +446,6 @@ namespace HandBrakeWPF.Services.Scan
return titleList;
}
-
- /// <summary>
- /// The service log message.
- /// </summary>
- /// <param name="message">
- /// The message.
- /// </param>
- protected void ServiceLogMessage(string message)
- {
- this.log.LogMessage(string.Format("{0} # {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
- }
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
index acff3209a..6d8994ac5 100644
--- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs
+++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
@@ -37,7 +37,7 @@ namespace HandBrakeWPF.Services
/// <summary>
/// The XML Serializer
/// </summary>
- readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));
+ private readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));
/// <summary>
/// The User Settings
diff --git a/win/CS/HandBrakeWPF/Utilities/Execute.cs b/win/CS/HandBrakeWPF/Utilities/Execute.cs
index 34fdf3a44..0282744f3 100644
--- a/win/CS/HandBrakeWPF/Utilities/Execute.cs
+++ b/win/CS/HandBrakeWPF/Utilities/Execute.cs
@@ -73,18 +73,6 @@ namespace HandBrakeWPF.Utilities
}
/// <summary>
- /// The validate dispatcher.
- /// </summary>
- /// <exception cref="InvalidOperationException">
- /// Not initialized with dispatcher.
- /// </exception>
- private static void ValidateDispatcher()
- {
- if (Execute.dispatcher == null)
- throw new InvalidOperationException("Not initialized with dispatcher.");
- }
-
- /// <summary>
/// Executes the action on the UI thread asynchronously.
/// </summary>
/// <param name="action">The action to execute.</param>
@@ -124,6 +112,20 @@ namespace HandBrakeWPF.Utilities
}
/// <summary>
+ /// Executes the action on the UI thread.
+ /// </summary>
+ /// <param name="action">The action to execute.</param>
+ public static void OnUIThread(this System.Action action)
+ {
+ if (Execute.executor != null)
+ Execute.executor(action);
+ else if (Execute.CheckAccess())
+ action();
+ else
+ Execute.OnUIThreadAsync(action).Wait();
+ }
+
+ /// <summary>
/// The check access.
/// </summary>
/// <returns>
@@ -137,17 +139,15 @@ namespace HandBrakeWPF.Utilities
}
/// <summary>
- /// Executes the action on the UI thread.
+ /// The validate dispatcher.
/// </summary>
- /// <param name="action">The action to execute.</param>
- public static void OnUIThread(this System.Action action)
+ /// <exception cref="InvalidOperationException">
+ /// Not initialized with dispatcher.
+ /// </exception>
+ private static void ValidateDispatcher()
{
- if (Execute.executor != null)
- Execute.executor(action);
- else if (Execute.CheckAccess())
- action();
- else
- Execute.OnUIThreadAsync(action).Wait();
+ if (Execute.dispatcher == null)
+ throw new InvalidOperationException("Not initialized with dispatcher.");
}
}
}
diff --git a/win/CS/HandBrakeWPF/Utilities/PropertyChangedBase.cs b/win/CS/HandBrakeWPF/Utilities/PropertyChangedBase.cs
index ae3a401b2..08f206891 100644
--- a/win/CS/HandBrakeWPF/Utilities/PropertyChangedBase.cs
+++ b/win/CS/HandBrakeWPF/Utilities/PropertyChangedBase.cs
@@ -85,19 +85,6 @@ namespace HandBrakeWPF.Utilities
}
/// <summary>
- /// Raises the <see cref="E:PropertyChanged"/> event directly.
- /// </summary>
- /// <param name="e">The <see cref="T:System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected void OnPropertyChanged(PropertyChangedEventArgs e)
- {
- PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
- if (changedEventHandler == null)
- return;
- changedEventHandler((object)this, e);
- }
-
- /// <summary>
/// Called when the object is deserialized.
/// </summary>
/// <param name="c">The streaming context.</param>
@@ -117,5 +104,18 @@ namespace HandBrakeWPF.Utilities
{
return false;
}
+
+ /// <summary>
+ /// Raises the <see cref="E:PropertyChanged"/> event directly.
+ /// </summary>
+ /// <param name="e">The <see cref="T:System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void OnPropertyChanged(PropertyChangedEventArgs e)
+ {
+ PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
+ if (changedEventHandler == null)
+ return;
+ changedEventHandler((object)this, e);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index c90c9add3..ffea2554e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -305,6 +305,24 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.Task);
}
+ /// <summary>
+ /// Add all remaining for selected languages.
+ /// </summary>
+ public void AddAllRemainingForSelectedLanguages()
+ {
+ // Add them if they are not already added.
+ foreach (Audio sourceTrack in this.GetSelectedLanguagesTracks())
+ {
+ // Step 2: Check if the track list already contrains this track
+ bool found = this.Task.AudioTracks.Any(audioTrack => Equals(audioTrack.ScannedTrack, sourceTrack));
+ if (!found)
+ {
+ // If it doesn't, add it.
+ this.Add(sourceTrack, true);
+ }
+ }
+ }
+
#endregion
#region Methods
@@ -443,24 +461,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Add all remaining for selected languages.
- /// </summary>
- public void AddAllRemainingForSelectedLanguages()
- {
- // Add them if they are not already added.
- foreach (Audio sourceTrack in this.GetSelectedLanguagesTracks())
- {
- // Step 2: Check if the track list already contrains this track
- bool found = this.Task.AudioTracks.Any(audioTrack => Equals(audioTrack.ScannedTrack, sourceTrack));
- if (!found)
- {
- // If it doesn't, add it.
- this.Add(sourceTrack, true);
- }
- }
- }
-
- /// <summary>
/// The get preferred audio track, or the first if none available.
/// </summary>
/// <returns>
diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
index ce82439f1..85ac495ff 100644
--- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
@@ -108,6 +108,21 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Trigger a faster / smoother way of updating the log window.
+ /// </summary>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ protected virtual void OnLogMessageReceived(LogEventArgs e)
+ {
+ var onLogMessageReceived = this.LogMessageReceived;
+ if (onLogMessageReceived != null)
+ {
+ onLogMessageReceived.Invoke(this, e);
+ }
+ }
+
+ /// <summary>
/// Handle the OnDeactivate Caliburn Event
/// </summary>
/// <param name="close">
@@ -172,20 +187,5 @@ namespace HandBrakeWPF.ViewModels
});
}
}
-
- /// <summary>
- /// Trigger a faster / smoother way of updating the log window.
- /// </summary>
- /// <param name="e">
- /// The e.
- /// </param>
- protected virtual void OnLogMessageReceived(LogEventArgs e)
- {
- var onLogMessageReceived = this.LogMessageReceived;
- if (onLogMessageReceived != null)
- {
- onLogMessageReceived.Invoke(this, e);
- }
- }
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index fbe0f6ad0..f29e6fac0 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -2091,6 +2091,33 @@ namespace HandBrakeWPF.ViewModels
}
}
+ /// <summary>
+ /// The process drive.
+ /// </summary>
+ /// <param name="item">
+ /// The item.
+ /// </param>
+ public void ProcessDrive(object item)
+ {
+ if (item != null)
+ {
+ if (item.GetType() == typeof(DriveInformation))
+ {
+ this.StartScan(((DriveInformation)item).RootDirectory, 0);
+ }
+ else if (item.GetType() == typeof(SourceMenuItem))
+ {
+ DriveInformation driveInfo = ((SourceMenuItem)item).Tag as DriveInformation;
+ if (driveInfo != null)
+ {
+ this.StartScan(driveInfo.RootDirectory, this.TitleSpecificScan);
+ }
+
+ this.ShowSourceSelection = false;
+ }
+ }
+ }
+
#endregion
#region Private Methods
@@ -2517,33 +2544,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// The process drive.
- /// </summary>
- /// <param name="item">
- /// The item.
- /// </param>
- public void ProcessDrive(object item)
- {
- if (item != null)
- {
- if (item.GetType() == typeof(DriveInformation))
- {
- this.StartScan(((DriveInformation)item).RootDirectory, 0);
- }
- else if (item.GetType() == typeof(SourceMenuItem))
- {
- DriveInformation driveInfo = ((SourceMenuItem)item).Tag as DriveInformation;
- if (driveInfo != null)
- {
- this.StartScan(driveInfo.RootDirectory, this.TitleSpecificScan);
- }
-
- this.ShowSourceSelection = false;
- }
- }
- }
-
- /// <summary>
/// Allows the main window to respond to setting changes.
/// </summary>
/// <param name="sender">
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index d98fb2d25..69338721b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1124,15 +1124,6 @@ namespace HandBrakeWPF.ViewModels
#region Public Methods
/// <summary>
- /// Load / Update the user settings.
- /// </summary>
- protected override void OnActivate()
- {
- this.OnLoad();
- base.OnActivate();
- }
-
- /// <summary>
/// Close this window.
/// </summary>
public void Close()
@@ -1244,7 +1235,7 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void BrowseWhenDoneAudioFile()
{
- OpenFileDialog dialog = new OpenFileDialog() { Filter = "All Files|*.wav;*.mp3", FileName = this.WhenDoneAudioFileFullPath };
+ OpenFileDialog dialog = new OpenFileDialog() { Filter = "All Files|*.wav;*.mp3", FileName = this.WhenDoneAudioFileFullPath };
bool? dialogResult = dialog.ShowDialog();
if (dialogResult.HasValue && dialogResult.Value)
{
@@ -1438,6 +1429,15 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Load / Update the user settings.
+ /// </summary>
+ protected override void OnActivate()
+ {
+ this.OnLoad();
+ base.OnActivate();
+ }
+
+ /// <summary>
/// Save the settings selected
/// </summary>
private void Save()
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
index 9e002ae36..f1191edae 100644
--- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
@@ -41,7 +41,7 @@ namespace HandBrakeWPF.ViewModels
#region Constants and Fields
- private readonly Subtitle ForeignAudioSearchTrack;
+ private readonly Subtitle foreignAudioSearchTrack;
private IList<Subtitle> sourceTracks;
#endregion
@@ -63,8 +63,8 @@ namespace HandBrakeWPF.ViewModels
this.Langauges = LanguageUtilities.MapLanguages().Keys;
this.CharacterCodes = CharCodesUtilities.GetCharacterCodes();
- this.ForeignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search" };
- this.SourceTracks = new List<Subtitle> { this.ForeignAudioSearchTrack };
+ this.foreignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search" };
+ this.SourceTracks = new List<Subtitle> { this.foreignAudioSearchTrack };
}
#endregion
@@ -326,7 +326,7 @@ namespace HandBrakeWPF.ViewModels
// Add Foreign Audio Scan
if (this.SubtitleBehaviours.AddForeignAudioScanTrack)
{
- this.Add(ForeignAudioSearchTrack);
+ this.Add(foreignAudioSearchTrack);
}
// Add Track Behaviours
@@ -496,7 +496,7 @@ namespace HandBrakeWPF.ViewModels
public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
{
this.SourceTracks.Clear();
- this.SourceTracks.Add(ForeignAudioSearchTrack);
+ this.SourceTracks.Add(foreignAudioSearchTrack);
foreach (Subtitle subtitle in title.Subtitles)
{
this.SourceTracks.Add(subtitle);
@@ -534,7 +534,7 @@ namespace HandBrakeWPF.ViewModels
if (source == null)
{
- source = ForeignAudioSearchTrack;
+ source = foreignAudioSearchTrack;
}
SubtitleTrack track = new SubtitleTrack
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
index c1a45a58f..6fe0187bc 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
@@ -45,14 +45,11 @@ namespace HandBrakeWPF.Views
{
this.InitializeComponent();
-
-
IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
bool minimiseToTray = userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize);
if (minimiseToTray)
{
-
INotifyIconService notifyIconService = IoC.Get<INotifyIconService>();
this.notifyIcon = new NotifyIcon();
this.notifyIcon.ContextMenu = new ContextMenu(new[] { new MenuItem("Restore", NotifyIconClick), new MenuItem("Mini Status Display", ShowMiniStatusDisplay) });
@@ -87,6 +84,33 @@ namespace HandBrakeWPF.Views
}
/// <summary>
+ /// Check with the user before closing.
+ /// </summary>
+ /// <param name="e">
+ /// The CancelEventArgs.
+ /// </param>
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ IShellViewModel shellViewModel = this.DataContext as IShellViewModel;
+
+ if (shellViewModel != null)
+ {
+ bool canClose = shellViewModel.CanClose();
+ if (!canClose)
+ {
+ e.Cancel = true;
+ }
+ }
+
+ if (this.notifyIcon != null)
+ {
+ this.notifyIcon.Visible = false;
+ }
+
+ base.OnClosing(e);
+ }
+
+ /// <summary>
/// The show mini status display.
/// </summary>
/// <param name="sender">
@@ -146,32 +170,5 @@ namespace HandBrakeWPF.Views
}
}
}
-
- /// <summary>
- /// Check with the user before closing.
- /// </summary>
- /// <param name="e">
- /// The CancelEventArgs.
- /// </param>
- protected override void OnClosing(CancelEventArgs e)
- {
- IShellViewModel shellViewModel = this.DataContext as IShellViewModel;
-
- if (shellViewModel != null)
- {
- bool canClose = shellViewModel.CanClose();
- if (!canClose)
- {
- e.Cancel = true;
- }
- }
-
- if (this.notifyIcon != null)
- {
- this.notifyIcon.Visible = false;
- }
-
- base.OnClosing(e);
- }
}
}