diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config
index bc6cfbfc..8c9908cc 100644
--- a/ENI-2/ENI2/ENI2/App.config
+++ b/ENI-2/ENI2/ENI2/App.config
@@ -16,15 +16,18 @@
-
- Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
-
True
http://heupferd/bsmd.LockingService/LockingService.svc
+
+ 60
+
+
+ Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
+
diff --git a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs
index 6d39ef86..b0a62657 100644
--- a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs
+++ b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs
@@ -45,6 +45,12 @@ namespace ENI2.Controls
if (this.shouldCancel) e.Cancel = true;
}
+ protected void EnableOK(bool enabled)
+ {
+ var okButton = (Button)Template.FindName("buttonOK", this);
+ okButton.IsEnabled = enabled;
+ }
+
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs
index f2fc7481..f420030a 100644
--- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs
@@ -21,6 +21,7 @@ namespace ENI2.Controls
{
private List _locodeList = new List();
public event PropertyChangedEventHandler PropertyChanged;
+ private bool _comboSelect;
public LocodeControl()
{
@@ -52,9 +53,9 @@ namespace ENI2.Controls
{
// Get instance of current control from sender
// and property value from e.NewValue
-
- if(e.NewValue != null)
- ((LocodeControl)sender).SelectedItem = e.NewValue.ToString().Substring(0,5);
+
+ if (e.NewValue != null)
+ ((LocodeControl)sender).SelectedItem = e.NewValue.ToString();//.Substring(0,5);
}
@@ -63,11 +64,18 @@ namespace ENI2.Controls
get { return this.comboBoxLocode.SelectedItem as string; }
set {
this._locodeList.Clear();
- this._locodeList.Add(value);
- this.comboBoxLocode.ItemsSource = this.LocodeList;
- LocodeState locodeState = LocodeDB.PortNameFromLocode(value).IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK;
+
+ string portName = LocodeDB.PortNameFromLocode(value);
+ LocodeState locodeState = portName.IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK;
this.SetLocodeStateImage(this.imageLocodeState, locodeState);
- this.comboBoxLocode.SelectedItem = value;
+
+ if (locodeState == LocodeState.OK)
+ {
+ string valString = string.Format("{0} - {1}", value, portName);
+ this._locodeList.Add(valString);
+ this.comboBoxLocode.ItemsSource = this.LocodeList;
+ this.comboBoxLocode.SelectedItem = valString;
+ }
}
}
@@ -85,46 +93,65 @@ namespace ENI2.Controls
#region event handler
private void ComboBox_TextChanged(object sender, RoutedEventArgs e)
- {
- if (this.comboBoxLocode.Text.Length > 4)
- {
- this.LocodeList.Clear();
+ {
+ bool locodeFound = false;
+ this.comboBoxLocode.ItemsSource = null;
- // check if actual locode
- if (this.comboBoxLocode.Text.Length == 5)
+ if (this._comboSelect)
+ {
+ this._comboSelect = false;
+ this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
+ }
+
+ else
+ {
+
+ if (this.comboBoxLocode.Text.Length > 4)
{
- string directLocode = this.comboBoxLocode.Text.Trim().ToUpper();
- bool isLocode = !LocodeDB.PortNameFromLocode(directLocode).IsNullOrEmpty();
- if (isLocode)
+ this.LocodeList.Clear();
+ this.LocodeValue = null;
+
+ // check if actual locode
+ if (this.comboBoxLocode.Text.Length == 5)
{
- this.comboBoxLocode.Text = directLocode;
- this.LocodeList.Add(directLocode);
- this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
- return;
+ string directLocode = this.comboBoxLocode.Text.Trim().ToUpper();
+ string portname = LocodeDB.PortNameFromLocode(directLocode);
+ bool isLocode = !portname.IsNullOrEmpty();
+ if (isLocode)
+ {
+ this.comboBoxLocode.Text = string.Format("{0} - {1}", directLocode, portname);
+ this.LocodeList.Add(string.Format("{0} - {1}", directLocode, portname));
+ this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
+ this.LocodeValue = directLocode;
+ locodeFound = true;
+ }
+ }
+
+ if (!locodeFound)
+ {
+ // 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)
+ {
+ this.comboBoxLocode.SelectedItem = this.LocodeList[0];
+ this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
+ this.LocodeValue = this.LocodeList[0];
+ }
+ else if (this.LocodeList.Count == 0)
+ {
+ this.SetLocodeStateImage(this.imageLocodeState, LocodeState.INVALID);
+ }
+ else
+ {
+ this.SetLocodeStateImage(this.imageLocodeState, LocodeState.AMBIGUOUS);
+ }
+
+ this.comboBoxLocode.ItemsSource = this.LocodeList;
}
}
-
- // 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)
- {
- this.comboBoxLocode.SelectedItem = this.LocodeList[0];
- this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
- }
- else if (this.LocodeList.Count == 0)
- {
- this.SetLocodeStateImage(this.imageLocodeState, LocodeState.INVALID);
- }
- else
- {
- this.SetLocodeStateImage(this.imageLocodeState, LocodeState.AMBIGUOUS);
- }
-
- this.comboBoxLocode.ItemsSource = this.LocodeList;
-
}
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocodeList"));
@@ -132,7 +159,20 @@ namespace ENI2.Controls
private void comboBoxLocode_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- this.LocodeValue = this.SelectedItem;
+ if (this.SelectedItem == null)
+ this.LocodeValue = null;
+ else
+ {
+ if (this.SelectedItem.Length > 5)
+ {
+ this.LocodeValue = this.SelectedItem.Substring(0, 5);
+ this._comboSelect = true;
+ }
+ else
+ {
+ this.LocodeValue = this.SelectedItem;
+ }
+ }
}
#endregion
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index c199023c..3ca6e0e2 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -367,18 +367,31 @@ namespace ENI2.DetailViewControls
bool? statusFlag = DBManager.Instance.GetMessageCoreQueryStatusFlag(this.Core.Id.Value);
if (statusFlag ?? true)
{
- // not yet.. (calling ui thread async)
- this.Dispatcher.BeginInvoke(new Action(() =>
- {
- this.labelBusyTimeElapsed.Content = string.Format(Properties.Resources.textSecondsElapsed, (DateTime.Now - _startStatusCheck).TotalSeconds.ToString("N0"));
- }));
+ double elapsedSec = (DateTime.Now - _startStatusCheck).TotalSeconds;
+ if (elapsedSec < Properties.Settings.Default.RequestTimeout)
+ {
+ // not yet.. (calling ui thread async)
+ this.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ this.labelBusyTimeElapsed.Content = string.Format(Properties.Resources.textSecondsElapsed, elapsedSec.ToString("N0"));
+ }));
+ }
+ else
+ {
+ this._checkStatusTimer.Stop();
+ this.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ MessageBox.Show(Properties.Resources.textRequestTimedOut, Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Warning);
+ this.busyIndicator.IsBusy = false;
+ }));
+ }
}
else
{
this._checkStatusTimer.Stop();
this.Dispatcher.BeginInvoke(new Action(() =>
- {
+ {
this.busyIndicator.IsBusy = false;
this.OnRequestReload();
}));
diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj
index fe581afc..479b6e41 100644
--- a/ENI-2/ENI2/ENI2/ENI2.csproj
+++ b/ENI-2/ENI2/ENI2/ENI2.csproj
@@ -35,7 +35,7 @@
3.5.1.0
true
publish.html
- 0
+ 2
3.6.3.%2a
false
true
diff --git a/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml
index 1b8efc25..d675b55f 100644
--- a/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml
@@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textNewVisitTransitId}" Height="192" Width="300" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
+ Title="{x:Static p:Resources.textNewVisitTransitId}" Height="192" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
@@ -18,7 +18,7 @@
-
+
@@ -55,6 +55,6 @@
ParsingNumberStyle="Integer"
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged"/>
-
+
diff --git a/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs
index 9e498a3a..38723e2d 100644
--- a/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs
+++ b/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs
@@ -23,9 +23,11 @@ namespace ENI2.EditControls
}
private void VisitIdDialog_Loaded(object sender, RoutedEventArgs e)
- {
+ {
this.OKClicked += VisitIdDialog_OKClicked;
- }
+ this.EnableOK(false);
+ this.locodePoC.PropertyChanged += LocodePoC_PropertyChanged;
+ }
private void VisitIdDialog_OKClicked()
{
@@ -56,16 +58,51 @@ namespace ENI2.EditControls
private void doubleUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs