namespace HandBrake.ApplicationServices.Services.Interfaces\r
{\r
using System;\r
+ using System.Windows.Media.Imaging;\r
\r
using HandBrake.ApplicationServices.EventArgs;\r
using HandBrake.ApplicationServices.Model;\r
/// </param>\r
void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuration);\r
\r
+ /// <summary>\r
+ /// Get a Preview image for the current job and preview number.\r
+ /// </summary>\r
+ /// <param name="task">\r
+ /// The task.\r
+ /// </param>\r
+ /// <param name="preview">\r
+ /// The preview.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="BitmapImage"/>.\r
+ /// </returns>\r
+ BitmapImage GetPreview(EncodeTask task, int preview);\r
+\r
/// <summary>\r
/// Kill the scan\r
/// </summary>\r
using System.Collections.Generic;\r
using System.IO;\r
using System.Text;\r
+ using System.Windows.Media.Imaging;\r
\r
using HandBrake.ApplicationServices.EventArgs;\r
using HandBrake.ApplicationServices.Model;\r
using HandBrake.Interop;\r
using HandBrake.Interop.EventArgs;\r
using HandBrake.Interop.Interfaces;\r
+ using HandBrake.Interop.Model;\r
\r
using AudioTrack = HandBrake.ApplicationServices.Parsing.Audio;\r
using ScanProgressEventArgs = HandBrake.Interop.EventArgs.ScanProgressEventArgs;\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Get a Preview image for the current job and preview number.\r
+ /// </summary>\r
+ /// <param name="job">\r
+ /// The job.\r
+ /// </param>\r
+ /// <param name="preview">\r
+ /// The preview.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="BitmapImage"/>.\r
+ /// </returns>\r
+ public BitmapImage GetPreview(EncodeTask job, int preview)\r
+ {\r
+ if (this.instance == null)\r
+ {\r
+ return null;\r
+ }\r
+\r
+ EncodeJob encodeJob = InteropModelCreator.GetEncodeJob(job);\r
+ BitmapImage bitmapImage = this.instance.GetPreview(encodeJob, preview);\r
+ return bitmapImage;\r
+ }\r
+\r
#endregion\r
\r
#region Private Methods\r
public class InteropModelCreator\r
{\r
/// <summary>\r
- /// Get an EncodeJob model for a LibHB Encode.\r
+ /// The get encode job.\r
/// </summary>\r
/// <param name="task">\r
/// The task.\r
/// </param>\r
/// <returns>\r
- /// An Interop.EncodeJob model.\r
+ /// The <see cref="EncodeJob"/>.\r
/// </returns>\r
public static EncodeJob GetEncodeJob(QueueTask task)\r
{\r
return null;\r
}\r
\r
+ return GetEncodeJob(task.Task);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Get an EncodeJob model for a LibHB Encode.\r
+ /// </summary>\r
+ /// <param name="task">\r
+ /// The task.\r
+ /// </param>\r
+ /// <returns>\r
+ /// An Interop.EncodeJob model.\r
+ /// </returns>\r
+ public static EncodeJob GetEncodeJob(EncodeTask task)\r
+ {\r
// The current Job Configuration\r
- EncodeTask work = task.Task;\r
+ EncodeTask work = task;\r
\r
// Which will be converted to this EncodeJob Model.\r
EncodeJob job = new EncodeJob();\r
<Compile Include="Services\UserSettingService.cs" />\r
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />\r
<Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />\r
+ <Compile Include="ViewModels\Interfaces\IStaticPreviewViewModel.cs" />\r
+ <Compile Include="ViewModels\StaticPreviewViewModel.cs" />\r
<Compile Include="Views\CountdownAlertView.xaml.cs">\r
<DependentUpon>CountdownAlertView.xaml</DependentUpon>\r
</Compile>\r
<Compile Include="ViewModels\Interfaces\ITitleSpecificViewModel.cs" />\r
<Compile Include="ViewModels\ShellViewModel.cs" />\r
<Compile Include="ViewModels\TitleSpecificViewModel.cs" />\r
+ <Compile Include="Views\StaticPreviewView.xaml.cs">\r
+ <DependentUpon>StaticPreviewView.xaml</DependentUpon>\r
+ </Compile>\r
<Compile Include="Views\TitleSpecificView.xaml.cs">\r
<DependentUpon>TitleSpecificView.xaml</DependentUpon>\r
</Compile>\r
<SubType>Designer</SubType>\r
<Generator>MSBuild:Compile</Generator>\r
</Page>\r
+ <Page Include="Views\StaticPreviewView.xaml">\r
+ <SubType>Designer</SubType>\r
+ <Generator>MSBuild:Compile</Generator>\r
+ </Page>\r
<Page Include="Views\TitleSpecificView.xaml">\r
<SubType>Designer</SubType>\r
<Generator>MSBuild:Compile</Generator>\r
this.windsorContainer.Register(Component.For<ITitleSpecificViewModel>().ImplementedBy<TitleSpecificViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<IQueueSelectionViewModel>().ImplementedBy<QueueSelectionViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<ICountdownAlertViewModel>().ImplementedBy<CountdownAlertViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
- \r
+ \r
+ // Experimental Services and Windows.\r
this.windsorContainer.Register(Component.For<IInstantViewModel>().ImplementedBy<InstantViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
-\r
+ this.windsorContainer.Register(Component.For<IStaticPreviewViewModel>().ImplementedBy<StaticPreviewViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
+ \r
// Tab Components\r
this.windsorContainer.Register(Component.For<IAudioViewModel>().ImplementedBy<AudioViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<IX264ViewModel>().ImplementedBy<X264ViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="IStaticPreviewViewModel.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
+// The Static Preview View Model Interface\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels.Interfaces\r
+{\r
+ using System.Windows.Media.Imaging;\r
+\r
+ /// <summary>\r
+ /// The Static Preview View Model Interface\r
+ /// </summary>\r
+ public interface IStaticPreviewViewModel\r
+ {\r
+ /// <summary>\r
+ /// The preview frame.\r
+ /// </summary>\r
+ /// <param name="image">\r
+ /// The image.\r
+ /// </param>\r
+ void PreviewFrame(BitmapImage image);\r
+ }\r
+}\r
using System;\r
using System.Collections.Generic;\r
using System.Globalization;\r
+ using System.Windows.Media.Imaging;\r
\r
using Caliburn.Micro;\r
\r
/// <summary>\r
/// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.PictureSettingsViewModel"/> class.\r
/// </summary>\r
- /// <param name="windowManager">\r
- /// The window manager.\r
- /// </param>\r
- /// <param name="userSettingService">\r
- /// The user Setting Service.\r
- /// </param>\r
- public PictureSettingsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)\r
+ public PictureSettingsViewModel()\r
{\r
this.Task = new EncodeTask();\r
this.SelectedModulus = 16;\r
\r
#region Properties\r
\r
+ /// <summary>\r
+ /// Gets or sets the static preview view model.\r
+ /// </summary>\r
+ public IStaticPreviewViewModel StaticPreviewViewModel { get; set; }\r
+\r
/// <summary>\r
/// Gets AnamorphicModes.\r
/// </summary>\r
\r
#endregion\r
\r
- #region Implemented Interfaces\r
-\r
- #region ITabInterface\r
+ #region Public Methods\r
\r
/// <summary>\r
/// Setup this tab for the specified preset.\r
this.NotifyOfPropertyChange(() => this.Task);\r
}\r
\r
- #endregion\r
+ /// <summary>\r
+ /// The preview image.\r
+ /// Experimental Feature => In-Progress\r
+ /// </summary>\r
+ public void PreviewImage()\r
+ {\r
+ IScan scanService = IoC.Get<IScan>();\r
+ BitmapImage image = scanService.GetPreview(this.Task, 5);\r
+\r
+ if (image != null)\r
+ {\r
+ this.StaticPreviewViewModel.PreviewFrame(image);\r
+ this.WindowManager.ShowDialog(this.StaticPreviewViewModel);\r
+ }\r
+ }\r
\r
#endregion\r
\r
return job;\r
}\r
\r
- #endregion\r
+ #endregion\r
}\r
}
\ No newline at end of file
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="StaticPreviewViewModel.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
+// The Static Preview View Model\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels\r
+{\r
+ using System.Windows.Media.Imaging;\r
+\r
+ using HandBrakeWPF.ViewModels.Interfaces;\r
+\r
+ /// <summary>\r
+ /// The Static Preview View Model\r
+ /// </summary>\r
+ public class StaticPreviewViewModel : ViewModelBase, IStaticPreviewViewModel\r
+ {\r
+ /// <summary>\r
+ /// The preview image.\r
+ /// </summary>\r
+ private BitmapImage previewImage;\r
+\r
+ /// <summary>\r
+ /// Gets or sets the preview image.\r
+ /// </summary>\r
+ public BitmapImage PreviewImage\r
+ {\r
+ get\r
+ {\r
+ return this.previewImage;\r
+ }\r
+ set\r
+ {\r
+ if (Equals(value, this.previewImage))\r
+ {\r
+ return;\r
+ }\r
+\r
+ this.previewImage = value;\r
+ this.NotifyOfPropertyChange(() => this.PreviewImage);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// The preview frame.\r
+ /// </summary>\r
+ /// <param name="image">\r
+ /// The image.\r
+ /// </param>\r
+ public void PreviewFrame(BitmapImage image)\r
+ {\r
+ this.PreviewImage = image;\r
+ }\r
+ }\r
+}\r
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"\r
- xmlns:controls="clr-namespace:HandBrakeWPF.Controls">\r
+ xmlns:controls="clr-namespace:HandBrakeWPF.Controls"\r
+ xmlns:cal="http://www.caliburnproject.org">\r
\r
<UserControl.Resources>\r
<Converters:BooleanConverter x:Key="boolConverter" />\r
Visibility="{Binding ShowModulus, Converter={StaticResource boolToVisConverter}}"\r
Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />\r
</Grid>\r
- \r
+\r
<!-- Custom Anamoprhic -->\r
<Grid Margin="5,15,5,0" Visibility="{Binding ShowCustomAnamorphicControls, Converter={StaticResource boolToVisConverter}}">\r
<Grid.RowDefinitions>\r
<controls:NumberBox Width="60" Number="{Binding ParHeight, Mode=TwoWay}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" AllowEmpty="False"\r
IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5" />\r
</Grid>\r
- \r
+\r
<!-- Row 5-->\r
<Grid Margin="5,15,5,0">\r
<Grid.RowDefinitions>\r
\r
</Grid>\r
\r
+\r
+ <Label Content="Preview" FontWeight="Bold" Margin="15,0,0,0" Visibility="Collapsed" />\r
+ <Button Content="Show Preview" cal:Message.Attach="[Event Click] = [Action PreviewImage]" Visibility="Collapsed" />\r
+\r
</StackPanel>\r
</StackPanel>\r
</UserControl>\r
--- /dev/null
+<Window x:Class="HandBrakeWPF.Views.StaticPreviewView"\r
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" \r
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" \r
+ mc:Ignorable="d">\r
+ <Grid>\r
+ <Image Source="{Binding PreviewImage}" />\r
+ </Grid>\r
+</Window>\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="StaticPreviewView.xaml.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
+// Interaction logic for StaticPreviewView.xaml\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Views\r
+{\r
+ using System.Windows;\r
+\r
+ /// <summary>\r
+ /// Interaction logic for StaticPreviewView.xaml\r
+ /// </summary>\r
+ public partial class StaticPreviewView : Window\r
+ {\r
+ /// <summary>\r
+ /// Initializes a new instance of the <see cref="StaticPreviewView"/> class.\r
+ /// </summary>\r
+ public StaticPreviewView()\r
+ {\r
+ InitializeComponent();\r
+ }\r
+ }\r
+}\r