diff options
author | sr55 <[email protected]> | 2019-03-09 20:50:06 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2019-03-09 21:14:23 +0000 |
commit | c332cf6f061948c2f03c908faca59fa05d1aead4 (patch) | |
tree | 8b90de1d2974994bc5b75a882d7b3543e23a1b60 /win/CS | |
parent | f0448eb50ab5026ee38048a770b210f574cb1cf5 (diff) |
WinGui: Bind "Ctrl-C" on the Error window. This *may* be usable in some instances where the screen doesn't render correctly to allow us to see the error. #1950
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/Views/ErrorView.xaml | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/ErrorView.xaml.cs | 40 |
2 files changed, 34 insertions, 7 deletions
diff --git a/win/CS/HandBrakeWPF/Views/ErrorView.xaml b/win/CS/HandBrakeWPF/Views/ErrorView.xaml index f8ab63c6f..fb6f1ac7a 100644 --- a/win/CS/HandBrakeWPF/Views/ErrorView.xaml +++ b/win/CS/HandBrakeWPF/Views/ErrorView.xaml @@ -56,6 +56,7 @@ VerticalAlignment="Stretch"
IsReadOnly="True"
Text="{Binding Details}"
+ x:Name="errorText"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
diff --git a/win/CS/HandBrakeWPF/Views/ErrorView.xaml.cs b/win/CS/HandBrakeWPF/Views/ErrorView.xaml.cs index b21194e35..0effdbfdd 100644 --- a/win/CS/HandBrakeWPF/Views/ErrorView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/ErrorView.xaml.cs @@ -9,19 +9,45 @@ namespace HandBrakeWPF.Views
{
+ using System;
using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Input;
+
+ using HandBrakeWPF.Commands;
+ using HandBrakeWPF.ViewModels.Interfaces;
- /// <summary>
- /// Interaction logic for ErrorView.xaml
- /// </summary>
public partial class ErrorView : Window
{
- /// <summary>
- /// Initializes a new instance of the <see cref="ErrorView"/> class.
- /// </summary>
public ErrorView()
+ {
+ this.InitializeComponent();
+ this.InputBindings.Add(new InputBinding(new CopyError(this.errorText), new KeyGesture(Key.C, ModifierKeys.Control))); // Copy Error
+ }
+ }
+
+ public class CopyError : ICommand
+ {
+ private readonly TextBox textBlock;
+
+ public CopyError(TextBox textBlock)
{
- InitializeComponent();
+ this.textBlock = textBlock;
}
+
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+
+ public void Execute(object parameter)
+ {
+ if (this.textBlock != null)
+ {
+ Clipboard.SetText(this.textBlock.Text);
+ }
+ }
+
+ public event EventHandler CanExecuteChanged;
}
}
|