<Compile Include="Converters\Audio\AudioEncoderConverter.cs" />\r
<Compile Include="Converters\BooleanToHiddenVisibilityConverter.cs" />\r
<Compile Include="Converters\Video\VideoEncoderConverter.cs" />\r
+ <Compile Include="Model\ShellWindow.cs" />\r
+ <Compile Include="Views\ShellView.xaml.cs">\r
+ <DependentUpon>ShellView.xaml</DependentUpon>\r
+ </Compile>\r
+ <Compile Include="ViewModels\Interfaces\IShellViewModel.cs" />\r
<Compile Include="ViewModels\Interfaces\ITitleSpecificViewModel.cs" />\r
+ <Compile Include="ViewModels\ShellViewModel.cs" />\r
<Compile Include="ViewModels\TitleSpecificViewModel.cs" />\r
<Compile Include="Views\TitleSpecificView.xaml.cs">\r
<DependentUpon>TitleSpecificView.xaml</DependentUpon>\r
<SubType>Designer</SubType>\r
<Generator>MSBuild:Compile</Generator>\r
</Page>\r
+ <Page Include="Views\ShellView.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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="ShellWindow.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 Window that the shell view can display\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Model\r
+{\r
+ /// <summary>\r
+ /// The Window that the shell view can display\r
+ /// </summary>\r
+ public enum ShellWindow\r
+ {\r
+ MainWindow,\r
+ OptionsWindow\r
+ }\r
+}\r
/// <summary>\r
/// The Castle Bootstrapper\r
/// </summary>\r
- public class CastleBootstrapper : Bootstrapper<IMainViewModel>\r
+ public class CastleBootstrapper : Bootstrapper<IShellViewModel>\r
{\r
/// <summary>\r
/// The Windsor Container\r
this.windsorContainer.Register(Component.For<IErrorService>().ImplementedBy<ErrorService>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<IErrorViewModel>().ImplementedBy<ErrorViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<IMainViewModel>().ImplementedBy<MainViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
+ this.windsorContainer.Register(Component.For<IShellViewModel>().ImplementedBy<ShellViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<IQueueViewModel>().ImplementedBy<QueueViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
this.windsorContainer.Register(Component.For<IAddPresetViewModel>().ImplementedBy<AddPresetViewModel>().LifeStyle.Is(LifestyleType.Transient));\r
this.windsorContainer.Register(Component.For<IPreviewViewModel>().ImplementedBy<PreviewViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="IShellViewModel.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 Interface for the Shell View Model\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels.Interfaces\r
+{\r
+ using HandBrakeWPF.Model;\r
+\r
+ /// <summary>\r
+ /// The Interface for the Shell View Model\r
+ /// </summary>\r
+ public interface IShellViewModel\r
+ {\r
+ /// <summary>\r
+ /// Change the page displayed on this window.\r
+ /// </summary>\r
+ /// <param name="window">\r
+ /// The window.\r
+ /// </param>\r
+ void DisplayWindow(ShellWindow window);\r
+ }\r
+}\r
using HandBrake.ApplicationServices.Utilities;\r
\r
using HandBrakeWPF.Helpers;\r
+ using HandBrakeWPF.Model;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
+ using HandBrakeWPF.Views;\r
\r
using Ookii.Dialogs.Wpf;\r
\r
/// </summary>\r
private readonly IErrorService errorService;\r
\r
+ /// <summary>\r
+ /// The Shell View Model\r
+ /// </summary>\r
+ private readonly IShellViewModel shellViewModel;\r
+\r
/// <summary>\r
/// Backing field for the user setting service.\r
/// </summary>\r
/// <param name="errorService">\r
/// The Error Service\r
/// </param>\r
+ /// <param name="shellViewModel">\r
+ /// The shell View Model.\r
+ /// </param>\r
[ImportingConstructor]\r
public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,\r
- IErrorService errorService)\r
+ IErrorService errorService, IShellViewModel shellViewModel)\r
{\r
this.scanService = scanService;\r
this.encodeService = encodeService;\r
this.presetService = presetService;\r
this.errorService = errorService;\r
+ this.shellViewModel = shellViewModel;\r
this.userSettingService = userSettingService;\r
this.queueProcessor = IoC.Get<IQueueProcessor>(); // TODO Instance ID!\r
\r
/// </summary>\r
public void OpenOptionsWindow()\r
{\r
- this.WindowManager.ShowWindow(IoC.Get<IOptionsViewModel>());\r
+ this.shellViewModel.DisplayWindow(ShellWindow.OptionsWindow);\r
}\r
\r
/// <summary>\r
using HandBrake.ApplicationServices.Services.Interfaces;\r
using HandBrake.ApplicationServices.Utilities;\r
\r
+ using HandBrakeWPF.Model;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
using Ookii.Dialogs.Wpf;\r
/// </summary>\r
private readonly IUserSettingService userSettingService;\r
\r
+ /// <summary>\r
+ /// The Shell View Model\r
+ /// </summary>\r
+ private readonly IShellViewModel shellViewModel;\r
+\r
/// <summary>\r
/// The add audio mode options.\r
/// </summary>\r
/// <param name="userSettingService">\r
/// The user Setting Service.\r
/// </param>\r
- public OptionsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)\r
+ /// <param name="shellViewModel">\r
+ /// The shell View Model.\r
+ /// </param>\r
+ public OptionsViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IShellViewModel shellViewModel)\r
{\r
this.Title = "Options";\r
this.userSettingService = userSettingService;\r
+ this.shellViewModel = shellViewModel;\r
this.OnLoad();\r
}\r
\r
public void Close()\r
{\r
this.Save();\r
- this.TryClose(); \r
+ this.shellViewModel.DisplayWindow(ShellWindow.MainWindow);\r
}\r
\r
/// <summary>\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="ShellViewModel.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 Shell View Model\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels\r
+{\r
+ using System.ComponentModel.Composition;\r
+\r
+ using HandBrakeWPF.Model;\r
+ using HandBrakeWPF.ViewModels.Interfaces;\r
+\r
+ /// <summary>\r
+ /// The Shell View Model\r
+ /// </summary>\r
+ [Export(typeof(IShellViewModel))]\r
+ public class ShellViewModel : ViewModelBase, IShellViewModel\r
+ {\r
+ #region Constants and Fields\r
+\r
+ /// <summary>\r
+ /// The show main window.\r
+ /// </summary>\r
+ private bool showMainWindow;\r
+\r
+ /// <summary>\r
+ /// The show options.\r
+ /// </summary>\r
+ private bool showOptions;\r
+\r
+ #endregion\r
+\r
+ /// <summary>\r
+ /// Initializes a new instance of the <see cref="ShellViewModel"/> class.\r
+ /// </summary>\r
+ public ShellViewModel()\r
+ {\r
+ this.showMainWindow = true;\r
+ this.showOptions = false;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Change the page displayed on this window.\r
+ /// </summary>\r
+ /// <param name="window">\r
+ /// The window.\r
+ /// </param>\r
+ public void DisplayWindow(ShellWindow window)\r
+ {\r
+ if (window == ShellWindow.MainWindow)\r
+ {\r
+ this.ShowMainWindow = true;\r
+ this.ShowOptions = false;\r
+ }\r
+ else if (window == ShellWindow.OptionsWindow)\r
+ {\r
+ this.ShowOptions = true;\r
+ this.ShowMainWindow = false;\r
+ } \r
+ else\r
+ {\r
+ this.ShowMainWindow = true;\r
+ this.ShowOptions = false;\r
+ }\r
+ }\r
+\r
+ #region Properties\r
+\r
+ /// <summary>\r
+ /// Gets or sets MainViewModel.\r
+ /// </summary>\r
+ public IMainViewModel MainViewModel { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets OptionsViewModel.\r
+ /// </summary>\r
+ public IOptionsViewModel OptionsViewModel { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether ShowMainWindow.\r
+ /// </summary>\r
+ public bool ShowMainWindow\r
+ {\r
+ get\r
+ {\r
+ return this.showMainWindow;\r
+ }\r
+ set\r
+ {\r
+ this.showMainWindow = value;\r
+ this.NotifyOfPropertyChange(() => this.ShowMainWindow);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether ShowOptions.\r
+ /// </summary>\r
+ public bool ShowOptions\r
+ {\r
+ get\r
+ {\r
+ return this.showOptions;\r
+ }\r
+ set\r
+ {\r
+ this.showOptions = value;\r
+ this.NotifyOfPropertyChange(() => this.ShowOptions);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets WindowTitle.\r
+ /// </summary>\r
+ public string WindowTitle\r
+ {\r
+ get\r
+ {\r
+ return "HandBrake";\r
+ }\r
+ }\r
+\r
+ #endregion\r
+ }\r
+}
\ No newline at end of file
-<Window x:Class="HandBrakeWPF.Views.MainView"\r
+<UserControl x:Class="HandBrakeWPF.Views.MainView"\r
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
xmlns:Controls="clr-namespace:HandBrakeWPF.Controls"\r
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"\r
- xmlns:Data="clr-namespace:System.Windows.Data;assembly=PresentationFramework"\r
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"\r
xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"\r
- Title="{Data:Binding Path=WindowTitle}"\r
- Width="1015"\r
- Height="652"\r
- MinWidth="1015"\r
- MinHeight="652"\r
AllowDrop="True"\r
Background="#FFF0F0F0"\r
FontSize="11"\r
Micro:Message.Attach="[Event Loaded] = [Action Load]"\r
SnapsToDevicePixels="True"\r
UseLayoutRounding="True"\r
- WindowStartupLocation="CenterScreen"\r
>\r
\r
<i:Interaction.Triggers>\r
</i:EventTrigger>\r
</i:Interaction.Triggers>\r
\r
- <Window.Resources>\r
+ <UserControl.Resources>\r
\r
<Style TargetType="Button">\r
<Setter Property="Foreground" Value="DarkOrange" />\r
</Style>\r
\r
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />\r
- </Window.Resources>\r
+ </UserControl.Resources>\r
\r
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">\r
<Grid.RowDefinitions>\r
\r
</StatusBar>\r
</Grid>\r
-</Window>\r
+</UserControl>\r
\r
namespace HandBrakeWPF.Views\r
{\r
- using System.Windows;\r
+ using System.Windows.Controls;\r
\r
/// <summary>\r
/// Interaction logic for MainView.xaml\r
/// </summary>\r
- public partial class MainView : Window\r
+ public partial class MainView : UserControl\r
{\r
/// <summary>\r
/// Initializes a new instance of the <see cref="MainView"/> class.\r
-<Window x:Class="HandBrakeWPF.Views.OptionsView"\r
+<UserControl x:Class="HandBrakeWPF.Views.OptionsView"\r
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.caliburnproject.org"\r
- xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers" Title="{Binding Title}" MinWidth="620" SizeToContent="Height" Width="620">\r
+ xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers" >\r
\r
- <Window.Resources>\r
+ <UserControl.Resources>\r
<Style TargetType="Button">\r
<Setter Property="Foreground" Value="DarkOrange" />\r
<Setter Property="FontWeight" Value="Bold" />\r
<Style TargetType="CheckBox">\r
<Setter Property="Margin" Value="0,0,0,5" />\r
</Style>\r
- </Window.Resources>\r
-\r
-\r
- <StackPanel Orientation="Vertical" Background="#FFF1F0EF">\r
+ </UserControl.Resources>\r
+\r
+ <Grid Background="#FFF1F0EF">\r
+ <Grid.RowDefinitions>\r
+ <RowDefinition Height="Auto" />\r
+ <RowDefinition Height="*" />\r
+ <RowDefinition Height="Auto" />\r
+ </Grid.RowDefinitions>\r
+ \r
<!-- Header -->\r
- <StackPanel Orientation="Horizontal" Background="White" Height="50" >\r
+ <StackPanel Orientation="Horizontal" Background="White" Height="50" Grid.Row="0" >\r
<Image Source="Images/Preferences.png" Margin="10,0,5,0" Width="32" Height="32" VerticalAlignment="Center" />\r
<StackPanel Orientation="Vertical" VerticalAlignment="Center">\r
<TextBlock Text="Options" FontWeight="Bold" />\r
</StackPanel>\r
\r
<!-- Options Panel-->\r
- <TabControl Margin="10,10,10,10" Height="405">\r
+ <TabControl Margin="10,10,10,10" MinHeight="410" Grid.Row="1">\r
<TabItem Header="General">\r
<StackPanel Orientation="Vertical">\r
<Grid Margin="10,10,0,10">\r
</TabItem>\r
</TabControl>\r
\r
- <StackPanel HorizontalAlignment="Stretch" Background="LightGray" >\r
- <Button Content="Close" IsDefault="True" cal:Message.Attach="[Event Click] = [Action Close]"\r
- HorizontalAlignment="Right" Padding="10,2" Margin="0,5,10,5" />\r
+ <StackPanel HorizontalAlignment="Stretch" Background="LightGray" Grid.Row="2" >\r
+ <Button Content="Save Changes" IsDefault="True" cal:Message.Attach="[Event Click] = [Action Close]"\r
+ HorizontalAlignment="Center" Padding="12,2" Margin="0,5,10,5" />\r
</StackPanel>\r
- \r
\r
\r
- </StackPanel>\r
-</Window>\r
+ </Grid>\r
+</UserControl>\r
namespace HandBrakeWPF.Views\r
{\r
using System.Windows;\r
+ using System.Windows.Controls;\r
\r
/// <summary>\r
/// Interaction logic for OptionsView.xaml\r
/// </summary>\r
- public partial class OptionsView : Window\r
+ public partial class OptionsView : UserControl\r
{\r
/// <summary>\r
/// Initializes a new instance of the <see cref="OptionsView"/> class.\r
--- /dev/null
+<Window x:Class="HandBrakeWPF.Views.ShellView"\r
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+ xmlns:Data="clr-namespace:System.Windows.Data;assembly=PresentationFramework"\r
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" Title="{Data:Binding Path=WindowTitle}"\r
+ Width="1015"\r
+ Height="652"\r
+ MinWidth="1015"\r
+ MinHeight="652"\r
+ AllowDrop="True"\r
+ Background="#FFF0F0F0"\r
+ FontSize="11"\r
+ SnapsToDevicePixels="True"\r
+ UseLayoutRounding="True"\r
+ WindowStartupLocation="CenterScreen"\r
+ >\r
+ <Window.Resources>\r
+ <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />\r
+ </Window.Resources>\r
+ \r
+ <Grid>\r
+ <ContentControl x:Name="MainViewModel" Visibility="{Binding ShowMainWindow, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />\r
+ <ContentControl x:Name="OptionsViewModel" Visibility="{Binding ShowOptions, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />\r
+ </Grid>\r
+</Window>\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="ShellView.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 ShellView.xaml\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Views\r
+{\r
+ using System.Windows;\r
+\r
+ /// <summary>\r
+ /// Interaction logic for ShellView.xaml\r
+ /// </summary>\r
+ public partial class ShellView : Window\r
+ {\r
+ /// <summary>\r
+ /// Initializes a new instance of the <see cref="ShellView"/> class.\r
+ /// </summary>\r
+ public ShellView()\r
+ {\r
+ this.InitializeComponent();\r
+ }\r
+ }\r
+}\r