From e6711b1280a96045610e2396c6017c441722b18a Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 27 Apr 2017 18:34:58 +0000 Subject: [PATCH] ENI Teil 2, wir sind auf dem Weg! :-) --- ENI-2/ENI2/ENI2/AnmeldungenControl.xaml | 2 +- ENI-2/ENI2/ENI2/App.config | 2 +- ENI-2/ENI2/ENI2/App.xaml | 2 +- ENI-2/ENI2/ENI2/App.xaml.cs | 6 + ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs | 12 +- ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs | 8 +- .../ENI2/ENI2/Controls/LocodeControl.xaml.cs | 17 ++- .../PortCallDetailControl.xaml | 16 +-- .../PortCallDetailControl.xaml.cs | 27 ++-- ENI-2/ENI2/ENI2/ENI2.csproj | 8 +- .../EditControls/EditCallPurposeDialog.xaml | 2 +- .../EditCallPurposeDialog.xaml.cs | 77 +++++++++- ENI-2/ENI2/ENI2/MainWindow.xaml | 8 +- .../ENI2/Properties/Resources.Designer.cs | 105 ++++++++++---- ENI-2/ENI2/ENI2/Properties/Resources.de.resx | 135 ++++++++++++++++++ ENI-2/ENI2/ENI2/Properties/Resources.resx | 15 ++ ENI-2/ENI2/ENI2/SucheControl.xaml | 2 +- Stundensheet.xlsx | Bin 29720 -> 29724 bytes nsw/Source/bsmd.database/CallPurpose.cs | 9 ++ 19 files changed, 383 insertions(+), 70 deletions(-) create mode 100644 ENI-2/ENI2/ENI2/Properties/Resources.de.resx diff --git a/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml index 97614ea3..dee60216 100644 --- a/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml +++ b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml @@ -17,7 +17,7 @@ - + diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index b793453c..85221ef7 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -17,7 +17,7 @@ Sample license text. - Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False diff --git a/ENI-2/ENI2/ENI2/App.xaml b/ENI-2/ENI2/ENI2/App.xaml index d31823f0..8de76f43 100644 --- a/ENI-2/ENI2/ENI2/App.xaml +++ b/ENI-2/ENI2/ENI2/App.xaml @@ -4,6 +4,6 @@ xmlns:local="clr-namespace:ENI2" StartupUri="MainWindow.xaml"> - + diff --git a/ENI-2/ENI2/ENI2/App.xaml.cs b/ENI-2/ENI2/ENI2/App.xaml.cs index 22f580d1..f978a99d 100644 --- a/ENI-2/ENI2/ENI2/App.xaml.cs +++ b/ENI-2/ENI2/ENI2/App.xaml.cs @@ -1,6 +1,8 @@ // Copyright (c) 2017 Informatibüro Daniel Schick +using System.Globalization; using System.Windows; +using System.Windows.Markup; namespace ENI2 { @@ -13,6 +15,10 @@ namespace ENI2 public App() : base() { this.Dispatcher.UnhandledException += Dispatcher_UnhandledException; + + FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), + new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); + } private void Dispatcher_UnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) diff --git a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs index 7d7267b0..1745be6e 100644 --- a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs +++ b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs @@ -124,14 +124,14 @@ namespace ENI2.Controls protected void deleteItem(object sender, RoutedEventArgs e) { - if((this.SelectedItems != null) && (this.SelectedItems.Count > 0)) + if((this.SelectedItems != null) && (this.SelectedItems.Count == 1)) { - // TODO: ask confirmation message box - - foreach(object deleteItem in this.SelectedItems) + MessageBoxResult result = MessageBox.Show(Properties.Resources.textAreYouSure, Properties.Resources.textCaptionDeleteConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result == MessageBoxResult.Yes) { - if (deleteItem is DatabaseEntity) { - this.DeleteRequested?.Invoke(deleteItem as DatabaseEntity); + DatabaseEntity deleteItem = this.SelectedItems[0] as DatabaseEntity; + if (deleteItem != null) { + this.DeleteRequested?.Invoke(deleteItem); } } } diff --git a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs index 0ebc6f4e..606b318f 100644 --- a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs +++ b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs @@ -16,6 +16,10 @@ namespace ENI2.Controls [TemplatePart(Name = "buttonCancel", Type = typeof(Button))] public class EditWindowBase : Window { + + public event Action OKClicked; + public event Action CancelClicked; + static EditWindowBase() { DefaultStyleKeyProperty.OverrideMetadata(typeof(EditWindowBase), new FrameworkPropertyMetadata(typeof(EditWindowBase))); @@ -27,8 +31,8 @@ namespace ENI2.Controls { var okButton = (Button)Template.FindName("buttonOK", this); var cancelButton = (Button)Template.FindName("buttonCancel", this); - okButton.Click += (s, e) => DialogResult = true; - cancelButton.Click += (s, e) => DialogResult = false; + okButton.Click += (s, e) => { DialogResult = true; OKClicked?.Invoke(); }; + cancelButton.Click += (s, e) => { DialogResult = false; CancelClicked?.Invoke(); }; }; } diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs index 522ab672..66be34c6 100644 --- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs @@ -89,14 +89,21 @@ namespace ENI2.Controls private void ComboBox_TextChanged(object sender, RoutedEventArgs e) { - if (this.comboBoxLocode.Text.Length > 3) + if (this.comboBoxLocode.Text.Length > 4) { // check if actual locode - bool isLocode = !LocodeDB.PortNameFromLocode(this.comboBoxLocode.Text).IsNullOrEmpty(); - if (isLocode) + if (this.comboBoxLocode.Text.Length == 5) { - this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK); - return; + string directLocode = this.comboBoxLocode.Text.Trim().ToUpper(); + bool isLocode = !LocodeDB.PortNameFromLocode(directLocode).IsNullOrEmpty(); + if (isLocode) + { + this.comboBoxLocode.Text = directLocode; + this.LocodeList.Clear(); + this.LocodeList.Add(directLocode); + this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK); + return; + } } // assume this is a harbour name typed out.. diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml index f6be5f4a..f8830056 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml @@ -40,12 +40,12 @@