summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS')
-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">