summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-01-31 15:19:14 +0000
committersr55 <[email protected]>2015-01-31 15:19:14 +0000
commit6d57e42b6b2cc38cf256f2970b23b94121e49479 (patch)
tree6841b6c50f50b6ac34bfa9dba954f959f030b480 /win/CS/HandBrakeWPF
parenta4416e99f06e31e1da8767d071e882f32c5a4e67 (diff)
WinGui: Remove a bunch of CLI handling code.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6840 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/App.xaml.cs11
-rw-r--r--win/CS/HandBrakeWPF/AppArguments.cs9
-rw-r--r--win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs5
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj9
-rw-r--r--win/CS/HandBrakeWPF/Installer/Installer64.nsi1
-rw-r--r--win/CS/HandBrakeWPF/Model/ShellWindow.cs1
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs34
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs1017
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IInstantViewModel.cs18
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs27
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs54
-rw-r--r--win/CS/HandBrakeWPF/Views/InstantView.xaml202
-rw-r--r--win/CS/HandBrakeWPF/Views/InstantView.xaml.cs27
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml2
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml.cs26
17 files changed, 27 insertions, 1422 deletions
diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs
index ce13693ab..e0bfd1bbf 100644
--- a/win/CS/HandBrakeWPF/App.xaml.cs
+++ b/win/CS/HandBrakeWPF/App.xaml.cs
@@ -53,12 +53,6 @@ namespace HandBrakeWPF
return;
}
- if (e.Args.Any(f => f.Equals("--instant")))
- {
- AppArguments.IsInstantHandBrake = true;
- MessageBox.Show("Instant HandBrake is just a prototype for toying with ideas. It may or may not work, or even be included in future builds.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
if (e.Args.Any(f => f.Equals("--reset")))
{
HandBrakeApp.ResetToDefaults();
@@ -66,11 +60,6 @@ namespace HandBrakeWPF
return;
}
- if (e.Args.Any(f => f.Equals("--enable-libhb")))
- {
- AppArguments.UseLibHb = true;
- }
-
base.OnStartup(e);
// If we have a file dropped on the icon, try scanning it.
diff --git a/win/CS/HandBrakeWPF/AppArguments.cs b/win/CS/HandBrakeWPF/AppArguments.cs
index ecd47fb35..c673a8fa1 100644
--- a/win/CS/HandBrakeWPF/AppArguments.cs
+++ b/win/CS/HandBrakeWPF/AppArguments.cs
@@ -14,14 +14,5 @@ namespace HandBrakeWPF
/// </summary>
public class AppArguments
{
- /// <summary>
- /// Gets or sets a value indicating whether is instant hand brake.
- /// </summary>
- public static bool IsInstantHandBrake { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether enable lib hb.
- /// </summary>
- public static bool UseLibHb { get; set; }
}
}
diff --git a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
index b27355df9..6cced25d4 100644
--- a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
+++ b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
@@ -96,11 +96,6 @@ namespace HandBrakeWPF.Commands
mainViewModel.FolderScan();
}
- if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.D)
- {
- mainViewModel.ShowCliQuery();
- }
-
if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.G)
{
GC.Collect();
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 3b84e37a6..13ba9c645 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -236,17 +236,12 @@
<Compile Include="Services\UpdateService.cs" />
<Compile Include="Services\PrePostActionService.cs" />
<Compile Include="ViewModels\AdvancedViewModel.cs" />
- <Compile Include="ViewModels\InstantViewModel.cs" />
- <Compile Include="ViewModels\Interfaces\IInstantViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IX264ViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IQueueSelectionViewModel.cs" />
<Compile Include="ViewModels\QueueSelectionViewModel.cs" />
<Compile Include="Views\AdvancedView.xaml.cs">
<DependentUpon>AdvancedView.xaml</DependentUpon>
</Compile>
- <Compile Include="Views\InstantView.xaml.cs">
- <DependentUpon>InstantView.xaml</DependentUpon>
- </Compile>
<Compile Include="Views\QueueSelectionView.xaml.cs">
<DependentUpon>QueueSelectionView.xaml</DependentUpon>
</Compile>
@@ -422,10 +417,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
- <Page Include="Views\InstantView.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
<Page Include="Views\QueueSelectionView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
diff --git a/win/CS/HandBrakeWPF/Installer/Installer64.nsi b/win/CS/HandBrakeWPF/Installer/Installer64.nsi
index c7052b05a..d81314a2e 100644
--- a/win/CS/HandBrakeWPF/Installer/Installer64.nsi
+++ b/win/CS/HandBrakeWPF/Installer/Installer64.nsi
@@ -132,7 +132,6 @@ Section "Handbrake" SEC01
; Install Files
File "Handbrake.exe"
- File "HandBrakeCLI.exe"
CreateDirectory "$SMPROGRAMS\Handbrake"
CreateShortCut "$SMPROGRAMS\Handbrake\Handbrake.lnk" "$INSTDIR\Handbrake.exe"
CreateShortCut "$DESKTOP\Handbrake.lnk" "$INSTDIR\Handbrake.exe"
diff --git a/win/CS/HandBrakeWPF/Model/ShellWindow.cs b/win/CS/HandBrakeWPF/Model/ShellWindow.cs
index bbb71625e..923b79cb5 100644
--- a/win/CS/HandBrakeWPF/Model/ShellWindow.cs
+++ b/win/CS/HandBrakeWPF/Model/ShellWindow.cs
@@ -16,6 +16,5 @@ namespace HandBrakeWPF.Model
{
MainWindow,
OptionsWindow,
- InstantMainWindow
}
}
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
index bfcf24fc4..b63b74078 100644
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -48,38 +48,30 @@ namespace HandBrakeWPF.Services
/// </param>
public EncodeServiceWrapper(IUserSettingService userSettingService)
{
- var useLibHb = true;
var useProcessIsolation =
userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
var port = userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);
- if (useLibHb)
+ try
{
- try
+ if (useProcessIsolation)
{
- if (useProcessIsolation)
- {
- this.encodeService = new IsolatedEncodeService(port);
- }
- else
- {
- this.encodeService = new LibEncode();
- }
+ this.encodeService = new IsolatedEncodeService(port);
}
- catch (Exception exc)
+ else
{
- // Try to recover from errors.
- throw new GeneralApplicationException(
- "Unable to initialise LibHB or Background worker service",
- "Falling back to using HandBrakeCLI.exe. Setting has been reset",
- exc);
+ this.encodeService = new LibEncode();
}
}
- else
+ catch (Exception exc)
{
- this.encodeService = new EncodeService();
+ // Try to recover from errors.
+ throw new GeneralApplicationException(
+ "Unable to initialise LibHB or Background worker service",
+ "HandBrake will not be able to operate correctly.",
+ exc);
}
-
+
this.encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
this.encodeService.EncodeStarted += this.EncodeServiceEncodeStarted;
this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
@@ -188,7 +180,7 @@ namespace HandBrakeWPF.Services
/// </summary>
public void Shutdown()
{
- this.encodeService.Shutdown();
+ this.encodeService.Stop();
this.encodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
this.encodeService.EncodeStarted -= this.EncodeServiceEncodeStarted;
this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index a812e4f08..10da855fa 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -86,7 +86,6 @@ namespace HandBrakeWPF.Startup
this.windsorContainer.Register(Component.For<ICountdownAlertViewModel>().ImplementedBy<CountdownAlertViewModel>().LifeStyle.Is(LifestyleType.Singleton));
// Experimental Services and Windows.
- this.windsorContainer.Register(Component.For<IInstantViewModel>().ImplementedBy<InstantViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IStaticPreviewViewModel>().ImplementedBy<StaticPreviewViewModel>().LifeStyle.Is(LifestyleType.Singleton));
// Tab Components
diff --git a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
deleted file mode 100644
index 003e2e2f1..000000000
--- a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
+++ /dev/null
@@ -1,1017 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="InstantViewModel.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>
-// The instant view model.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.ViewModels
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Threading;
- using System.Windows;
-
- using Caliburn.Micro;
-
- using HandBrake.ApplicationServices.EventArgs;
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Services.Encode.EventArgs;
- using HandBrake.ApplicationServices.Services.Encode.Interfaces;
- using HandBrake.ApplicationServices.Services.Interfaces;
- using HandBrake.ApplicationServices.Services.Scan.EventArgs;
- using HandBrake.ApplicationServices.Services.Scan.Interfaces;
- using HandBrake.ApplicationServices.Services.Scan.Model;
- using HandBrake.ApplicationServices.Utilities;
-
- using HandBrakeWPF.Commands;
- using HandBrakeWPF.Factories;
- using HandBrakeWPF.Model;
- using HandBrakeWPF.Services.Interfaces;
- using HandBrakeWPF.Services.Presets.Interfaces;
- using HandBrakeWPF.Services.Presets.Model;
- using HandBrakeWPF.Utilities;
- using HandBrakeWPF.ViewModels.Interfaces;
- using HandBrakeWPF.Views;
-
- using Microsoft.Win32;
-
- using Ookii.Dialogs.Wpf;
-
- /// <summary>
- /// The instant view model.
- /// </summary>
- public class InstantViewModel : ViewModelBase, IInstantViewModel
- {
- #region Constants and Fields
-
- /// <summary>
- /// The encode service.
- /// </summary>
- private readonly IEncodeServiceWrapper encodeService;
-
- /// <summary>
- /// The error service.
- /// </summary>
- private readonly IErrorService errorService;
-
- /// <summary>
- /// The preset service.
- /// </summary>
- private readonly IPresetService presetService;
-
- /// <summary>
- /// The queue processor.
- /// </summary>
- private readonly IQueueProcessor queueProcessor;
-
- /// <summary>
- /// The scan service.
- /// </summary>
- private readonly IScan scanService;
-
- /// <summary>
- /// The shell view model.
- /// </summary>
- private readonly IShellViewModel shellViewModel;
-
- /// <summary>
- /// The update service.
- /// </summary>
- private readonly IUpdateService updateService;
-
- /// <summary>
- /// The user setting service.
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// Windows 7 API Pack wrapper
- /// </summary>
- private readonly Win7 windowsSeven = new Win7();
-
- /// <summary>
- /// The is encoding.
- /// </summary>
- private bool isEncoding;
-
- /// <summary>
- /// The last percentage complete value.
- /// </summary>
- private int lastEncodePercentage;
-
- /// <summary>
- /// The ordered by duration.
- /// </summary>
- private bool orderedByDuration;
-
- /// <summary>
- /// The ordered by title.
- /// </summary>
- private bool orderedByTitle;
-
- /// <summary>
- /// The output directory.
- /// </summary>
- private string outputDirectory;
-
- /// <summary>
- /// The program status label.
- /// </summary>
- private string programStatusLabel;
-
- /// <summary>
- /// The scanned source.
- /// </summary>
- private Source scannedSource;
-
- /// <summary>
- /// The selected preset.
- /// </summary>
- private Preset selectedPreset;
-
- /// <summary>
- /// The show status window.
- /// </summary>
- private bool showStatusWindow;
-
- /// <summary>
- /// The source label.
- /// </summary>
- private string sourceLabel;
-
- /// <summary>
- /// The status label.
- /// </summary>
- private string statusLabel;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="InstantViewModel"/> class.
- /// </summary>
- /// <param name="userSettingService">
- /// The user setting service.
- /// </param>
- /// <param name="scanService">
- /// The scan service.
- /// </param>
- /// <param name="encodeService">
- /// The encode service.
- /// </param>
- /// <param name="presetService">
- /// The preset service.
- /// </param>
- /// <param name="errorService">
- /// The error service.
- /// </param>
- /// <param name="shellViewModel">
- /// The shell view model.
- /// </param>
- /// <param name="updateService">
- /// The update service.
- /// </param>
- /// <param name="notificationService">
- /// The notification service.
- /// </param>
- /// <param name="whenDoneService">
- /// The when done service.
- /// </param>
- public InstantViewModel(
- IUserSettingService userSettingService,
- IScan scanService,
- IEncodeServiceWrapper encodeService,
- IPresetService presetService,
- IErrorService errorService,
- IShellViewModel shellViewModel,
- IUpdateService updateService,
- INotificationService notificationService,
- IPrePostActionService whenDoneService)
- {
- this.userSettingService = userSettingService;
- this.scanService = scanService;
- this.encodeService = encodeService;
- this.presetService = presetService;
- this.errorService = errorService;
- this.shellViewModel = shellViewModel;
- this.updateService = updateService;
-
- this.queueProcessor = IoC.Get<IQueueProcessor>();
-
- // Setup Properties
- this.TitleList = new BindingList<SelectionTitle>();
- this.ScannedSource = new Source();
-
- // Setup Events
- this.scanService.ScanStared += this.ScanStared;
- this.scanService.ScanCompleted += this.ScanCompleted;
- this.scanService.ScanStatusChanged += this.ScanStatusChanged;
- this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
- this.queueProcessor.QueueCompleted += this.QueueCompleted;
- this.queueProcessor.QueueChanged += this.QueueChanged;
- this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
-
- this.Presets = this.presetService.Presets;
- this.CancelScanCommand = new CancelScanCommand(this.scanService);
- }
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets or sets the cancel scan command.
- /// </summary>
- public CancelScanCommand CancelScanCommand { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether IsEncoding.
- /// </summary>
- public bool IsEncoding
- {
- get
- {
- return this.isEncoding;
- }
-
- set
- {
- this.isEncoding = value;
- this.NotifyOfPropertyChange(() => this.IsEncoding);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether ordered by duration.
- /// </summary>
- public bool OrderedByDuration
- {
- get
- {
- return this.orderedByDuration;
- }
-
- set
- {
- this.orderedByDuration = value;
- this.NotifyOfPropertyChange(() => this.OrderedByDuration);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether ordered by title.
- /// </summary>
- public bool OrderedByTitle
- {
- get
- {
- return this.orderedByTitle;
- }
-
- set
- {
- this.orderedByTitle = value;
- this.NotifyOfPropertyChange(() => this.OrderedByTitle);
- }
- }
-
- /// <summary>
- /// Gets or sets the output directory.
- /// </summary>
- public string OutputDirectory
- {
- get
- {
- return this.outputDirectory;
- }
- set
- {
- this.outputDirectory = value;
- this.NotifyOfPropertyChange(() => this.OutputDirectory);
- }
- }
-
- /// <summary>
- /// Gets or sets Presets.
- /// </summary>
- public IEnumerable<Preset> Presets { get; set; }
-
- /// <summary>
- /// Gets or sets the Program Status Toolbar Label
- /// This indicates the status of HandBrake
- /// </summary>
- public string ProgramStatusLabel
- {
- get
- {
- return string.IsNullOrEmpty(this.programStatusLabel) ? "Ready" : this.programStatusLabel;
- }
-
- set
- {
- if (!Equals(this.programStatusLabel, value))
- {
- this.programStatusLabel = value;
- this.NotifyOfPropertyChange(() => this.ProgramStatusLabel);
- }
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating progress percentage.
- /// </summary>
- public int ProgressPercentage { get; set; }
-
- /// <summary>
- /// Gets or sets the Last Scanned Source
- /// This object contains information about the scanned source.
- /// </summary>
- public Source ScannedSource
- {
- get
- {
- return this.scannedSource;
- }
-
- set
- {
- this.scannedSource = value;
-
- this.NotifyOfPropertyChange("ScannedSource");
- }
- }
-
- /// <summary>
- /// Gets or sets SelectedPreset.
- /// </summary>
- public Preset SelectedPreset
- {
- get
- {
- return this.selectedPreset;
- }
- set
- {
- this.selectedPreset = value;
- this.NotifyOfPropertyChange(() => this.SelectedPreset);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether ShowStatusWindow.
- /// </summary>
- public bool ShowStatusWindow
- {
- get
- {
- return this.showStatusWindow;
- }
-
- set
- {
- this.showStatusWindow = value;
- this.NotifyOfPropertyChange(() => this.ShowStatusWindow);
- }
- }
-
- /// <summary>
- /// Gets or sets the Source Label
- /// This indicates the status of scans.
- /// </summary>
- public string SourceLabel
- {
- get
- {
- return string.IsNullOrEmpty(this.sourceLabel) ? "Select 'Source' to continue" : this.sourceLabel;
- }
-
- set
- {
- if (!Equals(this.sourceLabel, value))
- {
- this.sourceLabel = value;
- this.NotifyOfPropertyChange("SourceLabel");
- }
- }
- }
-
- /// <summary>
- /// Gets SourceName.
- /// </summary>
- public string SourceName
- {
- get
- {
- // Sanity Check
- if (this.ScannedSource == null || this.ScannedSource.ScanPath == null)
- {
- return string.Empty;
- }
-
- // The title that is selected has a source name. This means it's part of a batch scan.
- // if (selectedTitle != null && !string.IsNullOrEmpty(selectedTitle.SourceName))
- // {
- // return Path.GetFileNameWithoutExtension(selectedTitle.SourceName);
- // }
-
- // Check if we have a Folder, if so, check if it's a DVD / Bluray drive and get the label.
- if (this.ScannedSource.ScanPath.EndsWith("\\"))
- {
- foreach (DriveInformation item in GeneralUtilities.GetDrives())
- {
- if (item.RootDirectory.Contains(this.ScannedSource.ScanPath))
- {
- return item.VolumeLabel;
- }
- }
- }
-
- if (Path.GetFileNameWithoutExtension(this.ScannedSource.ScanPath) != "VIDEO_TS")
- {
- return Path.GetFileNameWithoutExtension(this.ScannedSource.ScanPath);
- }
-
- return Path.GetFileNameWithoutExtension(Path.GetDirectoryName(this.ScannedSource.ScanPath));
- }
- }
-
- /// <summary>
- /// Gets or sets the Program Status Toolbar Label
- /// This indicates the status of HandBrake
- /// </summary>
- public string StatusLabel
- {
- get
- {
- return string.IsNullOrEmpty(this.statusLabel) ? "Ready" : this.statusLabel;
- }
-
- set
- {
- if (!Equals(this.statusLabel, value))
- {
- this.statusLabel = value;
- this.NotifyOfPropertyChange(() => this.StatusLabel);
- }
- }
- }
-
- /// <summary>
- /// Gets or sets the selected titles.
- /// </summary>
- public BindingList<SelectionTitle> TitleList { get; set; }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// The Destination Path
- /// </summary>
- public void BrowseDestination()
- {
- var saveFileDialog = new SaveFileDialog
- {
- Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",
- CheckPathExists = true,
- AddExtension = true,
- DefaultExt = ".mp4",
- OverwritePrompt = true,
- };
-
- saveFileDialog.ShowDialog();
- this.OutputDirectory = Path.GetDirectoryName(saveFileDialog.FileName);
- }
-
- /// <summary>
- /// Cancel a Scan
- /// </summary>
- public void CancelScan()
- {
- this.scanService.Stop();
- }
-
- /// <summary>
- /// File Scan
- /// </summary>
- public void FileScan()
- {
- var dialog = new OpenFileDialog() { Filter = "All files (*.*)|*.*" };
- dialog.ShowDialog();
- this.StartScan(dialog.FileName, 0);
- }
-
- /// <summary>
- /// Support dropping a file onto the main window to scan.
- /// </summary>
- /// <param name="e">
- /// The DragEventArgs.
- /// </param>
- public void FilesDroppedOnWindow(DragEventArgs e)
- {
- if (e.Data.GetDataPresent(DataFormats.FileDrop))
- {
- var fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];
- if (fileNames != null && fileNames.Any() &&
- (File.Exists(fileNames[0]) || Directory.Exists(fileNames[0])))
- {
- this.StartScan(fileNames[0], 0);
- }
- }
-
- e.Handled = true;
- }
-
- /// <summary>
- /// Folder Scan
- /// </summary>
- public void FolderScan()
- {
- var dialog = new VistaFolderBrowserDialog
- {
- Description = "Please select a folder.",
- UseDescriptionForTitle = true
- };
- dialog.ShowDialog();
- this.StartScan(dialog.SelectedPath, 0);
- }
-
- /// <summary>
- /// Launch the Help pages.
- /// </summary>
- public void LaunchHelp()
- {
- Process.Start("https://trac.handbrake.fr/wiki/HandBrakeGuide");
- }
-
- /// <summary>
- /// The on load.
- /// </summary>
- public override void OnLoad()
- {
- // Perform an update check if required
- // this.updateService.PerformStartupUpdateCheck(this.HandleUpdateCheckResults);
-
- // Setup the presets.
- this.presetService.Load();
- if (this.presetService.CheckIfPresetsAreOutOfDate())
- {
- if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PresetNotification))
- {
- this.errorService.ShowMessageBox(
- "HandBrake has determined your built-in presets are out of date... These presets will now be updated." +
- Environment.NewLine +
- "Your custom presets have not been updated so you may have to re-create these by deleting and re-adding them.",
- "Preset Update",
- MessageBoxButton.OK,
- MessageBoxImage.Information);
- }
- }
-
- this.SelectedPreset = this.presetService.DefaultPreset;
-
- // Log Cleaning
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearOldLogs))
- {
- var clearLog = new Thread(() => GeneralUtilities.ClearLogFiles(30));
- clearLog.Start();
- }
- base.OnLoad();
- }
-
- /// <summary>
- /// Open the About Window
- /// </summary>
- public void OpenAboutApplication()
- {
- var command = new OpenOptionsScreenCommand();
- command.Execute(OptionsTab.About);
- }
-
- /// <summary>
- /// Open the Log Window
- /// </summary>
- public void OpenLogWindow()
- {
- Window window =
- Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(LogView));
-
- if (window != null)
- {
- var logvm = (ILogViewModel)window.DataContext;
- logvm.SelectedTab = this.IsEncoding ? 0 : 1;
- window.Activate();
- }
- else
- {
- var logvm = IoC.Get<ILogViewModel>();
- logvm.SelectedTab = this.IsEncoding ? 0 : 1;
- this.WindowManager.ShowWindow(logvm);
- }
- }
-
- /// <summary>
- /// Open the Options Window
- /// </summary>
- public void OpenOptionsWindow()
- {
- this.shellViewModel.DisplayWindow(ShellWindow.OptionsWindow);
- }
-
- /// <summary>
- /// The order by duration.
- /// </summary>
- public void OrderByDuration()
- {
- this.TitleList =
- new BindingList<SelectionTitle>(this.TitleList.OrderByDescending(o => o.Title.Duration).ToList());
- this.NotifyOfPropertyChange(() => this.TitleList);
- this.OrderedByTitle = false;
- this.OrderedByDuration = true;
- }
-
- /// <summary>
- /// The order by title.
- /// </summary>
- public void OrderByTitle()
- {
- this.TitleList = new BindingList<SelectionTitle>(this.TitleList.OrderBy(o => o.Title.TitleNumber).ToList());
- this.NotifyOfPropertyChange(() => this.TitleList);
- this.OrderedByTitle = true;
- this.OrderedByDuration = false;
- }
-
- /// <summary>
- /// Pause an Encode
- /// </summary>
- public void PauseEncode()
- {
- this.queueProcessor.Pause();
- }
-
- /// <summary>
- /// The select all.
- /// </summary>
- public void SelectAll()
- {
- foreach (SelectionTitle item in this.TitleList)
- {
- item.IsSelected = true;
- }
- }
-
- /// <summary>
- /// The setup.
- /// </summary>
- /// <param name="scannedSource">
- /// The scanned source.
- /// </param>
- public void Setup(Source scannedSource)
- {
- this.TitleList.Clear();
-
- if (scannedSource != null)
- {
- IEnumerable<Title> titles = this.orderedByTitle
- ? scannedSource.Titles
- : scannedSource.Titles.OrderByDescending(o => o.Duration).ToList();
-
- foreach (Title item in titles)
- {
- var title = new SelectionTitle(item, item.SourceName) { IsSelected = true };
- this.TitleList.Add(title);
- }
- }
- }
-
- /// <summary>
- /// Shutdown this View
- /// </summary>
- public void Shutdown()
- {
- // Shutdown Service
- this.encodeService.Shutdown();
-
- // Unsubscribe from Events.
- this.scanService.ScanStared -= this.ScanStared;
- this.scanService.ScanCompleted -= this.ScanCompleted;
- this.scanService.ScanStatusChanged -= this.ScanStatusChanged;
-
- this.queueProcessor.QueueCompleted -= this.QueueCompleted;
- this.queueProcessor.QueueChanged -= this.QueueChanged;
- this.queueProcessor.JobProcessingStarted -= this.QueueProcessorJobProcessingStarted;
- this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeStatusChanged;
- }
-
- /// <summary>
- /// Start an Encode
- /// </summary>
- public void StartEncode()
- {
- // if (this.queueProcessor.IsProcessing)
- // {
- // this.errorService.ShowMessageBox("HandBrake is already encoding.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
- // return;
- // }
-
- //// Check if we already have jobs, and if we do, just start the queue.
- // if (this.queueProcessor.Count != 0)
- // {
- // this.queueProcessor.Start();
- // return;
- // }
-
- //// Otherwise, perform Santiy Checking then add to the queue and start if everything is ok.
- // if (this.SelectedTitle == null)
- // {
- // this.errorService.ShowMessageBox("You must first scan a source.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
- // return;
- // }
-
- // if (string.IsNullOrEmpty(this.Destination))
- // {
- // this.errorService.ShowMessageBox("The Destination field was empty.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
- // return;
- // }
-
- // if (File.Exists(this.Destination))
- // {
- // MessageBoxResult result = this.errorService.ShowMessageBox("The current file already exists, do you wish to overwrite it?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
- // if (result == MessageBoxResult.No)
- // {
- // return;
- // }
- // }
-
- //// Create the Queue Task and Start Processing
- // QueueTask task = new QueueTask
- // {
- // Task = new EncodeTask(this.CurrentTask),
- // CustomQuery = false
- // };
- // this.queueProcessor.Add(task);
- // this.queueProcessor.Start();
- // this.IsEncoding = true;
- }
-
- /// <summary>
- /// Start a Scan
- /// </summary>
- /// <param name="filename">
- /// The filename.
- /// </param>
- /// <param name="title">
- /// The title.
- /// </param>
- public void StartScan(string filename, int title)
- {
- if (!string.IsNullOrEmpty(filename))
- {
- this.scanService.Scan(
- filename,
- title,
- null,
- HBConfigurationFactory.Create());
- }
- }
-
- /// <summary>
- /// Stop an Encode.
- /// </summary>
- public void StopEncode()
- {
- this.queueProcessor.Pause();
- this.encodeService.Stop();
- }
-
- /// <summary>
- /// The select all.
- /// </summary>
- public void UnSelectAll()
- {
- foreach (SelectionTitle item in this.TitleList)
- {
- item.IsSelected = false;
- }
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// The Encode Status has changed Handler
- /// </summary>
- /// <param name="sender">
- /// The Sender
- /// </param>
- /// <param name="e">
- /// The Encode Progress Event Args
- /// </param>
- private void EncodeStatusChanged(object sender, EncodeProgressEventArgs e)
- {
- int percent;
- int.TryParse(Math.Round(e.PercentComplete).ToString(CultureInfo.InvariantCulture), out percent);
-
- Execute.OnUIThread(
- () =>
- {
- if (this.queueProcessor.EncodeService.IsEncoding)
- {
- string josPending = string.Empty;
- if (!AppArguments.IsInstantHandBrake)
- {
- josPending = ", Pending Jobs {5}";
- }
-
- this.ProgramStatusLabel =
- string.Format(
- "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}" +
- josPending,
- e.PercentComplete,
- e.CurrentFrameRate,
- e.AverageFrameRate,
- e.EstimatedTimeLeft,
- e.ElapsedTime,
- this.queueProcessor.Count);
-
- if (this.lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven)
- {
- this.windowsSeven.SetTaskBarProgress(percent);
- }
-
- this.lastEncodePercentage = percent;
- this.ProgressPercentage = percent;
- this.NotifyOfPropertyChange(() => this.ProgressPercentage);
- }
- else
- {
- this.ProgramStatusLabel = "Queue Finished";
- this.IsEncoding = false;
-
- if (this.windowsSeven.IsWindowsSeven)
- {
- this.windowsSeven.SetTaskBarProgressToNoProgress();
- }
- }
- });
- }
-
- /// <summary>
- /// The queue changed.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The EventArgs.
- /// </param>
- private void QueueChanged(object sender, EventArgs e)
- {
- Execute.OnUIThread(
- () => { this.ProgramStatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.Count); });
- }
-
- /// <summary>
- /// The Queue has completed handler
- /// </summary>
- /// <param name="sender">
- /// The Sender
- /// </param>
- /// <param name="e">
- /// The EventArgs
- /// </param>
- private void QueueCompleted(object sender, EventArgs e)
- {
- this.IsEncoding = false;
-
- Execute.OnUIThread(
- () =>
- {
- this.ProgramStatusLabel = "Queue Finished";
- this.IsEncoding = false;
-
- if (this.windowsSeven.IsWindowsSeven)
- {
- this.windowsSeven.SetTaskBarProgressToNoProgress();
- }
- });
- }
-
- /// <summary>
- /// Handle the Queue Starting Event
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void QueueProcessorJobProcessingStarted(object sender, QueueProgressEventArgs e)
- {
- Execute.OnUIThread(
- () =>
- {
- this.ProgramStatusLabel = "Preparing to encode ...";
- this.IsEncoding = true;
- });
- }
-
- /// <summary>
- /// Handle the Scan Completed Event
- /// </summary>
- /// <param name="sender">
- /// The Sender
- /// </param>
- /// <param name="e">
- /// The EventArgs
- /// </param>
- private void ScanCompleted(object sender, ScanCompletedEventArgs e)
- {
- this.scanService.SouceData.CopyTo(this.ScannedSource);
- this.NotifyOfPropertyChange(() => this.ScannedSource);
-
- Execute.OnUIThread(
- () =>
- {
- if (this.scannedSource != null)
- {
- this.Setup(this.scannedSource);
- }
-
- if (e.Successful)
- {
- this.NotifyOfPropertyChange(() => this.ScannedSource);
- this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
- }
-
- this.ShowStatusWindow = false;
- if (e.Successful)
- {
- this.SourceLabel = this.SourceName;
- this.StatusLabel = "Scan Completed";
- }
- else if (e.Cancelled)
- {
- this.SourceLabel = "Scan Cancelled.";
- this.StatusLabel = "Scan Cancelled.";
- }
- else if (e.Exception == null && e.ErrorInformation != null)
- {
- this.SourceLabel = "Scan failed: " + e.ErrorInformation;
- this.StatusLabel = "Scan failed: " + e.ErrorInformation;
- }
- else
- {
- this.SourceLabel = "Scan Failed... See Activity Log for details.";
- this.StatusLabel = "Scan Failed... See Activity Log for details.";
- }
- });
- }
-
- /// <summary>
- /// Handle the Scan Started Event
- /// </summary>
- /// <param name="sender">
- /// The Sender
- /// </param>
- /// <param name="e">
- /// The EventArgs
- /// </param>
- private void ScanStared(object sender, EventArgs e)
- {
- Execute.OnUIThread(
- () =>
- {
- this.StatusLabel = "Scanning source, please wait...";
- this.ShowStatusWindow = true;
- });
- }
-
- /// <summary>
- /// Handle the Scan Status Changed Event.
- /// </summary>
- /// <param name="sender">
- /// The Sender
- /// </param>
- /// <param name="e">
- /// The EventArgs
- /// </param>
- private void ScanStatusChanged(object sender, ScanProgressEventArgs e)
- {
- this.SourceLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage);
- this.StatusLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage);
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IInstantViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IInstantViewModel.cs
deleted file mode 100644
index 5481865b8..000000000
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IInstantViewModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IInstantViewModel.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 IInstantViewModel type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.ViewModels.Interfaces
-{
- /// <summary>
- /// The InstantViewModel interface.
- /// </summary>
- public interface IInstantViewModel
- {
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
index a580eb86c..8e66c661e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
@@ -94,11 +94,6 @@ namespace HandBrakeWPF.ViewModels.Interfaces
void Shutdown();
/// <summary>
- /// The show cli query.
- /// </summary>
- void ShowCliQuery();
-
- /// <summary>
/// The files dropped on window.
/// </summary>
/// <param name="e">
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 6eff64259..18f994026 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1064,10 +1064,7 @@ namespace HandBrakeWPF.ViewModels
Resources.Notice, MessageBoxButton.OK, MessageBoxImage.Information);
// Queue Recovery
- if (!AppArguments.IsInstantHandBrake)
- {
- QueueRecoveryHelper.RecoverQueue(this.queueProcessor, this.errorService);
- }
+ QueueRecoveryHelper.RecoverQueue(this.queueProcessor, this.errorService);
this.SelectedPreset = this.presetService.DefaultPreset;
@@ -1085,7 +1082,7 @@ namespace HandBrakeWPF.ViewModels
public void Shutdown()
{
// Shutdown Service
- this.encodeService.Shutdown();
+ this.encodeService.Stop();
// Unsubscribe from Events.
this.scanService.ScanStared -= this.ScanStared;
@@ -1455,18 +1452,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// DEBUG: Show CLI Query for settings+6
- /// </summary>
- public void ShowCliQuery()
- {
- this.errorService.ShowMessageBox(
- QueryGeneratorUtility.GenerateQuery(this.CurrentTask, HBConfigurationFactory.Create()),
- "CLI Query",
- MessageBoxButton.OK,
- MessageBoxImage.Information);
- }
-
- /// <summary>
/// The select source window.
/// </summary>
public void SelectSourceWindow()
@@ -2065,14 +2050,8 @@ namespace HandBrakeWPF.ViewModels
{
if (this.queueProcessor.EncodeService.IsEncoding)
{
- string josPending = string.Empty;
- if (!AppArguments.IsInstantHandBrake)
- {
- josPending = Resources.Main_JobsPending_addon;
- }
-
this.ProgramStatusLabel =
- string.Format("{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}" + josPending,
+ string.Format("{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}" + Resources.Main_JobsPending_addon,
e.PercentComplete,
e.CurrentFrameRate,
e.AverageFrameRate,
diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs
index 10c82f1a4..e297db422 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs
@@ -9,8 +9,6 @@
namespace HandBrakeWPF.ViewModels
{
- using System.IO;
- using System.Linq;
using System.Windows;
using Caliburn.Micro;
@@ -44,11 +42,6 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private bool showOptions;
- /// <summary>
- /// The show instant.
- /// </summary>
- private bool showInstant;
-
#endregion
/// <summary>
@@ -60,19 +53,8 @@ namespace HandBrakeWPF.ViewModels
public ShellViewModel(IErrorService errorService)
{
this.errorService = errorService;
-
- if (!AppArguments.IsInstantHandBrake)
- {
- this.showMainWindow = true;
- this.showOptions = false;
- this.showInstant = false;
- }
- else
- {
- this.showMainWindow = false;
- this.showOptions = false;
- this.showInstant = true;
- }
+ this.showMainWindow = true;
+ this.showOptions = false;
}
/// <summary>
@@ -87,25 +69,16 @@ namespace HandBrakeWPF.ViewModels
{
this.ShowMainWindow = true;
this.ShowOptions = false;
- this.ShowInstant = false;
}
else if (window == ShellWindow.OptionsWindow)
{
this.ShowOptions = true;
this.ShowMainWindow = false;
- this.ShowInstant = false;
- }
- else if (window == ShellWindow.InstantMainWindow)
- {
- this.ShowInstant = true;
- this.ShowOptions = false;
- this.ShowMainWindow = false;
}
else
{
this.ShowMainWindow = true;
this.ShowOptions = false;
- this.ShowInstant = false;
}
}
@@ -122,11 +95,6 @@ namespace HandBrakeWPF.ViewModels
public IOptionsViewModel OptionsViewModel { get; set; }
/// <summary>
- /// Gets or sets the instant view model.
- /// </summary>
- public IInstantViewModel InstantViewModel { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether ShowMainWindow.
/// </summary>
public bool ShowMainWindow
@@ -159,29 +127,13 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Gets or sets a value indicating whether ShowInstant.
- /// </summary>
- public bool ShowInstant
- {
- get
- {
- return this.showInstant;
- }
- set
- {
- this.showInstant = value;
- this.NotifyOfPropertyChange(() => this.ShowInstant);
- }
- }
-
- /// <summary>
/// Gets WindowTitle.
/// </summary>
public string WindowTitle
{
get
{
- return AppArguments.IsInstantHandBrake ? "Instant HandBrake" : "HandBrake";
+ return "HandBrake";
}
}
diff --git a/win/CS/HandBrakeWPF/Views/InstantView.xaml b/win/CS/HandBrakeWPF/Views/InstantView.xaml
deleted file mode 100644
index bb9bc1971..000000000
--- a/win/CS/HandBrakeWPF/Views/InstantView.xaml
+++ /dev/null
@@ -1,202 +0,0 @@
-<UserControl x:Class="HandBrakeWPF.Views.InstantView"
- 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:cal="http://www.caliburnproject.org"
- xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
- xmlns:converters="clr-namespace:HandBrakeWPF.Converters"
- xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- mc:Ignorable="d"
- cal:Message.Attach="[Event Loaded] = [Action Load]"
- >
-
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="Drop">
- <cal:ActionMessage MethodName="FilesDroppedOnWindow">
- <cal:Parameter Value="$eventArgs" />
- </cal:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
-
- <UserControl.Resources>
- <converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
- </UserControl.Resources>
-
- <!-- Window Body -->
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
-
-
- <!-- Source -->
- <StackPanel Orientation="Vertical" Grid.Row="0">
- <!-- Source -->
- <StackPanel Margin="10,5,5,5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- >
- <StackPanel Orientation="Horizontal">
- <Label Content="Source" FontWeight="Bold" />
- </StackPanel>
-
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="8,10,0,10">
-
- <TextBlock Text="Drag and Drop a file - OR - Open a " />
- <Button cal:Message.Attach="[Event Click] = [Action FileScan]" Padding="8,2">
- File
- </Button>
- <TextBlock Text="- OR -" FontWeight="Bold" Margin="10,0,10,0" />
- <Button cal:Message.Attach="[Event Click] = [Action FolderScan]" Padding="8,2">
- Folder
- </Button>
-
- </StackPanel>
-
- <ListBox Grid.Row="2"
- Margin="10,10,10,10"
- MinHeight="150" MaxHeight="150"
- VerticalAlignment="Stretch"
- Background="LightGray"
- ItemsSource="{Binding TitleList}"
- SelectionMode="Single">
- <ListBox.ItemContainerStyle>
- <Style TargetType="ListBoxItem">
- <Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="Background" Value="WhiteSmoke" />
- <Setter Property="Margin" Value="0,0,0,1" />
- </Style>
- </ListBox.ItemContainerStyle>
-
- <ListBox.ContextMenu>
- <ContextMenu>
- <MenuItem Header="Select All" cal:Message.Attach="[Event Click] = [Action SelectAll]" />
- <MenuItem Header="Deselect All" cal:Message.Attach="[Event Click] = [Action UnSelectAll]" />
- <Separator />
- <MenuItem Header="Order by Title" IsChecked="{Binding OrderedByTitle}" cal:Message.Attach="[Event Click] = [Action OrderByTitle]" />
- <MenuItem Header="Order by Duration" IsChecked="{Binding OrderedByDuration}" cal:Message.Attach="[Event Click] = [Action OrderByDuration]" />
- </ContextMenu>
- </ListBox.ContextMenu>
-
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid HorizontalAlignment="Stretch" MinHeight="28">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <CheckBox IsChecked="{Binding IsSelected}" Grid.RowSpan="2" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" />
-
- <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Margin="10,0,0,0" >
- <TextBlock Text="Title:" Margin="0,0,5,0" FontWeight="Bold" />
- <TextBlock Text="{Binding Title}" Margin="5,0,5,0" />
- </StackPanel>
-
- <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="10,0,0,0" >
- <TextBlock Text="Source:" Margin="0,0,5,0" FontWeight="Bold" />
- <TextBlock Text="{Binding SourceName}" Margin="5,0,5,0" />
- </StackPanel>
- </Grid>
-
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </StackPanel>
- </StackPanel>
-
-
- <!-- Destination -->
- <StackPanel Grid.Row="1"
- Margin="10,5,5,5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- >
- <Label Content="Destination" FontWeight="Bold" />
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <Label Margin="8,0,0,0" Content="File" />
- <TextBox Name="Destination"
- Grid.Column="1"
- Margin="8,0,0,0"
- Text="{Binding OutputDirectory,
- UpdateSourceTrigger=PropertyChanged}"
- />
- <Button Name="DestinationBrowser"
- Grid.Column="2"
- Margin="8,0,5,0"
- Padding="8,2"
- Content="Browse"
- cal:Message.Attach="[Event Click] = [Action BrowseDestination]"
- />
- </Grid>
- </StackPanel>
-
- <!-- Opitons -->
- <StackPanel Grid.Row="2"
- Margin="10,5,5,5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- >
- <Label Content="Options" FontWeight="Bold" />
-
- <StackPanel Orientation="Horizontal" Margin="8,0,0,0">
- <TextBlock Text="Preset:" Margin="0,0,5,0" />
- <ComboBox ItemsSource="{Binding Presets}" SelectedItem="{Binding SelectedPreset}" MinWidth="150" />
- </StackPanel>
-
- </StackPanel>
-
-
- <!-- Buttons and Queueing -->
- <Grid Grid.Row="3" Margin="10,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Label Content="Start" FontWeight="Bold" Grid.Row="0" />
- <Button Content="Start Encoding" cal:Message.Attach="[Event Click] = [Action StartEncode]" FontWeight="Bold" Grid.Row="1" Padding="8,2" HorizontalAlignment="Center"
- Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
- <Button Content="Stop Encoding" cal:Message.Attach="[Event Click] = [Action StopEncode]" FontWeight="Bold" Grid.Row="1" Padding="8,2" HorizontalAlignment="Center"
- Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
- </Grid>
-
-
- <!-- StatusPanel -->
- <controls:StatusPanel x:Name="loadingPanel"
- Grid.Row="3"
- Grid.RowSpan="2"
- Height="70"
- VerticalAlignment="Bottom"
- Panel.ZIndex="10"
- IsLoading="{Binding ShowStatusWindow}"
- Message="{Binding StatusLabel}"
- SubMessage="Please Wait ..."
- />
-
- <!-- Status Bar -->
- <StatusBar Grid.Row="4" Grid.ColumnSpan="2" MinHeight="32" >
-
- <ProgressBar Value="{Binding ProgressPercentage}" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}}"
- Width="100" Height="18" VerticalAlignment="Center"/>
- <Label VerticalAlignment="Center"
- Content="{Binding Path=ProgramStatusLabel}" />
-
- </StatusBar>
-
- </Grid>
-</UserControl>
diff --git a/win/CS/HandBrakeWPF/Views/InstantView.xaml.cs b/win/CS/HandBrakeWPF/Views/InstantView.xaml.cs
deleted file mode 100644
index 8ca18aa87..000000000
--- a/win/CS/HandBrakeWPF/Views/InstantView.xaml.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="InstantView.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 InstantMainView.xaml
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Views
-{
- using System.Windows.Controls;
-
- /// <summary>
- /// Interaction logic for InstantMainView.xaml
- /// </summary>
- public partial class InstantView : UserControl
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="InstantView"/> class.
- /// </summary>
- public InstantView()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml b/win/CS/HandBrakeWPF/Views/ShellView.xaml
index ab82b298a..9f735ec61 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml
@@ -35,7 +35,5 @@
<ContentControl x:Name="MainViewModel" Visibility="{Binding ShowMainWindow, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
<ContentControl x:Name="OptionsViewModel" Visibility="{Binding ShowOptions, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
- <views:InstantView DataContext="{Binding InstantViewModel}"
- Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.ShowInstant, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
</Grid>
</Window>
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
index 03059a2a8..e38e37c46 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
@@ -4,12 +4,14 @@
// </copyright>
// <summary>
// Interaction logic for ShellView.xaml
-// </summary>
+// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Views
{
using System;
+ using System.ComponentModel;
+ using System.Drawing;
using System.IO;
using System.Windows;
using System.Windows.Forms;
@@ -18,9 +20,6 @@ namespace HandBrakeWPF.Views
using Caliburn.Micro;
- using HandBrake.ApplicationServices.Services.Interfaces;
- using HandBrake.ApplicationServices.Utilities;
-
using HandBrakeWPF.Commands;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Utilities;
@@ -36,7 +35,7 @@ namespace HandBrakeWPF.Views
/// <summary>
/// The my notify icon.
/// </summary>
- private readonly System.Windows.Forms.NotifyIcon notifyIcon;
+ private readonly NotifyIcon notifyIcon;
/// <summary>
/// Initializes a new instance of the <see cref="ShellView"/> class.
@@ -50,14 +49,14 @@ namespace HandBrakeWPF.Views
if (minimiseToTray)
{
- this.notifyIcon = new System.Windows.Forms.NotifyIcon();
+ this.notifyIcon = new NotifyIcon();
this.notifyIcon.ContextMenu = new ContextMenu(new[] { new MenuItem("Restore", NotifyIconClick) });
StreamResourceInfo streamResourceInfo = Application.GetResourceStream(new Uri("pack://application:,,,/handbrakepineapple.ico"));
if (streamResourceInfo != null)
{
Stream iconStream = streamResourceInfo.Stream;
- this.notifyIcon.Icon = new System.Drawing.Icon(iconStream);
+ this.notifyIcon.Icon = new Icon(iconStream);
}
this.notifyIcon.DoubleClick += this.NotifyIconClick;
this.StateChanged += this.ShellViewStateChanged;
@@ -70,7 +69,6 @@ namespace HandBrakeWPF.Views
// Add to Queue (Ctrl+A)
// Scan a File (Ctrl+F)
// Scan a Folder (Ctrl+R)
- // Show CLI Query (Ctrl+Shift+D)
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.S, ModifierKeys.Control)), new KeyGesture(Key.S, ModifierKeys.Control)));
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.K, ModifierKeys.Control)), new KeyGesture(Key.K, ModifierKeys.Control)));
@@ -80,7 +78,6 @@ namespace HandBrakeWPF.Views
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F, ModifierKeys.Control)), new KeyGesture(Key.F, ModifierKeys.Control)));
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control)), new KeyGesture(Key.O, ModifierKeys.Control)));
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.R, ModifierKeys.Control)), new KeyGesture(Key.R, ModifierKeys.Control)));
- this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift)));
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)));
// Enable Windows 7 Taskbar progress indication.
@@ -88,14 +85,6 @@ namespace HandBrakeWPF.Views
{
this.TaskbarItemInfo = Win7.WindowsTaskbar;
}
-
- // Window Sizing
- if (AppArguments.IsInstantHandBrake)
- {
- this.SizeToContent = SizeToContent.WidthAndHeight;
- this.MinHeight = 380;
- this.MinWidth = 600;
- }
}
/// <summary>
@@ -129,6 +118,7 @@ namespace HandBrakeWPF.Views
{
this.ShowInTaskbar = false;
notifyIcon.Visible = true;
+
// notifyIcon.ShowBalloonTip(5000, "HandBrake", "Application Minimised", ToolTipIcon.Info);
}
else if (this.WindowState == WindowState.Normal)
@@ -145,7 +135,7 @@ namespace HandBrakeWPF.Views
/// <param name="e">
/// The CancelEventArgs.
/// </param>
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ protected override void OnClosing(CancelEventArgs e)
{
IShellViewModel shellViewModel = this.DataContext as IShellViewModel;