]> granicus.if.org Git - handbrake/commitdiff
WinGui: Bind "Ctrl-C" on the Error window. This *may* be usable in some instances...
authorsr55 <sr55.hb@outlook.com>
Sat, 9 Mar 2019 20:50:06 +0000 (20:50 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 9 Mar 2019 21:14:23 +0000 (21:14 +0000)
win/CS/HandBrakeWPF/Views/ErrorView.xaml
win/CS/HandBrakeWPF/Views/ErrorView.xaml.cs

index f8ab63c6fda3f468153075a4c0c9f2d56c1ce287..fb6f1ac7a983ac16cbbeaaa724a12593f51062f8 100644 (file)
@@ -56,6 +56,7 @@
                  VerticalAlignment="Stretch"\r
                  IsReadOnly="True"\r
                  Text="{Binding Details}"\r
+                 x:Name="errorText"\r
                  TextWrapping="Wrap"\r
                  VerticalScrollBarVisibility="Auto" />\r
 \r
index b21194e353f75b96b4b2e930b44b9553de4f4c9b..0effdbfddd408c0ce1f130bb4a9d75dc07246bf1 100644 (file)
@@ -9,19 +9,45 @@
 \r
 namespace HandBrakeWPF.Views\r
 {\r
+    using System;\r
     using System.Windows;\r
+    using System.Windows.Controls;\r
+    using System.Windows.Input;\r
+\r
+    using HandBrakeWPF.Commands;\r
+    using HandBrakeWPF.ViewModels.Interfaces;\r
 \r
-    /// <summary>\r
-    /// Interaction logic for ErrorView.xaml\r
-    /// </summary>\r
     public partial class ErrorView : Window\r
     {\r
-        /// <summary>\r
-        /// Initializes a new instance of the <see cref="ErrorView"/> class.\r
-        /// </summary>\r
         public ErrorView()\r
+        {  \r
+            this.InitializeComponent();\r
+            this.InputBindings.Add(new InputBinding(new CopyError(this.errorText), new KeyGesture(Key.C, ModifierKeys.Control))); // Copy Error\r
+        }\r
+    }\r
+\r
+    public class CopyError : ICommand\r
+    {\r
+        private readonly TextBox textBlock;\r
+\r
+        public CopyError(TextBox textBlock)\r
         {\r
-            InitializeComponent();\r
+            this.textBlock = textBlock;\r
         }\r
+\r
+        public bool CanExecute(object parameter)\r
+        {\r
+            return true;\r
+        }\r
+\r
+        public void Execute(object parameter)\r
+        {\r
+            if (this.textBlock != null)\r
+            {\r
+                Clipboard.SetText(this.textBlock.Text);\r
+            }      \r
+        }\r
+\r
+        public event EventHandler CanExecuteChanged;\r
     }\r
 }\r