From 66c96daa92a073054edcef2772c20155b62d6c46 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 5 Apr 2023 08:40:16 +0200 Subject: [PATCH] add copy IMO to search control --- ENI2/Properties/Resources.Designer.cs | 9 +++++++++ ENI2/Properties/Resources.resx | 3 +++ ENI2/SucheControl.xaml.cs | 13 +++++++++++++ 3 files changed, 25 insertions(+) diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs index a47afa95..934f8aa0 100644 --- a/ENI2/Properties/Resources.Designer.cs +++ b/ENI2/Properties/Resources.Designer.cs @@ -1613,6 +1613,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Copy IMO to clipboard. + /// + public static string textCopyIMO { + get { + return ResourceManager.GetString("textCopyIMO", resourceCulture); + } + } + /// /// Looks up a localized string similar to Copy to {0}. /// diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx index f959d19d..27e88020 100644 --- a/ENI2/Properties/Resources.resx +++ b/ENI2/Properties/Resources.resx @@ -1876,4 +1876,7 @@ ..\Resources\exit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Copy IMO to clipboard + \ No newline at end of file diff --git a/ENI2/SucheControl.xaml.cs b/ENI2/SucheControl.xaml.cs index d3df5625..fae3ecfb 100644 --- a/ENI2/SucheControl.xaml.cs +++ b/ENI2/SucheControl.xaml.cs @@ -51,6 +51,11 @@ namespace ENI2 addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) }; addItem.Click += this.copyID; this.dataGrid.ContextMenu.Items.Add(addItem); + MenuItem copyIMOItem = new MenuItem(); + copyIMOItem.Header = Properties.Resources.textCopyIMO; + copyIMOItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/document_into.png")) }; + copyIMOItem.Click += this.copyIMO; + this.dataGrid.ContextMenu.Items.Add(copyIMOItem); cancelItem = new MenuItem(); cancelItem.Header = Properties.Resources.textUndoCancel; cancelItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) }; @@ -297,6 +302,14 @@ namespace ENI2 } } + private void copyIMO(object sender, RoutedEventArgs e) + { + if (dataGrid.SelectedItem is MessageCore selectedCore) + { + Clipboard.SetText(selectedCore.IMO); + } + } + #endregion private void logoImage_MouseUp(object sender, MouseButtonEventArgs e)