Add copy shipname button to search control
This commit is contained in:
parent
c11e571473
commit
bed3fc397a
9
ENI2/Properties/Resources.Designer.cs
generated
9
ENI2/Properties/Resources.Designer.cs
generated
@ -1631,6 +1631,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy ship name to clipboard.
|
||||
/// </summary>
|
||||
public static string textCopyShipnameClip {
|
||||
get {
|
||||
return ResourceManager.GetString("textCopyShipnameClip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to {0}.
|
||||
/// </summary>
|
||||
|
||||
@ -1606,6 +1606,9 @@
|
||||
<data name="textCopyClip" xml:space="preserve">
|
||||
<value>Copy Id to clipboard</value>
|
||||
</data>
|
||||
<data name="textCopyShipnameClip" xml:space="preserve">
|
||||
<value>Copy ship name to clipboard</value>
|
||||
</data>
|
||||
<data name="textUpdateStatus" xml:space="preserve">
|
||||
<value>Server status update</value>
|
||||
</data>
|
||||
|
||||
@ -46,16 +46,25 @@ namespace ENI2
|
||||
this.dataGrid.ContextMenu = new ContextMenu();
|
||||
this.dataGrid.CanUserAddRows = false;
|
||||
this.dataGrid.ContextMenuOpening += ContextMenu_ContextMenuOpening;
|
||||
|
||||
MenuItem addItem = new MenuItem();
|
||||
addItem.Header = Properties.Resources.textCopyClip;
|
||||
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);
|
||||
|
||||
MenuItem copyShipnameItem = new MenuItem();
|
||||
copyShipnameItem.Header = Properties.Resources.textCopyShipnameClip;
|
||||
copyShipnameItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
|
||||
copyShipnameItem.Click += this.copyShipname;
|
||||
this.dataGrid.ContextMenu.Items.Add(copyShipnameItem);
|
||||
|
||||
cancelItem = new MenuItem();
|
||||
cancelItem.Header = Properties.Resources.textUndoCancel;
|
||||
cancelItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) };
|
||||
@ -302,6 +311,17 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
|
||||
private void copyShipname(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dataGrid.SelectedItem is MessageCore selectedCore)
|
||||
{
|
||||
if (selectedCore.Shipname != null)
|
||||
{
|
||||
Clipboard.SetText(selectedCore.Shipname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void copyIMO(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dataGrid.SelectedItem is MessageCore selectedCore)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user