]> granicus.if.org Git - handbrake/commitdiff
WinGui: (WPF) General work hooking up various aspects of the new WPF UI, bug fixes...
authorsr55 <sr55.hb@outlook.com>
Sat, 18 Feb 2012 22:09:26 +0000 (22:09 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 18 Feb 2012 22:09:26 +0000 (22:09 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4456 b64f7644-9d1e-0410-96f1-a4d463321fa5

16 files changed:
win/CS/HandBrake.ApplicationServices/Model/Encoding/PointToPointMode.cs
win/CS/HandBrake.ApplicationServices/Services/UpdateService.cs
win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/HandBrakeWPF.csproj
win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/Helpers/UpdateCheckHelper.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/Services/UpdateVersionService.cs
win/CS/HandBrakeWPF/UserSettingConstants.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
win/CS/HandBrakeWPF/Views/AudioView.xaml
win/CS/HandBrakeWPF/Views/MainView.xaml
win/CS/HandBrakeWPF/Views/MainView.xaml.cs
win/CS/HandBrakeWPF/Views/QueueView.xaml
win/CS/HandBrakeWPF/Views/SubtitlesView.xaml
win/CS/frmMain.cs

index e4105565e55e978d974fce4627ede2be5473bfd2..00eac35f0d52a2f4e98d85acff4bbd830d0c27fc 100644 (file)
@@ -5,14 +5,23 @@
 \r
 namespace HandBrake.ApplicationServices.Model.Encoding\r
 {\r
+    using System.ComponentModel.DataAnnotations;\r
+\r
     /// <summary>\r
     /// Point to Point Mode\r
     /// </summary>\r
     public enum PointToPointMode\r
     {\r
+        [Display(Name = "Chapters")]\r
         Chapters = 0,\r
+\r
+        [Display(Name = "Seconds")]\r
         Seconds,\r
+\r
+        [Display(Name = "Frames")]\r
         Frames,\r
+\r
+        [Display(Name = "Preview")]\r
         Preview,\r
     }\r
 }\r
index a932feee599feaf8ad1eaa4412e7b5c38e748be0..02ed05a9d050595cbbeee8d8eb12204ad5bfe86d 100644 (file)
@@ -18,6 +18,10 @@ namespace HandBrake.ApplicationServices.Services
     /// </summary>\r
     public class UpdateService\r
     {\r
+        /*\r
+         * TODO: Refactor this to use Caliburn Invocation\r
+         */ \r
+\r
         /// <summary>\r
         /// Begins checking for an update to HandBrake.\r
         /// </summary>\r
@@ -36,10 +40,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="skipBuild">\r
         /// The skip Build.\r
         /// </param>\r
-        /// <param name="currentVersion">\r
-        /// The current Version.\r
-        /// </param>\r
-        public static void BeginCheckForUpdates(AsyncCallback callback, bool debug, string url, int currentBuild, int skipBuild, string currentVersion)\r
+        public static void BeginCheckForUpdates(AsyncCallback callback, bool debug, string url, int currentBuild, int skipBuild)\r
         {\r
             ThreadPool.QueueUserWorkItem(delegate\r
                 {\r
diff --git a/win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs b/win/CS/HandBrakeWPF/Converters/FullPathToFileNameConverter.cs
new file mode 100644 (file)
index 0000000..b0f764b
--- /dev/null
@@ -0,0 +1,76 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="FullPathToFileNameConverter.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
+//   Defines the FullPathToFileNameConverter type.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Converters\r
+{\r
+    using System.Globalization;\r
+    using System.IO;\r
+    using System.Windows.Data;\r
+    using System;\r
+\r
+    /// <summary>\r
+    /// Converts a Full Path to Filename only.\r
+    /// </summary>\r
+    public sealed class FullPathToFileNameConverter : IValueConverter\r
+    {\r
+        /// <summary>\r
+        /// Convert an Enum to it's display value (attribute)\r
+        /// </summary>\r
+        /// <param name="value">\r
+        /// The value.\r
+        /// </param>\r
+        /// <param name="targetType">\r
+        /// The target type.\r
+        /// </param>\r
+        /// <param name="parameter">\r
+        /// The parameter. (A boolean which inverts the output)\r
+        /// </param>\r
+        /// <param name="culture">\r
+        /// The culture.\r
+        /// </param>\r
+        /// <returns>\r
+        /// Visibility property\r
+        /// </returns>\r
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\r
+        {\r
+            if (!string.IsNullOrEmpty(value.ToString()))\r
+            {\r
+                return Path.GetFileName(value.ToString()); \r
+            }\r
+\r
+            return "Unknown";\r
+        }\r
+\r
+        /// <summary>\r
+        /// Convert Back for the IValueConverter Interface. Not used!\r
+        /// </summary>\r
+        /// <param name="value">\r
+        /// The value.\r
+        /// </param>\r
+        /// <param name="targetType">\r
+        /// The target type.\r
+        /// </param>\r
+        /// <param name="parameter">\r
+        /// The parameter.\r
+        /// </param>\r
+        /// <param name="culture">\r
+        /// The culture.\r
+        /// </param>\r
+        /// <returns>\r
+        /// Nothing\r
+        /// </returns>\r
+        /// <exception cref="NotImplementedException">\r
+        /// This method is not used!\r
+        /// </exception>\r
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\r
+        {\r
+            throw new NotImplementedException();\r
+        }\r
+    }\r
+}\r
index 3e940794f75ac16d48c5783c8f1e650a87ddaeb0..dbfd18f20ae779ff0a0e13156b7ccd97f95058c5 100644 (file)
     <Compile Include="Converters\BooleanConverter.cs" />\r
     <Compile Include="Converters\BooleanToVisibilityConverter.cs" />\r
     <Compile Include="Converters\AudioEnumConverter.cs" />\r
+    <Compile Include="Converters\FullPathToFileNameConverter.cs" />\r
     <Compile Include="Helpers\AutoNameHelper.cs" />\r
     <Compile Include="Helpers\ListBoxHelper.cs" />\r
+    <Compile Include="Helpers\QueueRecoveryHelper.cs" />\r
+    <Compile Include="Helpers\UpdateCheckHelper.cs" />\r
     <Compile Include="Services\ErrorService.cs" />\r
     <Compile Include="Services\Interfaces\IJobContextService.cs" />\r
     <Compile Include="Services\Interfaces\IErrorService.cs" />\r
diff --git a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs
new file mode 100644 (file)
index 0000000..32e999e
--- /dev/null
@@ -0,0 +1,133 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="QueueRecoveryHelper.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
+//   Defines the QueueRecoveryHelper type.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Helpers\r
+{\r
+    using System;\r
+    using System.Collections.Generic;\r
+    using System.IO;\r
+    using System.Linq;\r
+    using System.Windows;\r
+    using System.Xml.Serialization;\r
+\r
+    using HandBrake.ApplicationServices.Model;\r
+    using HandBrake.ApplicationServices.Services.Interfaces;\r
+    using HandBrake.ApplicationServices.Utilities;\r
+\r
+    using HandBrakeWPF.Services.Interfaces;\r
+\r
+    /// <summary>\r
+    /// Queue Recovery Helper\r
+    /// </summary>\r
+    public class QueueRecoveryHelper\r
+    {\r
+        /// <summary>\r
+        /// Check if the queue recovery file contains records.\r
+        /// If it does, it means the last queue did not complete before HandBrake closed.\r
+        /// So, return a boolean if true. \r
+        /// </summary>\r
+        /// <returns>\r
+        /// True if there is a queue to recover.\r
+        /// </returns>\r
+        public static List<string> CheckQueueRecovery()\r
+        {\r
+            try\r
+            {\r
+                XmlSerializer Ser = new XmlSerializer(typeof(List<QueueTask>));\r
+                string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");\r
+                List<string> queueFiles = new List<string>();\r
+                List<string> removeFiles = new List<string>();\r
+\r
+                DirectoryInfo info = new DirectoryInfo(tempPath);\r
+                IEnumerable<FileInfo> logFiles = info.GetFiles("*.xml").Where(f => f.Name.StartsWith("hb_queue_recovery"));\r
+                foreach (FileInfo file in logFiles)\r
+                {\r
+                    using (FileStream strm = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))\r
+                    {\r
+                        List<QueueTask> list = Ser.Deserialize(strm) as List<QueueTask>;\r
+                        if (list != null && list.Count == 0)\r
+                        {\r
+                            removeFiles.Add(file.FullName);\r
+                        }\r
+\r
+                        if (list != null && list.Count != 0)\r
+                        {\r
+                            List<QueueTask> tasks = list.Where(l => l.Status != QueueItemStatus.Completed).ToList();\r
+                            if (tasks.Count != 0)\r
+                            {\r
+                                queueFiles.Add(file.Name);\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+\r
+                // Cleanup old/unused queue files for now.\r
+                if (!GeneralUtilities.IsMultiInstance)\r
+                {\r
+                    foreach (string file in removeFiles)\r
+                    {\r
+                        File.Delete(file);\r
+                    }\r
+                }\r
+\r
+                return queueFiles;\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                return new List<string>(); // Keep quiet about the error.\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Recover a queue from file.\r
+        /// </summary>\r
+        /// <param name="encodeQueue">\r
+        /// The encode Queue.\r
+        /// </param>\r
+        /// <param name="errorService">\r
+        /// The error Service.\r
+        /// </param>\r
+        public static void RecoverQueue(IQueueProcessor encodeQueue, IErrorService errorService)\r
+        {\r
+            string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");\r
+            List<string> queueFiles = CheckQueueRecovery();\r
+            MessageBoxResult result = MessageBoxResult.None;\r
+            if (queueFiles.Count == 1)\r
+            {\r
+                result = errorService.ShowMessageBox(\r
+                        "HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?",\r
+                        "Queue Recovery Possible", MessageBoxButton.YesNo, MessageBoxImage.Question);\r
+            }\r
+            else if (queueFiles.Count > 1)\r
+            {\r
+                result = MessageBox.Show(\r
+                        "HandBrake has detected multiple unfinished queue files. These will be from multiple instances of HandBrake running. Would you like to recover all unfinished jobs?",\r
+                        "Queue Recovery Possible", MessageBoxButton.YesNo, MessageBoxImage.Question);\r
+            }\r
+\r
+            if (result == MessageBoxResult.Yes)\r
+            {\r
+                foreach (string file in queueFiles)\r
+                {\r
+                    encodeQueue.QueueManager.RestoreQueue(appDataPath + file); // Start Recovery\r
+                }\r
+            }\r
+            else\r
+            {\r
+                if (GeneralUtilities.IsMultiInstance) return; // Don't tamper with the files if we are multi instance\r
+\r
+                foreach (string file in queueFiles)\r
+                {\r
+                    if (File.Exists(Path.Combine(appDataPath, file)))\r
+                        File.Delete(Path.Combine(appDataPath, file));\r
+                }\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/win/CS/HandBrakeWPF/Helpers/UpdateCheckHelper.cs b/win/CS/HandBrakeWPF/Helpers/UpdateCheckHelper.cs
new file mode 100644 (file)
index 0000000..11917e7
--- /dev/null
@@ -0,0 +1,60 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="UpdateCheckHelper.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
+//   Update Check Helper\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Helpers\r
+{\r
+    using System;\r
+    using System.Windows;\r
+\r
+    using Caliburn.Micro;\r
+\r
+    using HandBrake.ApplicationServices.Model.General;\r
+    using HandBrake.ApplicationServices.Services;\r
+\r
+    using HandBrakeWPF.Services.Interfaces;\r
+\r
+    /// <summary>\r
+    /// Update Check Helper\r
+    /// </summary>\r
+    public class UpdateCheckHelper\r
+    {\r
+        /// <summary>\r
+        /// Handle the Update Check Finishing.\r
+        /// </summary>\r
+        /// <param name="result">\r
+        /// The result.\r
+        /// </param>\r
+        public static void UpdateCheckDoneMenu(IAsyncResult result)\r
+        {\r
+            // Make sure it's running on the calling thread\r
+            IErrorService errorService = IoC.Get<IErrorService>();\r
+            try\r
+            {\r
+                // Get the information about the new build, if any, and close the window\r
+                UpdateCheckInformation info = UpdateService.EndCheckForUpdates(result);\r
+\r
+                if (info.NewVersionAvailable)\r
+                {\r
+                    errorService.ShowMessageBox(\r
+                        "A New Update is Available", "Update available!", MessageBoxButton.OK, MessageBoxImage.Information);\r
+                }\r
+                else\r
+                {\r
+                    errorService.ShowMessageBox(\r
+                       "There is no new version at this time.", "No Updates", MessageBoxButton.OK, MessageBoxImage.Information);\r
+                }\r
+                return;\r
+            }\r
+            catch (Exception ex)\r
+            {\r
+                errorService.ShowError("Unable to check for updates", "Please try again later, the update service may currently be down.", ex);\r
+            }\r
+        }\r
+    }\r
+}\r
index 4f99720dbb47ca308114565409b6b4cddd8867e6..0472f9da26f28a70a776d203ac5e4b84820847ce 100644 (file)
@@ -72,7 +72,7 @@ namespace HandBrakeWPF.Services
             string base64Hash = Convert.ToBase64String(hash);\r
 \r
             // Compare the hash with the last known hash. If it's the same, return.\r
-            if (userSettingService.GetUserSetting<string>(UserSettingConstants.CliExeHash) == base64Hash)\r
+            if (userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeExeHash) == base64Hash)\r
             {\r
                 return;\r
             }\r
index ae3e35245621f1da9d39185cb9d1130ed1cf5d4d..ad0da6e70382bb3979a1c430869a2f94ebd473ff 100644 (file)
@@ -19,8 +19,8 @@ namespace HandBrakeWPF
         public const string Skipversion = "skipversion";\r
         public const string AutoNaming = "autoNaming";\r
         public const string AutoNamePath = "autoNamePath";\r
-        public const string Appcast = "appcast";\r
-        public const string Appcast_unstable = "appcast_unstable";\r
+        public const string Appcast_i686 = "appcast_i686";\r
+        public const string Appcast_x64 = "appcast_x64";\r
         public const string AutoNameFormat = "autoNameFormat";\r
         public const string VLC_Path = "VLC_Path";\r
         public const string MainWindowMinimize = "MainWindowMinimize";\r
@@ -34,7 +34,6 @@ namespace HandBrakeWPF
         public const string NativeLanguage = "NativeLanguage";\r
         public const string NativeLanguageForSubtitles = "NativeLanguageSubtitles";\r
         public const string DubMode = "DubMode";\r
-        public const string CliExeHash = "CliExeHash";\r
         public const string ClearOldLogs = "clearOldLogs";\r
         public const string AutoNameTitleCase = "AutoNameTitleCase";\r
         public const string AutoNameRemoveUnderscore = "AutoNameRemoveUnderscore";\r
index 51e032e9a132b1d0d930ad0dc48288a978ec3e6f..420443a5843f97868181c761d2d6b943e0235753 100644 (file)
@@ -23,7 +23,9 @@ namespace HandBrakeWPF.ViewModels
     using HandBrake.ApplicationServices;\r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Model.Encoding;\r
+    using HandBrake.ApplicationServices.Model.General;\r
     using HandBrake.ApplicationServices.Parsing;\r
+    using HandBrake.ApplicationServices.Services;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
     using HandBrake.ApplicationServices.Utilities;\r
 \r
@@ -67,6 +69,11 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         private readonly IErrorService errorService;\r
 \r
+        /// <summary>\r
+        /// Backing field for the user setting service.\r
+        /// </summary>\r
+        private readonly IUserSettingService userSettingService;\r
+\r
         /// <summary>\r
         /// HandBrakes Main Window Title\r
         /// </summary>\r
@@ -154,6 +161,7 @@ namespace HandBrakeWPF.ViewModels
             this.encodeService = encodeService;\r
             this.presetService = presetService;\r
             this.errorService = errorService;\r
+            this.userSettingService = userSettingService;\r
             this.queueProcessor = IoC.Get<IQueueProcessor>(); // TODO Instance ID!\r
 \r
             // Setup Properties\r
@@ -687,7 +695,14 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         public void CheckForUpdates()\r
         {\r
-            throw new NotImplementedException("Not Yet Implemented");\r
+            // TODO The update service needs refactoring.\r
+            this.userSettingService.SetUserSetting(UserSettingConstants.LastUpdateCheckDate, DateTime.Now);\r
+            string url = userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakePlatform).Contains("x86_64")\r
+                                                  ? userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_x64)\r
+                                                  : userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_i686);\r
+            UpdateService.BeginCheckForUpdates(UpdateCheckHelper.UpdateCheckDoneMenu, false,\r
+                url, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),\r
+                userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion));\r
         }\r
 \r
         /// <summary>\r
@@ -816,6 +831,26 @@ namespace HandBrakeWPF.ViewModels
 \r
         #region Main Window Public Methods\r
 \r
+        /// <summary>\r
+        /// Support dropping a file onto the main window to scan.\r
+        /// </summary>\r
+        /// <param name="e">\r
+        /// The DragEventArgs.\r
+        /// </param>\r
+        public void FilesDroppedOnWindow(DragEventArgs e)\r
+        {\r
+            if (e.Data.GetDataPresent(DataFormats.FileDrop))\r
+            {\r
+                string[] fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];\r
+                if (fileNames != null && fileNames.Count() >= 1 && File.Exists(fileNames[0]))\r
+                {\r
+                    this.StartScan(fileNames[0], 0);\r
+                }\r
+            }\r
+\r
+            e.Handled = true;\r
+        }\r
+\r
         /// <summary>\r
         /// The Destination Path\r
         /// </summary>\r
@@ -955,6 +990,17 @@ namespace HandBrakeWPF.ViewModels
             this.SelectedPreset = this.presetService.DefaultPreset;\r
         }\r
 \r
+        /// <summary>\r
+        /// Set the selected preset.\r
+        /// </summary>\r
+        /// <param name="e">\r
+        /// The RoutedPropertyChangedEventArgs.\r
+        /// </param>\r
+        public void SetSelectedPreset(RoutedPropertyChangedEventArgs<object> e)\r
+        {\r
+            this.SelectedPreset = e.NewValue as Preset;\r
+        }\r
+\r
         #endregion\r
 \r
         #region Private Methods\r
@@ -993,7 +1039,7 @@ namespace HandBrakeWPF.ViewModels
                         newExtension = this.CurrentTask.RequiresM4v ? ".m4v" : ".mp4";\r
                         break;\r
                     case 1: // MP4\r
-                        newExtension = ".mp4";  \r
+                        newExtension = ".mp4";\r
                         break;\r
                     case 2: // M4v\r
                         newExtension = ".m4v";\r
@@ -1070,23 +1116,22 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)\r
         {\r
-             Caliburn.Micro.Execute.OnUIThread(() =>\r
-                 {\r
-                     if (e.Successful)\r
-                     {\r
-                         this.scanService.SouceData.CopyTo(this.ScannedSource);\r
-                         this.NotifyOfPropertyChange("ScannedSource");\r
-                         this.NotifyOfPropertyChange("ScannedSource.Titles");\r
-                         this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault();\r
-                         this.JobContextService.CurrentSource = this.ScannedSource;\r
-                         this.JobContextService.CurrentTask = this.CurrentTask;\r
-                         this.SetupTabs();\r
-                     }\r
-\r
-                     this.SourceLabel = "Scan Completed";\r
-\r
-                 });\r
+            Caliburn.Micro.Execute.OnUIThread(() =>\r
+                {\r
+                    if (e.Successful)\r
+                    {\r
+                        this.scanService.SouceData.CopyTo(this.ScannedSource);\r
+                        this.NotifyOfPropertyChange("ScannedSource");\r
+                        this.NotifyOfPropertyChange("ScannedSource.Titles");\r
+                        this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault()\r
+                                             ?? this.ScannedSource.Titles.FirstOrDefault();\r
+                        this.JobContextService.CurrentSource = this.ScannedSource;\r
+                        this.JobContextService.CurrentTask = this.CurrentTask;\r
+                        this.SetupTabs();\r
+                    }\r
 \r
+                    this.SourceLabel = "Scan Completed";\r
+                });\r
 \r
             // TODO Re-enable GUI.\r
         }\r
index 060d9ec383175c2a17a8c8ba0cadd616817da4f1..45ea7862b0ad8841be68a922501e5a5d4f958247 100644 (file)
@@ -73,13 +73,16 @@ namespace HandBrakeWPF.ViewModels
             this.JobStatus = "There are no jobs currently encoding";\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets QueueJobs.\r
+        /// </summary>\r
         public ObservableCollection<QueueTask> QueueJobs\r
         {\r
             get { return this.queueProcessor.QueueManager.Queue; }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets IsEncoding.\r
+        /// Gets or sets a value indicating whether IsEncoding.\r
         /// </summary>\r
         public bool IsEncoding\r
         {\r
@@ -178,6 +181,9 @@ namespace HandBrakeWPF.ViewModels
             this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);\r
         }\r
 \r
+        /// <summary>\r
+        /// Handle the On Window Load\r
+        /// </summary>\r
         public override void OnLoad()\r
         {\r
             this.queueProcessor.JobProcessingStarted += queueProcessor_JobProcessingStarted;\r
@@ -209,18 +215,45 @@ namespace HandBrakeWPF.ViewModels
             base.OnActivate();\r
         }\r
 \r
+        /// <summary>\r
+        /// Handle the Queue Paused Event\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The EventArgs.\r
+        /// </param>\r
         private void queueProcessor_QueuePaused(object sender, System.EventArgs e)\r
         {\r
             this.JobStatus = "Queue Paused";\r
             this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);\r
         }\r
 \r
+        /// <summary>\r
+        /// Handle the Queue Completed Event\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The EventArgs.\r
+        /// </param>\r
         private void queueProcessor_QueueCompleted(object sender, System.EventArgs e)\r
         {\r
             this.JobStatus = "Queue Completed";\r
             this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);\r
         }\r
 \r
+        /// <summary>\r
+        /// Handle teh Job Processing Started Event\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The QueueProgressEventArgs.\r
+        /// </param>\r
         private void queueProcessor_JobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)\r
         {\r
             this.JobStatus = "Queue Started";\r
@@ -228,6 +261,15 @@ namespace HandBrakeWPF.ViewModels
             this.queueProcessor.EncodeService.EncodeStatusChanged += EncodeService_EncodeStatusChanged;\r
         }\r
 \r
+        /// <summary>\r
+        /// Handle the Encode Status Changed Event.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The EncodeProgressEventArgs.\r
+        /// </param>\r
         private void EncodeService_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)\r
         {\r
             this.JobStatus = string.Format(\r
@@ -241,6 +283,15 @@ namespace HandBrakeWPF.ViewModels
                 e.ElapsedTime);\r
         }\r
 \r
+        /// <summary>\r
+        /// Handle the Queue Changed Event.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
         private void QueueManager_QueueChanged(object sender, System.EventArgs e)\r
         {\r
             // TODO\r
index 89093d2e24fb348bc620c6dd5c77843c5425a61b..c14d81b2d58a0ddae8724e37d84e6e2c3492689c 100644 (file)
@@ -29,6 +29,8 @@
             <ListBox.ItemContainerStyle>\r
                 <Style TargetType="ListBoxItem">\r
                     <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>\r
+                    <Setter Property="Background" Value="WhiteSmoke" />\r
+                    <Setter Property="Margin" Value="0,0,0,1" />\r
                 </Style>\r
             </ListBox.ItemContainerStyle>\r
 \r
index a92948ce2eb7f49cf4e5a7d519ff8ab09b728203..1ec10a8304da7a3c1b469a643d54fa0e11c35f91 100644 (file)
@@ -3,7 +3,16 @@
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Data="clr-namespace:System.Windows.Data;assembly=PresentationFramework" \r
         xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"\r
         xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"\r
-        Title="{Data:Binding Path=WindowTitle}" Height="655" Width="1015" FontSize="11" Background="#FFF0F0F0">\r
+        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" Title="{Data:Binding Path=WindowTitle}" Height="655" Width="1015" FontSize="11" Background="#FFF0F0F0"\r
+        AllowDrop="True">\r
+\r
+    <i:Interaction.Triggers>\r
+        <i:EventTrigger EventName="Drop">\r
+            <Micro:ActionMessage MethodName="FilesDroppedOnWindow">\r
+                <Micro:Parameter Value="$eventArgs"></Micro:Parameter>\r
+            </Micro:ActionMessage>\r
+        </i:EventTrigger>\r
+    </i:Interaction.Triggers>\r
 \r
     <Window.Resources>\r
         <Style TargetType="Button">\r
                 <StackPanel Margin="5,5,5,5" Orientation="Vertical">\r
                     <GroupBox Header="Presets" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">\r
                         <StackPanel Orientation="Vertical">\r
-                            <TreeView ItemsSource="{Binding Presets}" Width="240" Height="460" SelectedItemChanged="TreeView_SelectedItemChanged">\r
+                            <TreeView ItemsSource="{Binding Presets}" Width="240" Height="460">\r
+\r
+                                <i:Interaction.Triggers>\r
+                                    <i:EventTrigger EventName="SelectedItemChanged">\r
+                                        <Micro:ActionMessage MethodName="SetSelectedPreset">\r
+                                            <Micro:Parameter Value="$eventArgs"></Micro:Parameter>\r
+                                        </Micro:ActionMessage>\r
+                                    </i:EventTrigger>\r
+                                </i:Interaction.Triggers>\r
 \r
                             </TreeView>\r
 \r
index 347b835473371a0a71b5cfaf7e17010c572d77db..165e749231bddbcc1f97d322f80dd5928f6b3233 100644 (file)
@@ -11,10 +11,6 @@ namespace HandBrakeWPF.Views
 {\r
     using System.Windows;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
-\r
-    using HandBrakeWPF.ViewModels.Interfaces;\r
-\r
     /// <summary>\r
     /// Interaction logic for MainView.xaml\r
     /// </summary>\r
@@ -27,31 +23,5 @@ namespace HandBrakeWPF.Views
         {\r
             InitializeComponent();\r
         }\r
-\r
-        /// <summary>\r
-        /// Gets ViewModel.\r
-        /// </summary>\r
-        private IMainViewModel ViewModel\r
-        {\r
-            get\r
-            {\r
-                return ((IMainViewModel)this.DataContext);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Set the Selected Preset Property.\r
-        /// The SelectedItem property of a treeview is readonly.\r
-        /// </summary>\r
-        /// <param name="sender">\r
-        /// The sender.\r
-        /// </param>\r
-        /// <param name="e">\r
-        /// The RoutedPropertyChangedEventArgs.\r
-        /// </param>\r
-        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)\r
-        {\r
-            this.ViewModel.SelectedPreset = e.NewValue as Preset;\r
-        }\r
     }\r
 }\r
index c37c88a6a7621cb40f4fc75ebaae6c5fe9dd6d73..658b3d0c1214975b40f37532ae5854ea17f8cd9b 100644 (file)
@@ -10,6 +10,7 @@
 \r
     <Window.Resources>\r
         <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />\r
+        <Converters:FullPathToFileNameConverter x:Key="filePathToFilenameConverter" />\r
     </Window.Resources>\r
 \r
     <Grid >\r
         <ListBox Grid.Row="2" ItemsSource="{Binding QueueJobs}" SelectionMode="Extended" Background="LightGray" Margin="10,0,10,10">\r
             <ListBox.ItemContainerStyle>\r
                 <Style TargetType="ListBoxItem">\r
-                    <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>\r
+                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />\r
+                    <Setter Property="Background" Value="WhiteSmoke" />\r
+                    <Setter Property="Margin" Value="0,0,0,1" />\r
                 </Style>\r
             </ListBox.ItemContainerStyle>\r
-            \r
+\r
             <ListBox.ItemTemplate>\r
                 <DataTemplate>\r
 \r
-                    <Grid HorizontalAlignment="Stretch">\r
+                    <Grid HorizontalAlignment="Stretch" >\r
                         <Grid.ColumnDefinitions>\r
                             <ColumnDefinition Width="Auto" />\r
                             <ColumnDefinition Width="*" />\r
                         <Image Source="Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />\r
 \r
                         <!-- Settings -->\r
-                        <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">\r
-                            <StackPanel Orientation="Horizontal">\r
-                                <TextBlock Text="Source" FontWeight="Bold" />\r
-                                <TextBlock Text="{Binding Source}"/>\r
-                            </StackPanel>\r
-\r
-                            <StackPanel Orientation="Horizontal">\r
-                                <TextBlock Text="Destination" FontWeight="Bold" />\r
-                                <TextBlock Text="{Binding Source}"/>\r
+                            <StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,5,0,5">\r
+                                <StackPanel Orientation="Horizontal">\r
+                                    <TextBlock Text="Title: " FontWeight="Bold" />\r
+                                    <TextBlock Text="{Binding Task.Title}"/>\r
+\r
+                                    <TextBlock Text="{Binding Task.PointToPointMode}" FontWeight="Bold" Margin="10,0,0,0" />\r
+                                    <TextBlock Text=": "  />\r
+                                    <TextBlock Text="{Binding Task.StartPoint}"/>\r
+                                    <TextBlock Text="to" Margin="5,0,5,0" />\r
+                                    <TextBlock Text="{Binding Task.EndPoint}"/>\r
+                                </StackPanel>\r
+\r
+                                <!-- TODO Support Drive Label Name-->\r
+                                <StackPanel Orientation="Horizontal">\r
+                                    <TextBlock Text="Source: " FontWeight="Bold" />\r
+                                    <TextBlock Text="{Binding Task.Source, Converter={StaticResource filePathToFilenameConverter}}"/>\r
+                                </StackPanel>\r
+\r
+                                <StackPanel Orientation="Horizontal">\r
+                                    <TextBlock Text="Destination: " FontWeight="Bold" />\r
+                                    <TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}"/>\r
+                                </StackPanel>\r
                             </StackPanel>\r
-                        </StackPanel>\r
-\r
+         \r
                         <!-- Delete -->\r
                         <Image Source="Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">\r
                             <i:Interaction.Triggers>\r
@@ -84,7 +99,6 @@
                                 </i:EventTrigger>\r
                             </i:Interaction.Triggers>\r
                         </Image>\r
-\r
                     </Grid>\r
 \r
 \r
index 0e302fd4c45336c3a08acfd7f6a56f08d25ca693..1e49fc3c2dd2a876fbc526c196e77f69f015bea9 100644 (file)
@@ -30,6 +30,8 @@
             <ListBox.ItemContainerStyle>\r
                 <Style TargetType="ListBoxItem">\r
                     <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>\r
+                    <Setter Property="Background" Value="WhiteSmoke" />\r
+                    <Setter Property="Margin" Value="0,0,0,1" />\r
                 </Style>\r
             </ListBox.ItemContainerStyle>\r
 \r
index 876c5fa49e53881f0ea49e953fa6ea61b4708542..120902d2f514a01f45676910717f67e295f8ee01 100644 (file)
@@ -160,7 +160,7 @@ namespace Handbrake
                                                   ? userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_x64)\r
                                                   : userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_i686);\r
                     UpdateService.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDone), false, url, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),\r
-                        userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion), userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion));\r
+                        userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion));\r
                 }\r
             }\r
 \r
@@ -468,7 +468,7 @@ namespace Handbrake
                                                   : userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_i686);\r
             UpdateService.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDoneMenu), false,\r
                 url, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),\r
-                userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion), userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion));\r
+                userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion));\r
         }\r
 \r
         /// <summary>\r