summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj9
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/ITitleSpecificViewModel.cs22
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs108
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/TitleSpecificViewModel.cs85
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml1
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs1
-rw-r--r--win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml27
-rw-r--r--win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml.cs27
9 files changed, 272 insertions, 9 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 94723903e..a27c42d96 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -110,6 +110,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="ViewModels\Interfaces\ITitleSpecificViewModel.cs" />
+ <Compile Include="ViewModels\TitleSpecificViewModel.cs" />
+ <Compile Include="Views\TitleSpecificView.xaml.cs">
+ <DependentUpon>TitleSpecificView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Converters\AdvancedVisibilityConverter.cs" />
<Compile Include="Converters\BooleanConverter.cs" />
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
@@ -246,6 +251,10 @@
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Page Include="Views\TitleSpecificView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\AboutView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index e43358e79..47bb3b356 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -63,6 +63,7 @@ namespace HandBrakeWPF.Startup
this.windsorContainer.Register(Component.For<IOptionsViewModel>().ImplementedBy<OptionsViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IUpdateVersionService>().ImplementedBy<UpdateVersionService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IJobContextService>().ImplementedBy<JobContextService>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<ITitleSpecificViewModel>().ImplementedBy<TitleSpecificViewModel>().LifeStyle.Is(LifestyleType.Singleton));
// Tab Components
this.windsorContainer.Register(Component.For<IAudioViewModel>().ImplementedBy<AudioViewModel>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITitleSpecificViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITitleSpecificViewModel.cs
new file mode 100644
index 000000000..dd7007230
--- /dev/null
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITitleSpecificViewModel.cs
@@ -0,0 +1,22 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ITitleSpecificViewModel.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 ITitleSpecificViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Title Specific View Model Interface
+ /// </summary>
+ public interface ITitleSpecificViewModel
+ {
+ /// <summary>
+ /// Gets SelectedTitle.
+ /// </summary>
+ int? SelectedTitle { get; }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 68f20cf85..ad60af389 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -266,12 +266,14 @@ namespace HandBrakeWPF.ViewModels
{
get
{
+ // TODO - Find a cleaner way of implementing this
+
BindingList<MenuItem> menuItems = new BindingList<MenuItem>();
// Folder Menu Item
MenuItem folderMenuItem = new MenuItem
{
- Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrakeWPF;component/Views/Images/folder.png")), Width = 16, Height = 16 },
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrake;component/Views/Images/folder.png")), Width = 16, Height = 16 },
Header = new TextBlock { Text = "Open Folder", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }
};
folderMenuItem.Click += this.folderMenuItem_Click;
@@ -280,19 +282,40 @@ namespace HandBrakeWPF.ViewModels
// File Menu Item
MenuItem fileMenuItem = new MenuItem
{
- Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrakeWPF;component/Views/Images/Movies.png")), Width = 16, Height = 16 },
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrake;component/Views/Images/Movies.png")), Width = 16, Height = 16 },
Header = new TextBlock { Text = "Open File", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }
};
fileMenuItem.Click += this.fileMenuItem_Click;
menuItems.Add(fileMenuItem);
+ // File Menu Item
+ MenuItem titleSpecific = new MenuItem {Header = new TextBlock { Text = "Title Specific Scan", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }};
+
+ MenuItem titleSpecificFolder = new MenuItem
+ {
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrake;component/Views/Images/folder.png")), Width = 16, Height = 16 },
+ Header = new TextBlock { Text = "Open Folder", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }
+ };
+ MenuItem titleSpecificFile = new MenuItem
+ {
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrake;component/Views/Images/Movies.png")), Width = 16, Height = 16 },
+ Header = new TextBlock { Text = "Open File", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }
+ };
+ titleSpecificFolder.Click += this.titleSpecificFolder_Click;
+ titleSpecificFile.Click += this.titleSpecificFile_Click;
+
+ titleSpecific.Items.Add(titleSpecificFolder);
+ titleSpecific.Items.Add(titleSpecificFile);
+
+ menuItems.Add(titleSpecific);
+
// Drives
foreach (DriveInformation item in GeneralUtilities.GetDrives())
{
MenuItem driveMenuItem = new MenuItem
{
- Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrakeWPF;component/Views/Images/disc_small.png")), Width = 16, Height = 16 },
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrake;component/Views/Images/disc_small.png")), Width = 16, Height = 16 },
Header = new TextBlock { Text = string.Format("{0} ({1})", item.RootDirectory, item.VolumeLabel), Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center },
Tag = item
};
@@ -817,6 +840,51 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Folder Scan
+ /// </summary>
+ public void FolderScanTitleSpecific()
+ {
+ VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true };
+ dialog.ShowDialog();
+
+ if (string.IsNullOrEmpty(dialog.SelectedPath))
+ {
+ return;
+ }
+
+ ITitleSpecificViewModel titleSpecificView = IoC.Get<ITitleSpecificViewModel>();
+ this.WindowManager.ShowDialog(titleSpecificView);
+
+ if (titleSpecificView.SelectedTitle.HasValue)
+ {
+ this.StartScan(dialog.SelectedPath, titleSpecificView.SelectedTitle.Value);
+ }
+ }
+
+ /// <summary>
+ /// File Scan
+ /// </summary>
+ public void FileScanTitleSpecific()
+ {
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" };
+ dialog.ShowDialog();
+
+ if (string.IsNullOrEmpty(dialog.FileName))
+ {
+ return;
+ }
+
+ ITitleSpecificViewModel titleSpecificView = IoC.Get<ITitleSpecificViewModel>();
+ this.WindowManager.ShowDialog(titleSpecificView);
+
+ if (titleSpecificView.SelectedTitle.HasValue)
+ {
+ this.StartScan(dialog.FileName, titleSpecificView.SelectedTitle.Value);
+ }
+ }
+
+
+ /// <summary>
/// Cancel a Scan
/// </summary>
public void CancelScan()
@@ -912,11 +980,6 @@ namespace HandBrakeWPF.ViewModels
MessageBoxImage.Information);
}
- public void SourceContextMenuOpening(MenuItem item)
- {
- Console.WriteLine(item);
- }
-
#endregion
#region Main Window Public Methods
@@ -1400,6 +1463,35 @@ namespace HandBrakeWPF.ViewModels
{
this.FolderScan();
}
+
+ /// <summary>
+ /// Title Specific Scan for File
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void titleSpecificFile_Click(object sender, RoutedEventArgs e)
+ {
+ this.FileScanTitleSpecific();
+ }
+
+ /// <summary>
+ /// Title Specific Scan for folder
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void titleSpecificFolder_Click(object sender, RoutedEventArgs e)
+ {
+ this.FolderScanTitleSpecific();
+ }
+
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/TitleSpecificViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/TitleSpecificViewModel.cs
new file mode 100644
index 000000000..06055dff1
--- /dev/null
+++ b/win/CS/HandBrakeWPF/ViewModels/TitleSpecificViewModel.cs
@@ -0,0 +1,85 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="TitleSpecificViewModel.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 TitleSpecificViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System.ComponentModel.Composition;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Title Specific View Model
+ /// </summary>
+ [Export(typeof(ITitleSpecificViewModel))]
+ public class TitleSpecificViewModel : ViewModelBase, ITitleSpecificViewModel
+ {
+ #region Constants and Fields
+
+ /// <summary>
+ /// The selected title.
+ /// </summary>
+ private int? selectedTitle;
+
+ #endregion
+
+ #region Constructors and Destructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TitleSpecificViewModel"/> class.
+ /// </summary>
+ public TitleSpecificViewModel()
+ {
+ this.SelectedTitle = 0;
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets or sets SelectedTitle.
+ /// </summary>
+ public int? SelectedTitle
+ {
+ get
+ {
+ return this.selectedTitle;
+ }
+
+ set
+ {
+ this.selectedTitle = value;
+ this.NotifyOfPropertyChange(() => this.SelectedTitle);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Cancel the request to scan.
+ /// </summary>
+ public void Cancel()
+ {
+ this.selectedTitle = null;
+ this.TryClose();
+ }
+
+ /// <summary>
+ /// Open the selected title.
+ /// </summary>
+ public void Open()
+ {
+ this.TryClose();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index 79cc340eb..15e01502a 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -121,6 +121,7 @@
<Label Content="Source" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</MenuItem.Header>
+
</MenuItem>
</Menu>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
index 057a35a5e..165e74923 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
@@ -9,7 +9,6 @@
namespace HandBrakeWPF.Views
{
- using System;
using System.Windows;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml b/win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml
new file mode 100644
index 000000000..4cb13468b
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml
@@ -0,0 +1,27 @@
+<Window x:Class="HandBrakeWPF.Views.TitleSpecificView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
+ xmlns:cal="http://www.caliburnproject.org" mc:Ignorable="d" Title="Scan Title"
+ Width="210" Height="130"
+ >
+ <Grid Margin="10">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="0,10,0,10">
+ <TextBlock Text="Scan title number:" />
+ <NumericUpDown:NumericUpDown Value="{Binding SelectedTitle, Mode=TwoWay}" Minimum="0" Maximum="1000" Width="60" Margin="10,0,0,0" />
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
+ <Button Name="Cancel" Content="Cancel" cal:Message.Attach="[Event Click] = [Action Cancel]" Margin="0,0,10,0" />
+ <Button Name="OpenTitle" Content="Open Title" cal:Message.Attach="[Event Click] = [Action Open]" />
+ </StackPanel>
+
+ </Grid>
+</Window>
diff --git a/win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml.cs b/win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml.cs
new file mode 100644
index 000000000..1f60792be
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/TitleSpecificView.xaml.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="TitleSpecificView.xaml.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>
+// Interaction logic for TitleSpecificView.xaml
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Views
+{
+ using System.Windows;
+
+ /// <summary>
+ /// Interaction logic for TitleSpecific.xaml
+ /// </summary>
+ public partial class TitleSpecificView : Window
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TitleSpecificView"/> class.
+ /// </summary>
+ public TitleSpecificView()
+ {
+ this.InitializeComponent();
+ }
+ }
+}