]> granicus.if.org Git - handbrake/commitdiff
WinGui: Remove the Caliburn Micro / Castle dependency in The services library, and...
authorsr55 <sr55.hb@outlook.com>
Sat, 14 Mar 2015 17:16:58 +0000 (17:16 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 14 Mar 2015 17:16:58 +0000 (17:16 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6986 b64f7644-9d1e-0410-96f1-a4d463321fa5

22 files changed:
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Color.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Geometry.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs
win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/ChapterMarker.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/SubtitleTrack.cs
win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs [new file with mode: 0644]

index 91228fdaed65b9d63df71ed4fefa7a2c3224b94b..a507cfdc8c542040a839c535b60153125ce280ec 100644 (file)
     <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
index 379e461c360bd908ed10f28da4c6fd6226e97b99..9c99087f2915da2d2631b1d55d0a0d13098816e1 100644 (file)
@@ -41,7 +41,7 @@ namespace HandBrake.ApplicationServices.Interop
     /// <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
index 7b9a1f95313f277829d45f0beff2696131cdd3b8..0accd19cfcaea314c72563b1d640321a56abeb20 100644 (file)
@@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode
     /// <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
index 18ad084f3a9b8478d2638bdd8ef9540ff03098d3..544f49226fe644eb0f3c0d5841e7df7c17d24055 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index c4da099e502312c345fb5a4fdc6cb351f2aa1b91..01a0068fc295114c2cd28ea02504bcc5374e6d6e 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index 8709dcbdd4db57b4b2a662a65ffb3d8e3f301ce6..b99495440171897436c908c65354c72e78258566 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <summary>\r
     /// The color.\r
     /// </summary>\r
-    internal class Color\r
+    public class Color\r
     {\r
         /// <summary>\r
         /// Gets or sets the matrix.\r
index 7785fff05e9f80faa6fd7f6d9350ffa67b187653..4eea32e1282756c842cb8d8a46598061cabbea73 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <summary>\r
     /// The duration.\r
     /// </summary>\r
-    internal class Duration\r
+    public class Duration\r
     {\r
         /// <summary>\r
         /// Gets or sets the hours.\r
index 444ea3e2f2ac82ef2f0c1f694e2bdc42d5ee7f39..3bf6827f5c70364ab1fcc94adacb662effeae1ed 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index 937738076602b190a2f647f987facfc3ca64710a..a850423207f07be0e687ef7ee561fb10df433005 100644 (file)
@@ -12,9 +12,8 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index 9f7bc95d42d8f2929699c2f6ec61a9b7adf9bbf7..0f7f35ee84f38db0393d59f680386e7505366eb5 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <summary>\r
     /// The geometry.\r
     /// </summary>\r
-    internal class Geometry\r
+    public class Geometry\r
     {\r
         /// <summary>\r
         /// Gets or sets the height.\r
index 397e5ce9ebaa801db9eaf61dcf1ffa9fe5b20c67..8d38c51a131229f9426e75b37534eac3748636a4 100644 (file)
@@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index 46b312a5a0c18f37eb1c2312356099bd6518cb90..ecd26bd8f25a452df6c816807b5fcf58afaa5cc8 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <summary>\r
     /// The meta data.\r
     /// </summary>\r
-    internal class MetaData\r
+    public class MetaData\r
     {\r
     }\r
 }
\ No newline at end of file
index 2eca81fc6d437fcc5a93410c53aaa40844808f90..9149604d9257f15bbeeaebcc2891fc56131c6b0f 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <summary>\r
     /// The par.\r
     /// </summary>\r
-    internal class PAR\r
+    public class PAR\r
     {\r
         /// <summary>\r
         /// Gets or sets the width.\r
index f727fd15e97d471dff802d7812c761d24862b823..a6ec067e877db552e938ea6c5dc7b7d8dc23c3de 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index f6668eb24ea183a030cea647b32076225dd67f31..731d715c20a4486e75b26ae93e50dfa2a6328f99 100644 (file)
@@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     /// <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
index 366f5b4e6d5829c51039e66a44054886af636083..42f55d02dea0ef6ccb95ceb6f850bae661d1b66f 100644 (file)
@@ -9,10 +9,9 @@
 \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
index 67d81facfa274624dad76d2e785f86fb2346b083..2117565e5f834ea9f7d3376871bb83e5ef712bfc 100644 (file)
@@ -13,12 +13,12 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
     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
index 9887275bbfc75a606bdaea958ef28a7ee53c4073..34a81a27f2e3ec2a00795314d7cd9f5843a0ea24 100644 (file)
@@ -13,8 +13,6 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models
     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
index 7f20ac6daaecff78b5bbf28befe42c07e140cfc5..6792a1394edc3e4eefca43cca01afbfd574f18ac 100644 (file)
@@ -11,7 +11,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models
 {\r
     using System;\r
 \r
-    using Caliburn.Micro;\r
+    using HandBrake.ApplicationServices.Utilities;\r
 \r
     /// <summary>\r
     /// A Movie Chapter\r
index e37bf26c5b54f820e6f5cd7c7bff2422adaf5356..a7d11c670a3d9cb61aec398a12250b56427db033 100644 (file)
@@ -11,9 +11,8 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models
 {\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
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs b/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs
new file mode 100644 (file)
index 0000000..53db9e2
--- /dev/null
@@ -0,0 +1,35 @@
+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
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs
new file mode 100644 (file)
index 0000000..9809def
--- /dev/null
@@ -0,0 +1,86 @@
+// --------------------------------------------------------------------------------------------------------------------\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