diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj
index 38ee163..d69e72f 100644
--- a/src/BreCalClient/BreCalClient.csproj
+++ b/src/BreCalClient/BreCalClient.csproj
@@ -25,6 +25,7 @@
+
@@ -70,6 +71,7 @@
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml
index ee95adf..ceae106 100644
--- a/src/BreCalClient/EditShipcallControl.xaml
+++ b/src/BreCalClient/EditShipcallControl.xaml
@@ -69,11 +69,23 @@
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,9 +147,9 @@
-
-
-
+
+
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs
index 6730be8..d4ae813 100644
--- a/src/BreCalClient/EditShipcallControl.xaml.cs
+++ b/src/BreCalClient/EditShipcallControl.xaml.cs
@@ -23,7 +23,7 @@ namespace BreCalClient
#region Properties
- public Shipcall Shipcall { get; set; } = new ();
+ public ShipcallControlModel ShipcallModel { get; set; } = new ();
public List Participants { get; set; } = new();
@@ -98,26 +98,42 @@ namespace BreCalClient
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
{
this.comboBoxAgency.SelectedIndex = -1;
+ this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.AGENCY);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
+ this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.MOORING);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
+ this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
+ this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
+ this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.TERMINAL);
+ }
+
+ private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
+ {
+ this.comboBoxArrivalBerth.SelectedIndex = -1;
+ this.ShipcallModel.Berth = "";
+ }
+
+ private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
+ {
+ this.comboBoxDepartureBerth.SelectedIndex -= 1;
}
#endregion
@@ -126,100 +142,132 @@ namespace BreCalClient
private void CopyToModel()
{
- this.Shipcall.Type = (int) this.comboBoxCategories.SelectedItem;
- this.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
- this.Shipcall.Voyage = this.textBoxVoyage.Text.Trim();
- this.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
- this.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
- this.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
- this.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
- this.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
- this.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
- this.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
- this.Shipcall.Draft = (float?) this.doubleUpDownDraft.Value;
- this.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
- this.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
- this.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
- this.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
- this.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
- this.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
- this.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
- this.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
- this.Shipcall.TugRequired = this.checkBoxTugRequired.IsChecked;
- if(this.comboBoxPierside.SelectedIndex >= 0)
+ if (this.ShipcallModel.Shipcall != null)
{
- this.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
+ this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem;
+ this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
+ this.ShipcallModel.Shipcall.Voyage = this.textBoxVoyage.Text.Trim();
+ this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
+ this.ShipcallModel.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
+ this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
+ this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
+ this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
+ this.ShipcallModel.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
+ this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
+ this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
+ this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
+ this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
+ this.ShipcallModel.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
+ this.ShipcallModel.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
+ this.ShipcallModel.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
+ this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
+ this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
+ this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
+ this.ShipcallModel.Shipcall.TugRequired = this.checkBoxTugRequired.IsChecked;
+ if (this.comboBoxPierside.SelectedIndex >= 0)
+ {
+ this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
+ }
+
+ // remove all and add selected participants
+ this.ShipcallModel.Shipcall.Participants.Clear();
+ this.ShipcallModel.AssignedParticipants.Clear();
+
+ Participant? participant;
+ participant = (Participant?)this.comboBoxAgency.SelectedItem;
+ if (participant != null)
+ {
+ this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
+ this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
+ }
+ participant = (Participant?)this.comboBoxMooring.SelectedItem;
+ if (participant != null)
+ {
+ this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
+ this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
+ }
+ participant = (Participant?)this.comboBoxPilot.SelectedItem;
+ if (participant != null)
+ {
+ this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
+ this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
+ }
+ participant = (Participant?)this.comboBoxTerminal.SelectedItem;
+ if (participant != null) {
+ this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
+ this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
+ }
+ participant = (Participant?)this.comboBoxTug.SelectedItem;
+ if (participant != null) {
+ this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
+ this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
+ }
+
+ // BSMD and port authority are always added
+ foreach (Participant p in Participants)
+ {
+ if (p.Type == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
+ {
+ this.ShipcallModel.Shipcall.Participants.Add(p.Id);
+ this.ShipcallModel.AssignedParticipants[p.Type] = p;
+ }
+ if (p.Type == (int)Extensions.ParticipantType.BSMD)
+ {
+ this.ShipcallModel.Shipcall.Participants.Add(p.Id);
+ this.ShipcallModel.AssignedParticipants[p.Type] = p;
+ }
+ }
}
-
- // remove all and add selected participants
- this.Shipcall.Participants.Clear();
- Participant? participant;
- participant = (Participant?) this.comboBoxAgency.SelectedItem;
- if (participant != null) this.Shipcall.Participants.Add(participant.Id);
- participant = (Participant?) this.comboBoxMooring.SelectedItem;
- if (participant != null) this.Shipcall.Participants.Add(participant.Id);
- participant = (Participant?) this.comboBoxPilot.SelectedItem;
- if (participant != null) this.Shipcall.Participants.Add(participant.Id);
- participant = (Participant?) this.comboBoxTerminal.SelectedItem;
- if (participant != null) this.Shipcall.Participants.Add(participant.Id);
- participant = (Participant?) this.comboBoxTug.SelectedItem;
- if (participant != null) this.Shipcall.Participants.Add(participant.Id);
-
- // BSMD and port authority are always added
- foreach(Participant p in Participants)
- {
- if(p.Type == (int) Extensions.ParticipantType.PORT_ADMINISTRATION) this.Shipcall.Participants.Add(p.Id);
- if (p.Type == (int)Extensions.ParticipantType.BSMD) this.Shipcall.Participants.Add(p.Id);
- }
-
}
private void CopyToControls()
{
- if (this.Shipcall == null) return;
- this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum) this.Shipcall.Type;
- if(this.Shipcall.Eta != DateTime.MinValue)
- this.datePickerETA.Value = this.Shipcall.Eta;
- this.textBoxVoyage.Text = this.Shipcall.Voyage;
- this.datePickerETD.Value = this.Shipcall.Etd;
- this.checkBoxAnchored.IsChecked = this.Shipcall.Anchored;
- this.comboBoxShip.SelectedValue = this.Shipcall.ShipId;
- this.comboBoxArrivalBerth.SelectedValue = this.Shipcall.ArrivalBerthId;
- this.comboBoxDepartureBerth.SelectedValue = this.Shipcall.DepartureBerthId;
- this.checkBoxBunkering.IsChecked = this.Shipcall.Bunkering;
- this.checkBoxCanceled.IsChecked = this.Shipcall.Canceled;
- this.doubleUpDownDraft.Value = this.Shipcall.Draft;
- this.checkBoxMooredLock.IsChecked = this.Shipcall.MooredLock;
-
- this.checkBoxRainsensitiveCargo.IsChecked = this.Shipcall.RainSensitiveCargo;
- this.checkBoxPilotRequired.IsChecked = this.Shipcall.PilotRequired;
- this.checkBoxReplenishingLock.IsChecked = this.Shipcall.ReplenishingLock;
- this.checkBoxReplenishingTerminal.IsChecked = this.Shipcall.ReplenishingTerminal;
- this.integerUpDownRecommendedTugs.Value = this.Shipcall.RecommendedTugs;
- this.datePickerTidalWindowFrom.Value = this.Shipcall.TidalWindowFrom;
- this.datePickerTidalWindowTo.Value = this.Shipcall.TidalWindowTo;
- this.checkBoxTugRequired.IsChecked = this.Shipcall.TugRequired;
- if(this.Shipcall.PierSide.HasValue)
+ if (this.ShipcallModel == null) return;
+ if (this.ShipcallModel.Shipcall != null)
{
- if (this.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
- else this.comboBoxPierside.SelectedIndex = 1;
+ this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum)this.ShipcallModel.Shipcall.Type;
+ if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
+ this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
+ this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
+ this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
+ this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored;
+ this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
+ this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
+ this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
+ this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering;
+ this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled;
+ this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
+ this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
+
+ this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo;
+ this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired;
+ this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock;
+ this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal;
+ this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
+ this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
+ this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
+ this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired;
+ if (this.ShipcallModel.Shipcall.PierSide.HasValue)
+ {
+ if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
+ else this.comboBoxPierside.SelectedIndex = 1;
+ }
+
+ if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
+
+ foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
+ {
+ if (((List)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
+ if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
+ if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id;
+ if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id;
+ if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id;
+ }
}
-
- if (this.Shipcall.Participants == null) this.Shipcall.Participants = new();
-
- foreach(int participant_id in this.Shipcall.Participants)
- {
- if (((List)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
- if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
- if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id;
- if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id;
- if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id;
- }
-
}
- #endregion
+ #endregion
}
}
diff --git a/src/BreCalClient/EditTimesControl.xaml b/src/BreCalClient/EditTimesControl.xaml
index cec997c..879d663 100644
--- a/src/BreCalClient/EditTimesControl.xaml
+++ b/src/BreCalClient/EditTimesControl.xaml
@@ -8,7 +8,7 @@
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textEditTimes}" Height="320" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
+ Title="{x:Static p:Resources.textEditTimes}" Height="330" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
@@ -35,16 +35,76 @@
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/EditTimesControl.xaml.cs b/src/BreCalClient/EditTimesControl.xaml.cs
index 4ef8f72..a6bdbba 100644
--- a/src/BreCalClient/EditTimesControl.xaml.cs
+++ b/src/BreCalClient/EditTimesControl.xaml.cs
@@ -110,5 +110,39 @@ namespace BreCalClient
#endregion
+ #region clear value event handler
+
+ private void contextMenuItemClearETA_Click(object sender, RoutedEventArgs e)
+ {
+ this.datePickerETABerth.Value = null;
+ }
+
+ private void contextMenuItemClearETD_Click(object sender, RoutedEventArgs e)
+ {
+ this.datePickerETDBerth.Value = null;
+ }
+
+ private void contextMenuItemClearLockTime_Click(object sender, RoutedEventArgs e)
+ {
+ this.datePickerLockTime.Value = null;
+ }
+
+ private void contextMenuItemClearZoneEntry_Click(object sender, RoutedEventArgs e)
+ {
+ this.datePickerZoneEntry.Value = null;
+ }
+
+ private void contextMenuItemClearOperationStart_Click(object sender, RoutedEventArgs e)
+ {
+ this.datePickerOperationStart.Value = null;
+ }
+
+ private void contextMenuItemClearOperationEnd_Click(object sender, RoutedEventArgs e)
+ {
+ this.datePickerOperationEnd.Value = null;
+ }
+
+ #endregion
+
}
}
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index db621ce..6e672d9 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -36,6 +36,7 @@ namespace BreCalClient
private readonly Dictionary _shipCallControlDict = new();
private readonly CancellationTokenSource _tokenSource = new();
private LoginResult? _loginResult;
+ private bool _refreshImmediately = false;
#endregion
@@ -129,8 +130,13 @@ namespace BreCalClient
if (esc.ShowDialog() ?? false)
{
// create UI & save new dialog model
- this.UpdateShipcallUI(esc.Shipcall, new List());
- this._api.ShipcallsPost(esc.Shipcall);
+ if (esc.ShipcallModel.Shipcall != null)
+ {
+ this.UpdateShipcallUI(esc.ShipcallModel.Shipcall, new List());
+ this._api.ShipcallsPost(esc.ShipcallModel.Shipcall);
+ _refreshImmediately = true;
+ _tokenSource.Cancel();
+ }
}
}
@@ -206,8 +212,9 @@ namespace BreCalClient
public async Task RefreshShipcalls()
{
- while (!_tokenSource.Token.IsCancellationRequested)
+ while (!_tokenSource.Token.IsCancellationRequested || _refreshImmediately)
{
+ _refreshImmediately = false;
List? shipcalls = null;
try
{
@@ -252,7 +259,11 @@ namespace BreCalClient
}
}
- await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token);
+ try
+ {
+ await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token);
+ }
+ catch(TaskCanceledException) { }
}
}
@@ -311,13 +322,12 @@ namespace BreCalClient
}
private async void Sc_EditRequested(ShipcallControl obj)
- {
- Shipcall? sc = obj.ShipcallControlModel?.Shipcall;
- if (sc != null)
+ {
+ if (obj.ShipcallControlModel != null)
{
EditShipcallControl esc = new()
{
- Shipcall = sc,
+ ShipcallModel = obj.ShipcallControlModel,
Ships = _ships,
Participants = _participants,
Berths = _berths
@@ -327,8 +337,10 @@ namespace BreCalClient
{
try
{
- await _api.ShipcallsPutAsync(sc);
+ await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall);
obj.RefreshData();
+ _refreshImmediately = true;
+ _tokenSource.Cancel();
}
catch (Exception ex)
{
@@ -366,7 +378,8 @@ namespace BreCalClient
await _api.TimesPostAsync(etc.Times);
obj.ShipcallControlModel?.Times.Add(etc.Times);
}
- obj.RefreshData();
+ _refreshImmediately = true;
+ _tokenSource.Cancel();
}
catch (Exception ex)
{
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index 6c635c3..8d46401 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -150,6 +150,16 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ public static byte[] delete {
+ get {
+ object obj = ResourceManager.GetObject("delete", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Byte[].
///
@@ -306,6 +316,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Clear value.
+ ///
+ public static string textClearValue {
+ get {
+ return ResourceManager.GetString("textClearValue", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Close.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index db118d4..99f7bf4 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -361,4 +361,7 @@
Zuordnung entfernen
+
+ Eingabe löschen
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index ead164b..622a45c 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -145,6 +145,9 @@
containership.ico;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ delete.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
emergency_stop_button.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
@@ -196,6 +199,9 @@
Clear assignment
+
+ Clear value
+
Close
diff --git a/src/BreCalClient/Resources/delete.png b/src/BreCalClient/Resources/delete.png
new file mode 100644
index 0000000..23d04fb
Binary files /dev/null and b/src/BreCalClient/Resources/delete.png differ
diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs
index c84ee38..55fb7a6 100644
--- a/src/BreCalClient/ShipcallControl.xaml.cs
+++ b/src/BreCalClient/ShipcallControl.xaml.cs
@@ -31,9 +31,7 @@ namespace BreCalClient
public event Action? EditRequested;
- public event Action? EditTimesRequested;
-
- public event Action? OpenExtraRequested;
+ public event Action? EditTimesRequested;
#endregion
@@ -59,56 +57,56 @@ namespace BreCalClient
string agentName = "";
string? name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.AGENCY);
- if (name != null)
- {
- this.labelAgent.Content = name;
- agentName = name;
- }
+ if (name != null) agentName = name;
+ this.labelAgent.Content = name ?? "- / -";
+
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.MOORING);
- this.labelMooring.Content = (name != null) ? name : "- / -";
+ this.labelMooring.Content = name ?? "- / -";
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.PILOT);
- this.labelPilot.Content = (name != null) ? name : "- / - ";
+ this.labelPilot.Content = name ?? "- / - ";
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TUG);
- this.labelTug.Content = (name != null) ? name : "- / - ";
+ this.labelTug.Content = name ?? "- / - ";
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
- this.labelPortAuthority.Content = (name != null) ? name : "- / - ";
+ this.labelPortAuthority.Content = name ?? "- / - ";
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL);
- this.labelTerminal.Content = (name != null) ? name : "- / - ";
+ this.labelTerminal.Content = name ?? "- / - ";
- if(App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL)) {
+ if(App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL)))
+ {
this.labelTerminal.FontWeight = FontWeights.Bold;
this.labelTerminal.Foreground = Brushes.LightYellow;
}
- if(App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT))
+ if(App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PILOT)))
{
this.labelPilot.FontWeight = FontWeights.Bold;
this.labelPilot.Foreground = Brushes.LightYellow;
}
- if(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY))
+ if(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))
{
this.labelAgent.FontWeight = FontWeights.Bold;
this.labelAgent.Foreground = Brushes.LightYellow;
}
- if(App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING))
+ if(App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.MOORING)))
{
this.labelMooring.FontWeight = FontWeights.Bold;
this.labelMooring.Foreground = Brushes.LightYellow;
}
- if(App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
+ if(App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION)))
{
this.labelPortAuthority.FontWeight = FontWeights.Bold;
this.labelPortAuthority.Foreground = Brushes.LightYellow;
}
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TUG)))
{
this.labelTug.FontWeight = FontWeights.Bold;
this.labelTug.Foreground = Brushes.LightYellow;
}
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD) ||
+ (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))))
{
this.labelShipName.FontWeight = FontWeights.Bold;
this.labelShipName.Foreground = Brushes.LightYellow;
@@ -129,7 +127,7 @@ namespace BreCalClient
default:
break;
}
- this.textBlockAgency.Text = this.ShipcallControlModel?.Agency;
+
this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
@@ -158,7 +156,7 @@ namespace BreCalClient
{
this.labelAgencyETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelAgencyETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
- this.textBlockAgency.Text = times.Remarks;
+ this.textBlockAgencyRemarks.Text = times.Remarks;
}
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.MOORING))
{
@@ -205,24 +203,21 @@ namespace BreCalClient
}
- private void buttonEditShipcall_Click(object sender, RoutedEventArgs e)
+ private void buttonEditShipcall_Click(object? sender, RoutedEventArgs? e)
{
+ if(App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD) ||
+ (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))))
this.EditRequested?.Invoke(this);
- }
-
- private void buttonOpenDropDown_Click(object sender, RoutedEventArgs e)
- {
- this.OpenExtraRequested?.Invoke(this);
- }
+ }
private void Image_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- this.EditRequested?.Invoke(this);
+ this.buttonEditShipcall_Click(null, null);
}
private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))
{
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
this.EditTimesRequested?.Invoke(this, times);
@@ -231,7 +226,7 @@ namespace BreCalClient
private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.MOORING)))
{
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
this.EditTimesRequested?.Invoke(this, times);
@@ -240,7 +235,7 @@ namespace BreCalClient
private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION)))
{
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
this.EditTimesRequested?.Invoke(this, times);
@@ -249,7 +244,7 @@ namespace BreCalClient
private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PILOT)))
{
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT);
this.EditTimesRequested?.Invoke(this, times);
@@ -258,7 +253,7 @@ namespace BreCalClient
private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TUG)))
{
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG);
this.EditTimesRequested?.Invoke(this, times);
@@ -267,7 +262,7 @@ namespace BreCalClient
private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL))
+ if (App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL)))
{
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
this.EditTimesRequested?.Invoke(this, times);
diff --git a/src/BreCalClient/ShipcallControlModel.cs b/src/BreCalClient/ShipcallControlModel.cs
index 0afc655..b857b20 100644
--- a/src/BreCalClient/ShipcallControlModel.cs
+++ b/src/BreCalClient/ShipcallControlModel.cs
@@ -42,9 +42,7 @@ namespace BreCalClient
#region Properties
public Shipcall? Shipcall { get; set; }
- public Ship? Ship { get; set; }
-
- public string? Agency { get; set; }
+ public Ship? Ship { get; set; }
public string? Berth { get; set; }
@@ -122,7 +120,17 @@ namespace BreCalClient
return p.Name;
}
return null;
- }
+ }
+
+ internal int? GetParticipantIdForType(Extensions.ParticipantType participantType)
+ {
+ foreach(Participant p in AssignedParticipants.Values)
+ {
+ if(p.IsFlagSet(participantType))
+ return p.Id;
+ }
+ return null;
+ }
private bool IsFlagSet(StatusFlags flag)
{