From a9eefc21c0058f3ebdf7f4edb3d01032e6eed9d2 Mon Sep 17 00:00:00 2001 From: chuongmep Date: Mon, 16 May 2022 23:53:05 +0700 Subject: [PATCH] support copy content in debug/trace output --- CadAddinManager/View/Control/LogControl.xaml | 13 ++++++++++++ .../View/Control/LogControl.xaml.cs | 20 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CadAddinManager/View/Control/LogControl.xaml b/CadAddinManager/View/Control/LogControl.xaml index 8f501e1..197f570 100644 --- a/CadAddinManager/View/Control/LogControl.xaml +++ b/CadAddinManager/View/Control/LogControl.xaml @@ -41,6 +41,19 @@ Text="{Binding Message}" /> + + + + + + + + + + + + diff --git a/CadAddinManager/View/Control/LogControl.xaml.cs b/CadAddinManager/View/Control/LogControl.xaml.cs index fae48a0..10fb2d6 100644 --- a/CadAddinManager/View/Control/LogControl.xaml.cs +++ b/CadAddinManager/View/Control/LogControl.xaml.cs @@ -1,5 +1,9 @@ -using System.Windows.Controls; +using System.Text; +using System.Windows.Forms; +using System.Windows.Input; +using CadAddinManager.Model; using CadAddinManager.ViewModel; +using UserControl = System.Windows.Controls.UserControl; namespace CadAddinManager.View.Control { @@ -18,6 +22,18 @@ public LogControl() this.Unloaded += viewModel.UserControl_Unloaded; } - + private void RightClickCopyCmdExecuted(object sender, ExecutedRoutedEventArgs e) + { + StringBuilder sb = new StringBuilder(); + foreach (LogMessageString dd in listBox_LogMessages.SelectedItems) + { + sb.AppendLine(dd.Message); + } + Clipboard.SetText(sb.ToString()); + } + private void RightClickCopyCmdCanExecute(object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = listBox_LogMessages.SelectedItem != null; + } } }