From 47237ebf6823dd552a6a38b8a33c426e525816b1 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sat, 29 Apr 2017 20:24:15 +0000 Subject: [PATCH] Neuer Stand ENI2: - Port Notification (INFO SERV LADG NAME) - Custom Commands (Kontext - Clear) --- ENI-2/ENI2/ENI2/AnmeldungenControl.xaml | 2 +- ENI-2/ENI2/ENI2/App.xaml | 10 +- ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs | 13 +- ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs | 6 + ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml | 5 +- ENI-2/ENI2/ENI2/CustomCommands.cs | 45 +++ ENI-2/ENI2/ENI2/DetailBaseControl.cs | 9 +- ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs | 28 +- .../OverViewDetailControl.xaml | 29 +- .../OverViewDetailControl.xaml.cs | 66 +-- .../PortCallDetailControl.xaml | 63 +-- .../PortCallDetailControl.xaml.cs | 9 +- .../PortNotificationDetailControl.xaml | 92 ++++- .../PortNotificationDetailControl.xaml.cs | 197 ++++++++- ENI-2/ENI2/ENI2/ENI2.csproj | 17 +- .../EditControls/EditCallPurposeDialog.xaml | 7 +- .../EditCallPurposeDialog.xaml.cs | 17 +- .../ENI2/EditControls/EditLADGDialog.xaml | 35 ++ .../ENI2/EditControls/EditLADGDialog.xaml.cs | 37 ++ .../ENI2/EditControls/EditSERVDialog.xaml | 28 ++ .../ENI2/EditControls/EditSERVDialog.xaml.cs | 55 +++ ENI-2/ENI2/ENI2/MainWindow.xaml | 6 +- ENI-2/ENI2/ENI2/MainWindow.xaml.cs | 36 +- .../ENI2/Properties/Resources.Designer.cs | 378 ------------------ ENI-2/ENI2/ENI2/Properties/Resources.resx | 243 +++++++++++ ENI-2/ENI2/ENI2/SucheControl.xaml | 6 +- ENI-2/ENI2/ENI2/Themes/Generic.xaml | 4 +- Stundensheet.xlsx | Bin 29724 -> 29791 bytes nsw/Source/bsmd.database/MessageCore.cs | 15 + 29 files changed, 920 insertions(+), 538 deletions(-) create mode 100644 ENI-2/ENI2/ENI2/CustomCommands.cs create mode 100644 ENI-2/ENI2/ENI2/EditControls/EditLADGDialog.xaml create mode 100644 ENI-2/ENI2/ENI2/EditControls/EditLADGDialog.xaml.cs create mode 100644 ENI-2/ENI2/ENI2/EditControls/EditSERVDialog.xaml create mode 100644 ENI-2/ENI2/ENI2/EditControls/EditSERVDialog.xaml.cs delete mode 100644 ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs diff --git a/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml index dee60216..3597eafb 100644 --- a/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml +++ b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml @@ -8,7 +8,7 @@ d:DesignHeight="300" d:DesignWidth="300"> + AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" CanUserAddRows="False"> diff --git a/ENI-2/ENI2/ENI2/App.xaml b/ENI-2/ENI2/ENI2/App.xaml index 8de76f43..e792b792 100644 --- a/ENI-2/ENI2/ENI2/App.xaml +++ b/ENI-2/ENI2/ENI2/App.xaml @@ -2,8 +2,16 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ENI2" + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" + xmlns:p="clr-namespace:ENI2.Properties" StartupUri="MainWindow.xaml"> - + + + + + + + diff --git a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs index 1745be6e..a50a1566 100644 --- a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs +++ b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs @@ -76,21 +76,22 @@ namespace ENI2.Controls this.MouseDoubleClick += dataGrid_MouseDoubleClick; this.ContextMenu = new ContextMenu(); + this.CanUserAddRows = false; MenuItem addItem = new MenuItem(); - addItem.Header = "_Add"; + addItem.Header = Properties.Resources.textAdd; addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) }; addItem.Click += new RoutedEventHandler(this.addItem); this.ContextMenu.Items.Add(addItem); MenuItem deleteItem = new MenuItem(); - deleteItem.Header = "_Delete"; + deleteItem.Header = Properties.Resources.textDelete; deleteItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) }; deleteItem.Click += this.deleteItem; this.ContextMenu.Items.Add(deleteItem); MenuItem editItem = new MenuItem(); - editItem.Header = "_Edit"; + editItem.Header = Properties.Resources.textEdit; editItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/edit.png")) }; editItem.Click += this.editItem; this.ContextMenu.Items.Add(editItem); @@ -98,19 +99,19 @@ namespace ENI2.Controls this.ContextMenu.Items.Add(new Separator()); MenuItem printItem = new MenuItem(); - printItem.Header = "_Print"; + printItem.Header = Properties.Resources.textPrint; printItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/printer.png")) }; printItem.Click += this.printItem; this.ContextMenu.Items.Add(printItem); MenuItem exportItem = new MenuItem(); - exportItem.Header = "_Export"; + exportItem.Header = Properties.Resources.textExport; exportItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/floppy_disk_blue.png")) }; exportItem.Click += this.exportItem; this.ContextMenu.Items.Add(exportItem); MenuItem showTextItem = new MenuItem(); - showTextItem.Header = "_Show data as text"; + showTextItem.Header = Properties.Resources.textShowAsText; showTextItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/document_plain.png")) }; showTextItem.Click += this.showTextItem; this.ContextMenu.Items.Add(showTextItem); diff --git a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs index 606b318f..17dab016 100644 --- a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs +++ b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs @@ -47,5 +47,11 @@ namespace ENI2.Controls // this.SetPlacement(..) } + protected virtual void OnOkClicked() + { + this.DialogResult = true; + OKClicked?.Invoke(); + } + } } diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml index 45676795..be1d1527 100644 --- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml +++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml @@ -3,7 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:p="clr-namespace:ENI2.Properties" xmlns:local="clr-namespace:ENI2.Controls" mc:Ignorable="d" d:DesignHeight="30" d:DesignWidth="300"> @@ -13,7 +14,7 @@ - diff --git a/ENI-2/ENI2/ENI2/CustomCommands.cs b/ENI-2/ENI2/ENI2/CustomCommands.cs new file mode 100644 index 00000000..c52eac19 --- /dev/null +++ b/ENI-2/ENI2/ENI2/CustomCommands.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2017 schick Informatik +// Description: Eigene routed commands. Damit können "globale" Commands definiert werden, die überall in XAML +// an Objekte attached werden können. Erste Verwendung war das Kontextmenü "löschen" für DateTimePicker, um den +// ausgewählten Wert zu leeren. + +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; + +namespace ENI2 +{ + public static class CustomCommands + { + + public static readonly RoutedUICommand Clear = new RoutedUICommand( + Properties.Resources.textClear, + "Clear", + typeof(CustomCommands), + new InputGestureCollection() + { + new KeyGesture(Key.Delete) + } + + ); + + public static T FindParent(DependencyObject child) where T : DependencyObject + { + if (child == null) return null; + + //get parent item + DependencyObject parentObject = VisualTreeHelper.GetParent(child); + + //we've reached the end of the tree + if (parentObject == null) return null; + + //check if the parent matches the type we're looking for + T parent = parentObject as T; + if (parent != null) + return parent; + else + return FindParent(parentObject); + } + + } +} diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs index e77c22c0..fdcf6dca 100644 --- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -11,6 +11,8 @@ using System.Windows.Controls; using bsmd.database; using System.Windows.Media.Imaging; +using System.Windows; +using System.Windows.Input; namespace ENI2 { @@ -38,7 +40,12 @@ namespace ENI2 #region protected methods - public virtual void Initialize() { } + public virtual void Initialize() { + + + + } + protected void SetLocodeStateImage(Image stateImage, LocodeState state) { diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 8450a489..ecb4a829 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -39,20 +39,20 @@ namespace ENI2 displayIdLabel.Content = aCore.DisplayId; // Listbox befüllen - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Overview", MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Port Call", MessageGroupControlType = typeof(PortCallDetailControl), ImagePath = "Resources/eye_blue.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Port Notification", MessageGroupControlType = typeof(PortNotificationDetailControl), ImagePath = "Resources/anchor.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Waste", MessageGroupControlType = typeof(WasteDetailControl), ImagePath = "Resources/garbage.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Arrival Notification", MessageGroupControlType = typeof(ArrivalNotificationDetailControl), ImagePath = "Resources/arrow_down_right_red.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Security", MessageGroupControlType = typeof(SecurityDetailControl), ImagePath = "Resources/shield_yellow.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "PSC 72h", MessageGroupControlType = typeof(PSC72hDetailControl), ImagePath = "Resources/alarmclock.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Maritime Health Declaration", MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Ship Data", MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Border Police", MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Departure Notification", MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Dangerous Goods Arrival", MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Dangerous Goods Departure", MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Towage", MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPortCall, MessageGroupControlType = typeof(PortCallDetailControl), ImagePath = "Resources/eye_blue.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPortNotification, MessageGroupControlType = typeof(PortNotificationDetailControl), ImagePath = "Resources/anchor.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textWaste, MessageGroupControlType = typeof(WasteDetailControl), ImagePath = "Resources/garbage.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textArrivalNotification, MessageGroupControlType = typeof(ArrivalNotificationDetailControl), ImagePath = "Resources/arrow_down_right_red.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textSecurity, MessageGroupControlType = typeof(SecurityDetailControl), ImagePath = "Resources/shield_yellow.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPSC72h, MessageGroupControlType = typeof(PSC72hDetailControl), ImagePath = "Resources/alarmclock.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textMDH, MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textShipData, MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDepartureNotification, MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGArrival, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGDeparture, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" }); this.listBoxMessages.ItemsSource = this._listBoxList; diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml index bf2a8a15..cf877955 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml @@ -5,10 +5,12 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" + xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:p="clr-namespace:ENI2.Properties" xmlns:local="clr-namespace:ENI2.DetailViewControls" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="600"> - + @@ -23,27 +25,28 @@ - diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index c550be00..2e530e5d 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -26,47 +26,28 @@ namespace ENI2.DetailViewControls /// /// Interaction logic for OverViewDetailControl.xaml /// - public partial class OverViewDetailControl : DetailBaseControl, INotifyPropertyChanged + public partial class OverViewDetailControl : DetailBaseControl { - private Message _message = null; - private List _locodePoCList = new List(); - - public event PropertyChangedEventHandler PropertyChanged; + private Message _message = null; public OverViewDetailControl() { InitializeComponent(); - } - - public List LocodePoCList - { - get { return this._locodePoCList; } - set { this._locodePoCList = value; } - } - - public string PoC - { - get { return this.Core.PoC; } - set { this.Core.PoC = value; } - } + } public override void Initialize() { + base.Initialize(); Message.NotificationClass notificationClass = this.Core.IsTransit ? Message.NotificationClass.TRANSIT : Message.NotificationClass.VISIT; if (this.Messages == null) return; if (this.Core == null) return; this.textBoxENI.DataContext = this.Core; this.textBoxIMO.DataContext = this.Core; - this.comboBoxPoC.DataContext = this; + this.locodePoC.DataContext = this.Core; this.dateTimePickerETA.DataContext = this.Core; - //this.dateTimePickerETD.DataContext = .. - if (!this.Core.PoC.IsNullOrEmpty()) - { - this._locodePoCList.Add(this.Core.PoC); - // LocodeState locodeState = LocodeDB.PortNameFromLocode(this.Core.PoC).IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK; - } + //this.dateTimePickerETD.DataContext = .. Binding vtBinding = new Binding(); vtBinding.Source = this.Core; @@ -90,39 +71,6 @@ namespace ENI2.DetailViewControls } this._initialized = true; } - - private void ComboBox_TextChanged(object sender, RoutedEventArgs e) - { - if (!_initialized) return; - if(this.comboBoxPoC.Text.Length > 3) - { - // check if actual locode - bool isLocode = !LocodeDB.PortNameFromLocode(this.comboBoxPoC.Text).IsNullOrEmpty(); - if(isLocode) - { - this.SetLocodeStateImage(this.imagePoCState, LocodeState.OK); - return; - } - - // assume this is a harbour name typed out.. - this.LocodePoCList = LocodeDB.AllLocodesForCityName(this.comboBoxPoC.Text + "%"); - - if(this.LocodePoCList.Count == 1) - { - this.comboBoxPoC.SelectedItem = this.LocodePoCList[0]; - this.SetLocodeStateImage(this.imagePoCState, LocodeState.OK); - } - else if(this.LocodePoCList.Count == 0) - { - this.SetLocodeStateImage(this.imagePoCState, LocodeState.INVALID); - } - else - { - this.SetLocodeStateImage(this.imagePoCState, LocodeState.AMBIGUOUS); - } - } - - this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocodePoCList")); - } + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml index f8830056..cab2db94 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml @@ -6,16 +6,17 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ENI2.DetailViewControls" xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:p="clr-namespace:ENI2.Properties" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"> - + - + @@ -31,38 +32,38 @@ - - + @@ -81,16 +82,16 @@ - -