diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 7b435d1f..bc6cfbfc 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -17,7 +17,7 @@ - Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False True diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml index be1d1527..7ffaa378 100644 --- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml +++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml @@ -14,7 +14,7 @@ - diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs index 66be34c6..f2fc7481 100644 --- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs @@ -19,8 +19,7 @@ namespace ENI2.Controls /// public partial class LocodeControl : UserControl, INotifyPropertyChanged { - private List _locodeList = new List(); - // private string _selectedLocode; + private List _locodeList = new List(); public event PropertyChangedEventHandler PropertyChanged; public LocodeControl() @@ -47,17 +46,15 @@ namespace ENI2.Controls public static readonly DependencyProperty LocodeValueProperty = DependencyProperty.Register("LocodeValue", typeof(string), typeof(LocodeControl), new UIPropertyMetadata(LocodeValueChangedHandler)); - //new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); public static void LocodeValueChangedHandler(DependencyObject sender, DependencyPropertyChangedEventArgs e) { // Get instance of current control from sender // and property value from e.NewValue - - // Set public property on TaregtCatalogControl, e.g. + if(e.NewValue != null) - ((LocodeControl)sender).SelectedItem = e.NewValue.ToString(); + ((LocodeControl)sender).SelectedItem = e.NewValue.ToString().Substring(0,5); } @@ -91,6 +88,8 @@ namespace ENI2.Controls { if (this.comboBoxLocode.Text.Length > 4) { + this.LocodeList.Clear(); + // check if actual locode if (this.comboBoxLocode.Text.Length == 5) { @@ -98,16 +97,17 @@ namespace ENI2.Controls bool isLocode = !LocodeDB.PortNameFromLocode(directLocode).IsNullOrEmpty(); if (isLocode) { - this.comboBoxLocode.Text = directLocode; - this.LocodeList.Clear(); + this.comboBoxLocode.Text = directLocode; this.LocodeList.Add(directLocode); this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK); return; } } - // assume this is a harbour name typed out.. - this.LocodeList = LocodeDB.AllLocodesForCityName(this.comboBoxLocode.Text + "%"); + // assume this is a harbour name typed out.. + List locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(this.comboBoxLocode.Text + "%"); + foreach (LocodeDB.LocodeEntry entry in locodeEntries) + this.LocodeList.Add(string.Format("{0} - {1}", entry.Locode, entry.Name)); if (this.LocodeList.Count == 1) { diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml b/ENI-2/ENI2/ENI2/DetailRootControl.xaml index 2c041851..6d73c65d 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml @@ -4,6 +4,7 @@ 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:p="clr-namespace:ENI2.Properties" xmlns:local="clr-namespace:ENI2" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> @@ -21,18 +22,20 @@ - - + + - diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index ce1bbd7f..52cf9408 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -134,7 +134,7 @@ namespace ENI2 private void buttonSave_Click(object sender, RoutedEventArgs e) { - MessageBoxResult result = MessageBox.Show(Properties.Resources.textSavePage, Properties.Resources.textConfirmation, + MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { @@ -158,7 +158,7 @@ namespace ENI2 private void buttonSaveAll_Click(object sender, RoutedEventArgs e) { - MessageBoxResult result = MessageBox.Show(Properties.Resources.textSaveAll, Properties.Resources.textConfirmation, + MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml index 43c4b610..1bbc949d 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml @@ -10,7 +10,7 @@ xmlns:local="clr-namespace:ENI2.DetailViewControls" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="600"> - + + + + + + + + + + + + + + + +