<DebugSymbols>true</DebugSymbols>\r
</PropertyGroup>\r
<ItemGroup>\r
- <Reference Include="Caliburn.Micro, Version=1.3.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">\r
- <SpecificVersion>False</SpecificVersion>\r
- <HintPath>..\libraries\caliburn\Caliburn.Micro.dll</HintPath>\r
- </Reference>\r
- <Reference Include="Castle.Core, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">\r
- <SpecificVersion>False</SpecificVersion>\r
- <HintPath>..\libraries\caliburn\Castle.Core.dll</HintPath>\r
- </Reference>\r
- <Reference Include="Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">\r
- <SpecificVersion>False</SpecificVersion>\r
- <HintPath>..\libraries\caliburn\Castle.Windsor.dll</HintPath>\r
- </Reference>\r
<Reference Include="Microsoft.CSharp" />\r
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">\r
<SpecificVersion>False</SpecificVersion>\r
<Compile Include="Services\Scan\EventArgs\ScanProgressEventArgs.cs" />\r
<Compile Include="Utilities\Converters.cs" />\r
<Compile Include="Utilities\EnumHelper.cs" />\r
+ <Compile Include="Utilities\ExtensionMethods.cs" />\r
+ <Compile Include="Utilities\PropertyChangedBase.cs" />\r
<Compile Include="Utilities\SystemInfo.cs" />\r
<Compile Include="Utilities\VersionHelper.cs" />\r
<Compile Include="Utilities\Win32.cs" />\r
/// <summary>\r
/// A wrapper for a HandBrake instance.\r
/// </summary>\r
- internal class HandBrakeInstance : IHandBrakeInstance, IDisposable\r
+ public class HandBrakeInstance : IHandBrakeInstance, IDisposable\r
{\r
/// <summary>\r
/// The number of MS between status polls when scanning.\r
/// <summary>\r
/// The root object.\r
/// </summary>\r
- internal class JsonEncodeObject\r
+ public class JsonEncodeObject\r
{\r
/// <summary>\r
/// Gets or sets the audio.\r
/// <summary>\r
/// The audio list.\r
/// </summary>\r
- internal class AudioList\r
+ public class AudioList\r
{\r
/// <summary>\r
/// Gets or sets the bit rate.\r
/// <summary>\r
/// The chapter list.\r
/// </summary>\r
- internal class ChapterList\r
+ public class ChapterList\r
{\r
/// <summary>\r
/// Gets or sets the duration.\r
/// <summary>\r
/// The color.\r
/// </summary>\r
- internal class Color\r
+ public class Color\r
{\r
/// <summary>\r
/// Gets or sets the matrix.\r
/// <summary>\r
/// The duration.\r
/// </summary>\r
- internal class Duration\r
+ public class Duration\r
{\r
/// <summary>\r
/// Gets or sets the hours.\r
/// <summary>\r
/// The duration 2.\r
/// </summary>\r
- internal class Duration2\r
+ public class Duration2\r
{\r
/// <summary>\r
/// Gets or sets the hours.\r
/// <summary>\r
/// The frame rate.\r
/// </summary>\r
- internal class FrameRate\r
+ public class FrameRate\r
{\r
-\r
/// <summary>\r
/// Gets or sets the den.\r
/// </summary>\r
/// <summary>\r
/// The geometry.\r
/// </summary>\r
- internal class Geometry\r
+ public class Geometry\r
{\r
/// <summary>\r
/// Gets or sets the height.\r
/// <summary>\r
/// The root object.\r
/// </summary>\r
- internal class JsonScanObject\r
+ public class JsonScanObject\r
{\r
/// <summary>\r
/// Gets or sets the main feature.\r
/// <summary>\r
/// The meta data.\r
/// </summary>\r
- internal class MetaData\r
+ public class MetaData\r
{\r
}\r
}
\ No newline at end of file
/// <summary>\r
/// The par.\r
/// </summary>\r
- internal class PAR\r
+ public class PAR\r
{\r
/// <summary>\r
/// Gets or sets the width.\r
/// <summary>\r
/// The subtitle list.\r
/// </summary>\r
- internal class SubtitleList\r
+ public class SubtitleList\r
{\r
/// <summary>\r
/// Gets or sets the format.\r
/// <summary>\r
/// The title list.\r
/// </summary>\r
- internal class TitleList\r
+ public class TitleList\r
{\r
/// <summary>\r
/// Gets or sets the angle count.\r
\r
namespace HandBrake.ApplicationServices.Model\r
{\r
- using Caliburn.Micro;\r
\r
using HandBrake.ApplicationServices.Services.Encode.Model;\r
- using HandBrake.ApplicationServices.Services.Scan.Model;\r
+ using HandBrake.ApplicationServices.Utilities;\r
\r
/// <summary>\r
/// The QueueTask.\r
using System.Collections.Generic;\r
using System.Collections.ObjectModel;\r
using System.Linq;\r
- using Caliburn.Micro;\r
\r
using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;\r
using HandBrake.ApplicationServices.Interop.Model;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
+ using HandBrake.ApplicationServices.Utilities;\r
\r
/// <summary>\r
/// An Encode Task\r
using System.ComponentModel;\r
using System.Globalization;\r
\r
- using Caliburn.Micro;\r
-\r
using HandBrake.ApplicationServices.Services.Scan.Model;\r
using HandBrake.ApplicationServices.Utilities;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
{\r
using System;\r
\r
- using Caliburn.Micro;\r
+ using HandBrake.ApplicationServices.Utilities;\r
\r
/// <summary>\r
/// A Movie Chapter\r
{\r
using System;\r
\r
- using Caliburn.Micro;\r
-\r
using HandBrake.ApplicationServices.Services.Scan.Model;\r
+ using HandBrake.ApplicationServices.Utilities;\r
\r
/// <summary>\r
/// Subtitle Information\r
--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+\r
+namespace HandBrake.ApplicationServices.Utilities\r
+{\r
+ using System.Linq.Expressions;\r
+ using System.Reflection;\r
+\r
+ public static class ExtensionMethods\r
+ {\r
+ /// <summary>\r
+ /// Converts an expression into a <see cref="MemberInfo"/>.\r
+ /// </summary>\r
+ /// <param name="expression">The expression to convert.</param>\r
+ /// <returns>The member info.</returns>\r
+ public static MemberInfo GetMemberInfo(this Expression expression)\r
+ {\r
+ var lambda = (LambdaExpression)expression;\r
+\r
+ MemberExpression memberExpression;\r
+ if (lambda.Body is UnaryExpression)\r
+ {\r
+ var unaryExpression = (UnaryExpression)lambda.Body;\r
+ memberExpression = (MemberExpression)unaryExpression.Operand;\r
+ }\r
+ else\r
+ memberExpression = (MemberExpression)lambda.Body;\r
+\r
+ return memberExpression.Member;\r
+ }\r
+\r
+ }\r
+}\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="PropertyChangedBase.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+// A base class that implements the infrastructure for property change notification and automatically performs UI thread marshalling.\r
+// This class is a modified version of the caliburn micro \r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Utilities\r
+{\r
+ using System;\r
+ using System.ComponentModel;\r
+ using System.Linq.Expressions;\r
+ using System.Runtime.Serialization;\r
+\r
+ /// <summary>\r
+ /// Property Changed Base implimentation.\r
+ /// </summary>\r
+ [DataContract]\r
+ public class PropertyChangedBase : INotifyPropertyChanged\r
+ {\r
+ /// <summary>\r
+ /// Creates an instance of <see cref = "PropertyChangedBase" />.\r
+ /// </summary>\r
+ public PropertyChangedBase()\r
+ {\r
+ IsNotifying = true;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Occurs when a property value changes.\r
+ /// </summary>\r
+ public event PropertyChangedEventHandler PropertyChanged = delegate { };\r
+\r
+ /// <summary>\r
+ /// Enables/Disables property change notification.\r
+ /// </summary>\r
+ public bool IsNotifying { get; set; }\r
+\r
+ /// <summary>\r
+ /// Raises a change notification indicating that all bindings should be refreshed.\r
+ /// </summary>\r
+ public virtual void Refresh()\r
+ {\r
+ NotifyOfPropertyChange(string.Empty);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Notifies subscribers of the property change.\r
+ /// </summary>\r
+ /// <param name = "propertyName">Name of the property.</param>\r
+ public virtual void NotifyOfPropertyChange(string propertyName = null)\r
+ {\r
+ if (IsNotifying)\r
+ {\r
+ OnPropertyChanged(new PropertyChangedEventArgs(propertyName));\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Notifies subscribers of the property change.\r
+ /// </summary>\r
+ /// <typeparam name = "TProperty">The type of the property.</typeparam>\r
+ /// <param name = "property">The property expression.</param>\r
+ public void NotifyOfPropertyChange<TProperty>(Expression<Func<TProperty>> property)\r
+ {\r
+ NotifyOfPropertyChange(property.GetMemberInfo().Name);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Raises the <see cref="PropertyChanged" /> event directly.\r
+ /// </summary>\r
+ /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>\r
+ [EditorBrowsable(EditorBrowsableState.Never)]\r
+ protected void OnPropertyChanged(PropertyChangedEventArgs e)\r
+ {\r
+ var handler = PropertyChanged;\r
+ if (handler != null)\r
+ {\r
+ handler(this, e);\r
+ }\r
+ }\r
+ }\r
+}\r