diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml
index f6aee911..a66b1473 100644
--- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml
+++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml
@@ -60,37 +60,25 @@
-
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs
index 752e4bb8..b1a8e7cb 100644
--- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs
@@ -1,4 +1,6 @@
-// Copyright (c) 2017 schick Informatik
+// Copyright (c) 2017- schick Informatik
+// Description:
+//
// Description: Detailansicht Gruppe Port Notification
//
@@ -163,15 +165,7 @@ namespace ENI2.DetailViewControls
if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4;
#endregion
-
- #region init port area helper
-
- if (LocalizedLookup.getPortAreaInfos().ContainsKey(this.Core.PoC))
- {
- this.comboBoxPortAreaHelper.ItemsSource = LocalizedLookup.getPortAreaInfos()[this.Core.PoC];
- }
-
- #endregion
+
}
#region datagrid LADG
@@ -467,35 +461,23 @@ namespace ENI2.DetailViewControls
}
}
-
- #endregion
-
- #region set port area code from selected combobox item
-
- private void buttonSetPortArea_Click(object sender, RoutedEventArgs e)
+ private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
{
- if (this.comboBoxPortAreaHelper.SelectedItem != null)
+ SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC);
+ if(spad.ShowDialog() ?? false)
{
- PortAreaInfo pai = this.comboBoxPortAreaHelper.SelectedItem as PortAreaInfo;
- if (portAreas.ContainsKey(pai.PortAreaCode))
+ if(spad.SelectedArea != null)
{
- var pair = portAreas.SingleOrDefault(p => p.Key == pai.PortAreaCode);
- this.comboBoxPortArea.SelectedItem = pair;
+ if (portAreas.ContainsKey(spad.SelectedArea))
+ {
+ var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea);
+ this.comboBoxPortArea.SelectedItem = pair;
+ }
}
}
}
- private void comboBoxPortAreaHelper_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (this.comboBoxPortAreaHelper.SelectedItem != null)
- {
- PortAreaInfo pai = this.comboBoxPortAreaHelper.SelectedItem as PortAreaInfo;
- // this.comboBoxPortAreaHelper.ToolTip = $"{pai.Remark} Ships: {pai.Ships} Agentur: {pai.Agency} Liegeplatz: {pai.Berth}";
- this.textBlockPortAreaRemarks.Text = $"Agency:{pai.Agency}\nShip:{pai.Ships}\nRemark:{pai.Remark}";
- }
-
- }
-
#endregion
+
}
}
diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index 1a1824a8..6d59f749 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -252,6 +252,9 @@
NewDGItemDialog.xaml
+
+ SelectPortAreaDialog.xaml
+
@@ -697,6 +700,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/ENI2/EditControls/NewDGItemDialog.xaml.cs b/ENI2/EditControls/NewDGItemDialog.xaml.cs
index ac351d31..79847091 100644
--- a/ENI2/EditControls/NewDGItemDialog.xaml.cs
+++ b/ENI2/EditControls/NewDGItemDialog.xaml.cs
@@ -18,7 +18,7 @@ namespace ENI2.EditControls
public partial class NewDGItemDialog : EditWindowBase
{
private List _data = null;
- private static object filterLock = new object();
+ private static readonly object filterLock = new object();
public NewDGItemDialog()
{
diff --git a/ENI2/EditControls/SelectPortAreaDialog.xaml b/ENI2/EditControls/SelectPortAreaDialog.xaml
new file mode 100644
index 00000000..4d375c5d
--- /dev/null
+++ b/ENI2/EditControls/SelectPortAreaDialog.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ENI2/EditControls/SelectPortAreaDialog.xaml.cs b/ENI2/EditControls/SelectPortAreaDialog.xaml.cs
new file mode 100644
index 00000000..505c5b06
--- /dev/null
+++ b/ENI2/EditControls/SelectPortAreaDialog.xaml.cs
@@ -0,0 +1,85 @@
+// Copyright (c) 2023- schick Informatik
+// Description: Helper search window to
+//
+
+using bsmd.database;
+using ENI2.Controls;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+
+namespace ENI2.EditControls
+{
+ ///
+ /// Interaction logic for SelectPortAreaDialog.xaml
+ ///
+ public partial class SelectPortAreaDialog : EditWindowBase
+ {
+
+ #region Fields
+
+ private readonly string _poc = null;
+ private List _portAreas;
+ private static readonly object filterLock = new object();
+
+ #endregion
+
+ #region Construction
+
+ public SelectPortAreaDialog(string poc)
+ {
+ InitializeComponent();
+ _poc = poc;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public string SelectedArea { get; private set; }
+
+ #endregion
+
+ #region event handler
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ _portAreas = LocalizedLookup.getPortAreaInfos()[this._poc];
+ this.labelLocode.Content = this._poc;
+ }
+
+ private void comboBoxType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
+ {
+ if (this.listBoxAreas.SelectedItem is PortAreaInfo pai)
+ {
+ this.textBlockAgency.Text = pai.Agency;
+ this.textBlockBerth.Text = pai.Berth;
+ this.textBlockPortArea.Text = pai.PortArea;
+ this.textBlockShips.Text = pai.Ships;
+ this.textBlockRemarks.Text = pai.Remark;
+ this.SelectedArea = pai.PortAreaCode;
+ }
+ }
+
+ private void textBoxSearchDescription_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+ {
+ string searchText = this.textBoxSearchDescription.Text.Trim();
+
+ lock (filterLock)
+ {
+ IEnumerable filtered = _portAreas;
+ if (searchText.Length > 0)
+ {
+ filtered = _portAreas.Where(elem => (elem.Remark != null && elem.Remark.ToUpperInvariant().Contains(searchText.ToUpperInvariant())) ||
+ (elem.Agency != null && elem.Agency.ToUpperInvariant().Contains(searchText.ToUpperInvariant())) ||
+ (elem.Berth != null && elem.Berth.ToUpperInvariant().Contains(searchText.ToUpperInvariant())) ||
+ (elem.PortArea != null && elem.PortArea.ToUpperInvariant().Contains(searchText.ToUpperInvariant())));
+ }
+ this.listBoxAreas.ItemsSource = filtered;
+ }
+ }
+
+ #endregion
+
+ }
+}