diff --git a/butterflow-ui/BoolVisibilityConverter.cs b/butterflow-ui/BoolVisibilityConverter.cs
new file mode 100644
index 0000000..506f229
--- /dev/null
+++ b/butterflow-ui/BoolVisibilityConverter.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace butterflow_ui
+{
+ [ValueConversion(typeof(bool), typeof(Visibility))]
+ public class BoolVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (targetType == typeof(Visibility))
+ {
+ return (bool)value ? Visibility.Visible : Visibility.Hidden;
+ }
+
+ throw new InvalidCastException(string.Format("Cannot convert type to {0} from bool.", targetType.Name));
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (targetType == typeof(Visibility))
+ {
+ return ((Visibility)value == Visibility.Visible) ? true : false;
+ }
+
+ throw new InvalidCastException(string.Format("Cannot convert type {0} to boolean.", targetType.Name));
+ }
+ }
+}
diff --git a/butterflow-ui/ButterflowWrapper.cs b/butterflow-ui/ButterflowWrapper.cs
index d2efbeb..b200723 100644
--- a/butterflow-ui/ButterflowWrapper.cs
+++ b/butterflow-ui/ButterflowWrapper.cs
@@ -27,6 +27,8 @@ namespace butterflow_ui
/// Full pathname of the butterflow executable file.
private Lazy executablePath = new Lazy(() => Path.Combine(Directory.GetCurrentDirectory(), "ThirdPartyCompiled", "butterflow.exe"));
+ /// Queue of butterflow commands to run.
+ private Queue runQueue = new Queue();
/// The console output from butterflow.
private string consoleOutput = string.Empty;
/// True if butterflow is running, false if not.
@@ -93,38 +95,26 @@ namespace butterflow_ui
#region Methods
- /// Runs butterflow with the given .
+ /// Runs butterflow with the given by adding it to the queue.
/// The options configuration.
public void Run(OptionsConfiguration optionsConfiguration)
{
- string arguments = optionsConfiguration.ToButterflowArguments();
-
- Run(arguments);
- }
-
- /// Kills the running instance of butterflow, cancelling its current operation.
- public void Cancel()
- {
- if(this.IsRunning && this.runningProcess != null)
+ for(int i = 0; i < optionsConfiguration.VideoInput.Count(); i++)
{
- this.runningProcess.Kill();
+ var arguments = optionsConfiguration.ToButterflowArguments(i);
+ this.runQueue.Enqueue(arguments);
}
+
+ ProcessQueue();
}
- /// Probes a video file.
- /// The video file to be probed.
- public void Probe(string videoFile)
+ /// Process the queue of butterflow arguments.
+ public void ProcessQueue()
{
- string arguments = string.Format("-prb \"{0}\"", videoFile);
- Run(arguments);
- }
-
- /// Runs butterflow with the given .
- /// Options for controlling the operation.
- private void Run(string arguments)
- {
- if (!this.IsRunning)
+ if (!this.IsRunning && this.runQueue.Any())
{
+ var arguments = this.runQueue.Dequeue();
+
var process = new Process();
process.StartInfo = new ProcessStartInfo(executablePath.Value, arguments);
@@ -146,6 +136,34 @@ namespace butterflow_ui
}
}
+ /// Kills the running instance of butterflow, cancelling its current operation.
+ public void Cancel()
+ {
+ if(this.IsRunning && this.runningProcess != null)
+ {
+ this.runningProcess.Kill();
+ }
+
+ this.runQueue.Clear();
+ }
+
+ /// Probes a video file.
+ /// The video file to be probed.
+ public void Probe(string videoFile)
+ {
+ string arguments = string.Format("-prb \"{0}\"", videoFile);
+ Run(arguments);
+ }
+
+ /// Runs butterflow with the given by adding it to the queue.
+ /// Options for controlling the operation.
+ private void Run(string arguments)
+ {
+ this.runQueue.Enqueue(arguments);
+
+ ProcessQueue();
+ }
+
/// Event handler. Called by Process for exited events.
/// Source of the event.
/// Event information.
@@ -153,6 +171,8 @@ namespace butterflow_ui
{
this.IsRunning = false;
this.runningProcess = null;
+
+ ProcessQueue();
}
///
diff --git a/butterflow-ui/InverseBoolVisibilityConverter.cs b/butterflow-ui/InverseBoolVisibilityConverter.cs
new file mode 100644
index 0000000..50b9131
--- /dev/null
+++ b/butterflow-ui/InverseBoolVisibilityConverter.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace butterflow_ui
+{
+ [ValueConversion(typeof(bool), typeof(Visibility))]
+ public class InverseBoolVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (targetType == typeof(Visibility))
+ {
+ return (bool)value ? Visibility.Hidden : Visibility.Visible;
+ }
+
+ throw new InvalidCastException(string.Format("Cannot convert type to {0} from bool.", targetType.Name));
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (targetType == typeof(Visibility))
+ {
+ return ((Visibility)value == Visibility.Visible) ? false : true;
+ }
+
+ throw new InvalidCastException(string.Format("Cannot convert type {0} to boolean.", targetType.Name));
+ }
+ }
+}
diff --git a/butterflow-ui/Localization/Localization.Designer.cs b/butterflow-ui/Localization/Localization.Designer.cs
index 41a342d..ce4094f 100644
--- a/butterflow-ui/Localization/Localization.Designer.cs
+++ b/butterflow-ui/Localization/Localization.Designer.cs
@@ -465,6 +465,24 @@ namespace butterflow_ui.Localization {
}
}
+ ///
+ /// Looks up a localized string similar to Video previewing and subregion clipping is not available when processing multiple files..
+ ///
+ public static string MultipleFilesPreviewWarningLabel {
+ get {
+ return ResourceManager.GetString("MultipleFilesPreviewWarningLabel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to [Multiple Files].
+ ///
+ public static string MultipleFilesText {
+ get {
+ return ResourceManager.GetString("MultipleFilesText", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to OK.
///
diff --git a/butterflow-ui/Localization/Localization.resx b/butterflow-ui/Localization/Localization.resx
index e580b79..6e4e854 100644
--- a/butterflow-ui/Localization/Localization.resx
+++ b/butterflow-ui/Localization/Localization.resx
@@ -360,4 +360,10 @@
Version
+
+ Video previewing and subregion clipping is not available when processing multiple files.
+
+
+ [Multiple Files]
+
\ No newline at end of file
diff --git a/butterflow-ui/MainWindow.xaml b/butterflow-ui/MainWindow.xaml
index 24e0cf0..9c30410 100644
--- a/butterflow-ui/MainWindow.xaml
+++ b/butterflow-ui/MainWindow.xaml
@@ -25,6 +25,8 @@
+
+