diff options
author | sr55 <[email protected]> | 2011-12-21 18:01:05 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-12-21 18:01:05 +0000 |
commit | 122ea23a9cc9b22313fee0648fa9831132074817 (patch) | |
tree | 84388224cf67ea970b3fcb4a1402439cab3444bc /win/CS | |
parent | ce0f63d8cb8bfacaf4fc139ac49eaf0775bb27e1 (diff) |
WinGui: (WPF) Some further work on the WPF GUI. Started to hook up presets.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4379 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/Interfaces/IPresetService.cs | 35 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs | 86 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 174 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/Add16.png | bin | 0 -> 595 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/Help32.png | bin | 0 -> 2531 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/Options24.png | bin | 0 -> 857 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 66 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml.cs | 30 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml | 4 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml.cs | 4 |
12 files changed, 393 insertions, 20 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IPresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IPresetService.cs index d5807aff9..81eaa6849 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IPresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IPresetService.cs @@ -20,6 +20,11 @@ namespace HandBrake.ApplicationServices.Services.Interfaces ObservableCollection<Preset> Presets { get; }
/// <summary>
+ /// Gets DefaultPreset.
+ /// </summary>
+ Preset DefaultPreset { get; }
+
+ /// <summary>
/// Add a new preset to the system
/// </summary>
/// <param name="preset">
@@ -32,6 +37,14 @@ namespace HandBrake.ApplicationServices.Services.Interfaces bool Add(Preset preset);
/// <summary>
+ /// Update a preset
+ /// </summary>
+ /// <param name="update">
+ /// The updated preset
+ /// </param>
+ void Update(Preset update);
+
+ /// <summary>
/// Remove a preset with a given name from either the built in or user preset list.
/// </summary>
/// <param name="preset">
@@ -69,11 +82,27 @@ namespace HandBrake.ApplicationServices.Services.Interfaces void ClearAll();
/// <summary>
- /// Reads the CLI's CLI output format and load's them into the preset List Preset
+ /// Set Default Preset
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ void SetDefault(Preset name);
+
+ /// <summary>
+ /// Returns a value if the preset can be updated / resaved
/// </summary>
- /// <param name="cliPath">
- /// The Path to the CLI, leave blank for current folder.
+ /// <param name="name">
+ /// The name.
/// </param>
+ /// <returns>
+ /// True if it's not a built-in preset, false otherwise.
+ /// </returns>
+ bool CanUpdatePreset(string name);
+
+ /// <summary>
+ /// Reads the CLI's CLI output format and load's them into the preset List Preset
+ /// </summary>
void UpdateBuiltInPresets();
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs new file mode 100644 index 000000000..81e12ddc8 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="BooleanToVisibilityConverter.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 BooleanToVisibilityConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters
+{
+ using System.Globalization;
+ using System.Windows;
+ using System.Windows.Data;
+ using System;
+
+ /// <summary>
+ /// Boolean to Visibility Converter
+ /// </summary>
+ public sealed class BooleanToVisibilityConverter : IValueConverter
+ {
+ /// <summary>
+ /// Convert a boolean to visibility property.
+ /// </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)
+ {
+ // Paramater is a boolean which inverts the output.
+ var param = System.Convert.ToBoolean(parameter, CultureInfo.InvariantCulture);
+
+ if (value is Boolean)
+ {
+ if (param)
+ {
+ return (bool)value ? Visibility.Collapsed : Visibility.Visible;
+ }
+ else
+ {
+ return (bool)value ? Visibility.Visible : Visibility.Collapsed;
+ }
+ }
+
+ return value;
+ }
+
+ /// <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 4772fd13f..cea841fe4 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -78,6 +78,7 @@ <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="Converters\BooleanToVisibilityConverter.cs" />
<Compile Include="Helpers\ListBoxHelper.cs" />
<Compile Include="Startup\CastleBootstrapper.cs" />
<Compile Include="Startup\MefBootstrapper.cs" />
@@ -224,6 +225,11 @@ <Content Include="defaultsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Resource Include="Views\Images\Close.png" />
+ <Resource Include="Views\Images\Help24.png" />
+ <Resource Include="Views\Images\Help32.png" />
+ <Resource Include="Views\Images\Add16.png" />
+ <Resource Include="Views\Images\Options24.png" />
<Resource Include="Views\Images\arrow_down.png" />
<Resource Include="Views\Images\arrow_left.png" />
<Resource Include="Views\Images\arrow_right.png" />
@@ -273,6 +279,7 @@ </ItemGroup>
<ItemGroup>
<Folder Include="Factories\" />
+ <Folder Include="Services\Interfaces\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs index 96519f42b..e9e2c4901 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs @@ -9,12 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Main Window View Model
/// </summary>
public interface IMainViewModel
{
/// <summary>
+ /// Sets SelectedPreset.
+ /// </summary>
+ Preset SelectedPreset { set; }
+
+ /// <summary>
/// Shutdown the Application
/// </summary>
void ExitApplication();
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index e939c5d52..c1b008613 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -17,18 +17,15 @@ namespace HandBrakeWPF.ViewModels using System.IO;
using System.Linq;
using System.Windows;
+ using System.Windows.Media;
using Caliburn.Micro;
- using Castle.Components.DictionaryAdapter;
-
using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Exceptions;
- using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
- using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -99,6 +96,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private string duration;
+ /// <summary>
+ /// Is Encoding Backing Field
+ /// </summary>
+ private bool isEncoding;
+
+ /// <summary>
+ /// Backing field for the selected preset.
+ /// </summary>
+ private Preset selectedPreset;
+
#endregion
/// <summary>
@@ -178,6 +185,22 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets or sets SelectedPreset.
+ /// </summary>
+ public Preset SelectedPreset
+ {
+ get
+ {
+ return this.selectedPreset;
+ }
+ set
+ {
+ this.selectedPreset = value;
+ this.NotifyOfPropertyChange("SelectedPreset");
+ }
+ }
+
+ /// <summary>
/// Gets or sets The Current Encode Task that the user is building
/// </summary>
public EncodeTask CurrentTask { get; set; }
@@ -309,6 +332,23 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets or sets a value indicating whether IsEncoding.
+ /// </summary>
+ public bool IsEncoding
+ {
+ get
+ {
+ return this.isEncoding;
+ }
+
+ set
+ {
+ this.isEncoding = value;
+ this.NotifyOfPropertyChange("IsEncoding");
+ }
+ }
+
/* Properties for User Selections */
/// <summary>
@@ -553,6 +593,7 @@ namespace HandBrakeWPF.ViewModels };
this.queueProcessor.QueueManager.Add(task);
this.queueProcessor.Start();
+ this.IsEncoding = true;
}
/// <summary>
@@ -601,6 +642,126 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange("CurrentTask");
}
+ /// <summary>
+ /// Add a Preset
+ /// </summary>
+ public void PresetAdd()
+ {
+ throw new NotImplementedException("Still to do this");
+ }
+
+ /// <summary>
+ /// Remove a Preset
+ /// </summary>
+ public void PresetRemove()
+ {
+ if (this.selectedPreset != null)
+ {
+ this.presetService.Remove(this.selectedPreset);
+ }
+ else
+ {
+ MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+
+ /// <summary>
+ /// Set a default preset
+ /// </summary>
+ public void PresetSetDefault()
+ {
+ if (this.selectedPreset != null)
+ {
+ this.presetService.SetDefault(this.selectedPreset);
+ MessageBox.Show(string.Format("New Default Preset Set: {0}", this.selectedPreset.Name), "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ else
+ {
+ MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+
+ /// <summary>
+ /// Import a Preset
+ /// </summary>
+ public void PresetImport()
+ {
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "Plist (*.plist)|*.plist", CheckFileExists = true };
+ dialog.ShowDialog();
+ string filename = dialog.FileName;
+
+ if (!string.IsNullOrEmpty(filename))
+ {
+ EncodeTask parsed = PlistPresetHandler.Import(filename);
+ if (this.presetService.CheckIfPresetExists(parsed.PresetName))
+ {
+ if (!presetService.CanUpdatePreset(parsed.PresetName))
+ {
+ MessageBox.Show(
+ "You can not import a preset with the same name as a built-in preset.",
+ "Error",
+ MessageBoxButton.OK,
+ MessageBoxImage.Error);
+ return;
+ }
+
+ MessageBoxResult result =
+ MessageBox.Show(
+ "This preset appears to already exist. Would you like to overwrite it?",
+ "Overwrite preset?",
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Warning);
+ if (result == MessageBoxResult.Yes)
+ {
+ Preset preset = new Preset
+ { Name = parsed.PresetName, CropSettings = parsed.UsesPictureSettings, Task = parsed };
+
+ presetService.Update(preset);
+ }
+ }
+ else
+ {
+ Preset preset = new Preset
+ { Name = parsed.PresetName, Task = parsed, CropSettings = parsed.UsesPictureSettings, };
+ presetService.Add(preset);
+ }
+
+ this.NotifyOfPropertyChange("Presets");
+ }
+ }
+
+ /// <summary>
+ /// Export a Preset
+ /// </summary>
+ public void PresetExport()
+ {
+ VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog { Filter = "plist|*.plist", CheckPathExists = true };
+ if (this.selectedPreset != null)
+ {
+ savefiledialog.ShowDialog();
+ string filename = savefiledialog.FileName;
+
+ if (filename != null)
+ {
+ PlistPresetHandler.Export(savefiledialog.FileName, this.selectedPreset);
+ }
+ }
+ else
+ {
+ MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+
+ /// <summary>
+ /// Reset built-in presets
+ /// </summary>
+ public void PresetReset()
+ {
+ this.presetService.UpdateBuiltInPresets();
+ this.NotifyOfPropertyChange("Presets");
+ this.SelectedPreset = this.presetService.DefaultPreset;
+ }
+
#endregion
#region Private Worker Methods
@@ -614,7 +775,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="title">
/// The title.
/// </param>
- public void StartScan(string filename, int title)
+ private void StartScan(string filename, int title)
{
// TODO
// 1. Disable GUI.
@@ -654,7 +815,6 @@ namespace HandBrakeWPF.ViewModels this.scanService.SouceData.CopyTo(this.ScannedSource);
this.NotifyOfPropertyChange("ScannedSource");
this.NotifyOfPropertyChange("ScannedSource.Titles");
- this.NotifyOfPropertyChange("T");
this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault();
}
@@ -738,6 +898,8 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void QueueCompleted(object sender, EventArgs e)
{
+ this.IsEncoding = false;
+
// TODO Handle Updating the UI
}
#endregion
diff --git a/win/CS/HandBrakeWPF/Views/Images/Add16.png b/win/CS/HandBrakeWPF/Views/Images/Add16.png Binary files differnew file mode 100644 index 000000000..bad13b66a --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/Add16.png diff --git a/win/CS/HandBrakeWPF/Views/Images/Help32.png b/win/CS/HandBrakeWPF/Views/Images/Help32.png Binary files differnew file mode 100644 index 000000000..e3dc78d0b --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/Help32.png diff --git a/win/CS/HandBrakeWPF/Views/Images/Options24.png b/win/CS/HandBrakeWPF/Views/Images/Options24.png Binary files differnew file mode 100644 index 000000000..ac5ca9678 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/Options24.png diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index a6649a268..483fbde1b 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -1,6 +1,7 @@ <Window x:Class="HandBrakeWPF.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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" xmlns:Controls="clr-namespace:HandBrakeWPF.Views.Controls"
Title="{Data:Binding Path=WindowTitle}" Height="655" Width="1015" FontSize="11" Background="#FFF0F0F0">
@@ -12,6 +13,14 @@ <Setter Property="FontSize" Value="11.5" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
+
+ <Style x:Key="textBlockOrangeStyle" TargetType="TextBlock">
+ <Setter Property="Foreground" Value="DarkOrange" />
+ <Setter Property="FontWeight" Value="Bold" />
+ <Setter Property="Padding" Value="5,5" />
+ </Style>
+
+ <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
</Window.Resources>
<Grid>
@@ -75,13 +84,20 @@ <Separator />
- <Button Name="Start" Micro:Message.Attach="[Event Click] = [Action StartEncode]">
+ <Button Name="Start" Micro:Message.Attach="[Event Click] = [Action StartEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
<StackPanel Orientation="Horizontal">
<Image Source="Images/Play.png" Height="32" Width="32" />
<Label Content="Start" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Button>
+ <Button Name="Stop" Micro:Message.Attach="[Event Click] = [Action StopEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
+ <StackPanel Orientation="Horizontal">
+ <Image Source="Images/stop.png" Height="32" Width="32" />
+ <Label Content="Stop" Margin="8,0,0,0" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+
<Button Name="AddToQueue">
<StackPanel Orientation="Horizontal">
<Image Source="Images/AddToQueue.png" Height="32" Width="32" />
@@ -306,15 +322,51 @@ <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" >
+ <TreeView ItemsSource="{Binding Presets}" Width="240" Height="460" SelectedItemChanged="TreeView_SelectedItemChanged">
</TreeView>
- <StackPanel Orientation="Horizontal">
- <Button Content="Add" Margin="5,5,5,5" />
- <Button Content="Remove" Margin="5,5,5,5" />
- <Button Content="Set Default" Margin="5,5,5,5" />
- </StackPanel>
+
+ <ToolBar Name="presetsToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" UseLayoutRounding="False" Background="Transparent"
+ SnapsToDevicePixels="False">
+ <Button Micro:Message.Attach="[Event Click] = [Action PresetAdd]">
+ <Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <Image Source="Images/Add16.png" Height="16" Width="16" />
+ <TextBlock Text="Add" Style="{StaticResource textBlockOrangeStyle}" Margin="2,0,0,0" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button.Content>
+ </Button>
+
+ <Button Micro:Message.Attach="[Event Click] = [Action PresetRemove]">
+ <Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <Image Source="Images/Close.png" Height="16" Width="16" />
+ <TextBlock Text="Remove" Style="{StaticResource textBlockOrangeStyle}" Margin="2,0,0,0" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button.Content>
+ </Button>
+
+ <Menu Background="Transparent" >
+ <MenuItem ToolBar.OverflowMode="Never">
+ <MenuItem.Header>
+ <StackPanel Orientation="Horizontal">
+ <Image Source="Images/Options24.png" Height="16" Width="16" />
+ <TextBlock Text="Options" Style="{StaticResource textBlockOrangeStyle}" Margin="2,0,0,0" VerticalAlignment="Center" />
+ </StackPanel>
+ </MenuItem.Header>
+
+ <MenuItem Header="Set Default" Micro:Message.Attach="[Event Click] = [Action PresetSetDefault]" />
+ <Separator />
+ <MenuItem Header="Import" Micro:Message.Attach="[Event Click] = [Action PresetImport]" />
+ <MenuItem Header="Export" Micro:Message.Attach="[Event Click] = [Action PresetExport]" />
+ <Separator />
+ <MenuItem Header="Reset Built-in Presets" Micro:Message.Attach="[Event Click] = [Action PresetReset]" />
+ </MenuItem>
+ </Menu>
+
+
+ </ToolBar>
</StackPanel>
</GroupBox>
</StackPanel>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs index 165e74923..347b83547 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs @@ -11,6 +11,10 @@ namespace HandBrakeWPF.Views {
using System.Windows;
+ using HandBrake.ApplicationServices.Model;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
/// <summary>
/// Interaction logic for MainView.xaml
/// </summary>
@@ -23,5 +27,31 @@ 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 f3fae9b26..8007ae889 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -1,4 +1,4 @@ -<UserControl x:Class="HandBrakeWPF.Views.QueueView"
+<Window x:Class="HandBrakeWPF.Views.QueueView"
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"
@@ -8,4 +8,4 @@ <Grid Background="Beige">
</Grid>
-</UserControl>
+</Window>
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs b/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs index 7b6fa9fdf..f4af15fc3 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs @@ -9,12 +9,12 @@ namespace HandBrakeWPF.Views
{
- using System.Windows.Controls;
+ using System.Windows;
/// <summary>
/// Interaction logic for VideoView.xaml
/// </summary>
- public partial class QueueView : UserControl
+ public partial class QueueView : Window
{
/// <summary>
/// Initializes a new instance of the <see cref="QueueView"/> class.
|