summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-09-29 21:40:46 +0000
committersr55 <[email protected]>2012-09-29 21:40:46 +0000
commit4d6d7ec179aa8c4459515539599c700bdcc54420 (patch)
tree93a2f9a730bc4f78416545620c801e5d9369880a /win/CS/HandBrakeWPF
parentf933f7f15f06a64cd8dba8fa3da9c4db37547140 (diff)
WinGui: Readded missing functionality that scans files dropped on the app icon when starting the app.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4995 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/App.xaml.cs22
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs11
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs30
3 files changed, 47 insertions, 16 deletions
diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs
index 3d6e00748..ec7bda6b0 100644
--- a/win/CS/HandBrakeWPF/App.xaml.cs
+++ b/win/CS/HandBrakeWPF/App.xaml.cs
@@ -10,6 +10,8 @@
namespace HandBrakeWPF
{
using System;
+ using System.IO;
+ using System.Linq;
using System.Windows;
using Caliburn.Micro;
@@ -17,6 +19,7 @@ namespace HandBrakeWPF
using HandBrake.ApplicationServices.Exceptions;
using HandBrakeWPF.ViewModels;
+ using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
/// Interaction logic for App.xaml
@@ -34,6 +37,25 @@ namespace HandBrakeWPF
}
/// <summary>
+ /// Override the startup behavior to handle files dropped on the app icon.
+ /// </summary>
+ /// <param name="e">
+ /// The StartupEventArgs.
+ /// </param>
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+
+ // If we have a file dropped on the icon, try scanning it.
+ string[] fileNames = e.Args;
+ if (fileNames.Any() && (File.Exists(fileNames[0]) || Directory.Exists(fileNames[0])))
+ {
+ IMainViewModel mvm = IoC.Get<IMainViewModel>();
+ mvm.StartScan(fileNames[0], 0);
+ }
+ }
+
+ /// <summary>
/// Non-UI Thread expection handler.
/// </summary>
/// <param name="sender">
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
index d719ce866..67dcf4c09 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
@@ -62,6 +62,17 @@ namespace HandBrakeWPF.ViewModels.Interfaces
void StartEncode();
/// <summary>
+ /// The start scan.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ void StartScan(string filename, int title);
+
+ /// <summary>
/// Edit a Queue Task
/// </summary>
/// <param name="task">
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index a0e9d62c2..acc59e60e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1397,6 +1397,20 @@ namespace HandBrakeWPF.ViewModels
this.SelectedPreset = this.presetService.DefaultPreset;
}
+ /// <summary>
+ /// Start a Scan
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ public void StartScan(string filename, int title)
+ {
+ this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);
+ }
+
#endregion
#region Private Methods
@@ -1440,22 +1454,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Start a Scan
- /// </summary>
- /// <param name="filename">
- /// The filename.
- /// </param>
- /// <param name="title">
- /// The title.
- /// </param>
- private void StartScan(string filename, int title)
- {
- // TODO
- // 1. Disable GUI.
- this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);
- }
-
- /// <summary>
/// Make sure the correct file extension is set based on user preferences and setup the GUI for the file container selected.
/// </summary>
/// <param name="newExtension">