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