\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
/// </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
/// <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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
<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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
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
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
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
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
/// </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
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
/// </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
\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
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
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
/// </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
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
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
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
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
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
<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
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
{\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
{\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
\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
</i:EventTrigger>\r
</i:Interaction.Triggers>\r
</Image>\r
-\r
</Grid>\r
\r
\r
<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
? 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
: 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