diff options
author | sr55 <[email protected]> | 2015-03-14 17:16:58 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-03-14 17:16:58 +0000 |
commit | 0b14b5646566aa90026466dd7c4b3430dec7c093 (patch) | |
tree | 52de74050a00326f0442dac74af6b7f77b18031d /win | |
parent | 600687b0c1be4c35c6b18a37a8fddc1e72f020fc (diff) |
WinGui: Remove the Caliburn Micro / Castle dependency in The services library, and make the low-level json api public.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6986 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
22 files changed, 141 insertions, 35 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 91228fdae..a507cfdc8 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -46,18 +46,6 @@ <DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Caliburn.Micro, Version=1.3.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\libraries\caliburn\Caliburn.Micro.dll</HintPath>
- </Reference>
- <Reference Include="Castle.Core, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\libraries\caliburn\Castle.Core.dll</HintPath>
- </Reference>
- <Reference Include="Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\libraries\caliburn\Castle.Windsor.dll</HintPath>
- </Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -202,6 +190,8 @@ <Compile Include="Services\Scan\EventArgs\ScanProgressEventArgs.cs" />
<Compile Include="Utilities\Converters.cs" />
<Compile Include="Utilities\EnumHelper.cs" />
+ <Compile Include="Utilities\ExtensionMethods.cs" />
+ <Compile Include="Utilities\PropertyChangedBase.cs" />
<Compile Include="Utilities\SystemInfo.cs" />
<Compile Include="Utilities\VersionHelper.cs" />
<Compile Include="Utilities\Win32.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs index 379e461c3..9c99087f2 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs @@ -41,7 +41,7 @@ namespace HandBrake.ApplicationServices.Interop /// <summary>
/// A wrapper for a HandBrake instance.
/// </summary>
- internal class HandBrakeInstance : IHandBrakeInstance, IDisposable
+ public class HandBrakeInstance : IHandBrakeInstance, IDisposable
{
/// <summary>
/// The number of MS between status polls when scanning.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs index 7b9a1f953..0accd19cf 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs @@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// <summary>
/// The root object.
/// </summary>
- internal class JsonEncodeObject
+ public class JsonEncodeObject
{
/// <summary>
/// Gets or sets the audio.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs index 18ad084f3..544f49226 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The audio list.
/// </summary>
- internal class AudioList
+ public class AudioList
{
/// <summary>
/// Gets or sets the bit rate.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs index c4da099e5..01a0068fc 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The chapter list.
/// </summary>
- internal class ChapterList
+ public class ChapterList
{
/// <summary>
/// Gets or sets the duration.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Color.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Color.cs index 8709dcbdd..b99495440 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Color.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Color.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The color.
/// </summary>
- internal class Color
+ public class Color
{
/// <summary>
/// Gets or sets the matrix.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration.cs index 7785fff05..4eea32e12 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The duration.
/// </summary>
- internal class Duration
+ public class Duration
{
/// <summary>
/// Gets or sets the hours.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs index 444ea3e2f..3bf6827f5 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The duration 2.
/// </summary>
- internal class Duration2
+ public class Duration2
{
/// <summary>
/// Gets or sets the hours.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs index 937738076..a85042320 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs @@ -12,9 +12,8 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The frame rate.
/// </summary>
- internal class FrameRate
+ public class FrameRate
{
-
/// <summary>
/// Gets or sets the den.
/// </summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Geometry.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Geometry.cs index 9f7bc95d4..0f7f35ee8 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Geometry.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Geometry.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The geometry.
/// </summary>
- internal class Geometry
+ public class Geometry
{
/// <summary>
/// Gets or sets the height.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs index 397e5ce9e..8d38c51a1 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs @@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The root object.
/// </summary>
- internal class JsonScanObject
+ public class JsonScanObject
{
/// <summary>
/// Gets or sets the main feature.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs index 46b312a5a..ecd26bd8f 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The meta data.
/// </summary>
- internal class MetaData
+ public class MetaData
{
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs index 2eca81fc6..9149604d9 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The par.
/// </summary>
- internal class PAR
+ public class PAR
{
/// <summary>
/// Gets or sets the width.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs index f727fd15e..a6ec067e8 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs @@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The subtitle list.
/// </summary>
- internal class SubtitleList
+ public class SubtitleList
{
/// <summary>
/// Gets or sets the format.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs index f6668eb24..731d715c2 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs @@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan /// <summary>
/// The title list.
/// </summary>
- internal class TitleList
+ public class TitleList
{
/// <summary>
/// Gets or sets the angle count.
diff --git a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs index 366f5b4e6..42f55d02d 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs @@ -9,10 +9,9 @@ namespace HandBrake.ApplicationServices.Model
{
- using Caliburn.Micro;
using HandBrake.ApplicationServices.Services.Encode.Model;
- using HandBrake.ApplicationServices.Services.Scan.Model;
+ using HandBrake.ApplicationServices.Utilities;
/// <summary>
/// The QueueTask.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs index 67d81facf..2117565e5 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs @@ -13,12 +13,12 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
- using Caliburn.Micro;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.ApplicationServices.Interop.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Utilities;
/// <summary>
/// An Encode Task
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs index 9887275bb..34a81a27f 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs @@ -13,8 +13,6 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models using System.ComponentModel;
using System.Globalization;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/ChapterMarker.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/ChapterMarker.cs index 7f20ac6da..6792a1394 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/ChapterMarker.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/ChapterMarker.cs @@ -11,7 +11,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models {
using System;
- using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Utilities;
/// <summary>
/// A Movie Chapter
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/SubtitleTrack.cs index e37bf26c5..a7d11c670 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/SubtitleTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/SubtitleTrack.cs @@ -11,9 +11,8 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models {
using System;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Services.Scan.Model;
+ using HandBrake.ApplicationServices.Utilities;
/// <summary>
/// Subtitle Information
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs b/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs new file mode 100644 index 000000000..53db9e23f --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs @@ -0,0 +1,35 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HandBrake.ApplicationServices.Utilities
+{
+ using System.Linq.Expressions;
+ using System.Reflection;
+
+ public static class ExtensionMethods
+ {
+ /// <summary>
+ /// Converts an expression into a <see cref="MemberInfo"/>.
+ /// </summary>
+ /// <param name="expression">The expression to convert.</param>
+ /// <returns>The member info.</returns>
+ public static MemberInfo GetMemberInfo(this Expression expression)
+ {
+ var lambda = (LambdaExpression)expression;
+
+ MemberExpression memberExpression;
+ if (lambda.Body is UnaryExpression)
+ {
+ var unaryExpression = (UnaryExpression)lambda.Body;
+ memberExpression = (MemberExpression)unaryExpression.Operand;
+ }
+ else
+ memberExpression = (MemberExpression)lambda.Body;
+
+ return memberExpression.Member;
+ }
+
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs new file mode 100644 index 000000000..9809def57 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PropertyChangedBase.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>
+// A base class that implements the infrastructure for property change notification and automatically performs UI thread marshalling.
+// This class is a modified version of the caliburn micro
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Utilities
+{
+ using System;
+ using System.ComponentModel;
+ using System.Linq.Expressions;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Property Changed Base implimentation.
+ /// </summary>
+ [DataContract]
+ public class PropertyChangedBase : INotifyPropertyChanged
+ {
+ /// <summary>
+ /// Creates an instance of <see cref = "PropertyChangedBase" />.
+ /// </summary>
+ public PropertyChangedBase()
+ {
+ IsNotifying = true;
+ }
+
+ /// <summary>
+ /// Occurs when a property value changes.
+ /// </summary>
+ public event PropertyChangedEventHandler PropertyChanged = delegate { };
+
+ /// <summary>
+ /// Enables/Disables property change notification.
+ /// </summary>
+ public bool IsNotifying { get; set; }
+
+ /// <summary>
+ /// Raises a change notification indicating that all bindings should be refreshed.
+ /// </summary>
+ public virtual void Refresh()
+ {
+ NotifyOfPropertyChange(string.Empty);
+ }
+
+ /// <summary>
+ /// Notifies subscribers of the property change.
+ /// </summary>
+ /// <param name = "propertyName">Name of the property.</param>
+ public virtual void NotifyOfPropertyChange(string propertyName = null)
+ {
+ if (IsNotifying)
+ {
+ OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ /// <summary>
+ /// Notifies subscribers of the property change.
+ /// </summary>
+ /// <typeparam name = "TProperty">The type of the property.</typeparam>
+ /// <param name = "property">The property expression.</param>
+ public void NotifyOfPropertyChange<TProperty>(Expression<Func<TProperty>> property)
+ {
+ NotifyOfPropertyChange(property.GetMemberInfo().Name);
+ }
+
+ /// <summary>
+ /// Raises the <see cref="PropertyChanged" /> event directly.
+ /// </summary>
+ /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void OnPropertyChanged(PropertyChangedEventArgs e)
+ {
+ var handler = PropertyChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+ }
+}
|