From df641f096c29663120843935117c31cdbbc381fa Mon Sep 17 00:00:00 2001 From: puls200 Date: Mon, 18 Sep 2023 20:36:44 +0200 Subject: [PATCH] added terminal times control --- src/BreCalClient/MainWindow.xaml.cs | 11 +++-------- src/BreCalClient/Properties/Settings.Designer.cs | 2 +- src/BreCalClient/ShipcallControl.xaml.cs | 15 ++++++++------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index a765d2f..61e83a5 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -529,20 +529,15 @@ namespace BreCalClient } } - private async void Sc_EditTimesRequested(ShipcallControl obj, Times? times) + private async void Sc_EditTimesRequested(ShipcallControl obj, Times? times, Extensions.ParticipantType participantType) { // show a dialog that lets the user create / update times for the given shipcall - IEditTimesControl etc = new EditTimesControl(); + IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl(); bool wasEdit = false; if (times != null) { etc.Times = times; - wasEdit = true; - - // wie bekommen wir hier raus ob terminal oder agent gemeint ist? - - // if(_participantLookupDict[times.ParticipantId].Type == - + wasEdit = true; } if(etc.ShowDialog() ?? false) { diff --git a/src/BreCalClient/Properties/Settings.Designer.cs b/src/BreCalClient/Properties/Settings.Designer.cs index 78d6206..6f08fee 100644 --- a/src/BreCalClient/Properties/Settings.Designer.cs +++ b/src/BreCalClient/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace BreCalClient.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs index 868b1b7..ec58724 100644 --- a/src/BreCalClient/ShipcallControl.xaml.cs +++ b/src/BreCalClient/ShipcallControl.xaml.cs @@ -10,6 +10,7 @@ using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; + namespace BreCalClient { /// @@ -31,7 +32,7 @@ namespace BreCalClient public event Action? EditRequested; - public event Action? EditTimesRequested; + internal event Action? EditTimesRequested; #endregion @@ -220,7 +221,7 @@ namespace BreCalClient if (App.Participant.IsTypeFlagSet(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); + this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.AGENCY); } } @@ -229,7 +230,7 @@ namespace BreCalClient if (App.Participant.IsTypeFlagSet(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); + this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.MOORING); } } @@ -238,7 +239,7 @@ namespace BreCalClient if (App.Participant.IsTypeFlagSet(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); + this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PORT_ADMINISTRATION); } } @@ -247,7 +248,7 @@ namespace BreCalClient if (App.Participant.IsTypeFlagSet(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); + this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PILOT); } } @@ -256,7 +257,7 @@ namespace BreCalClient if (App.Participant.IsTypeFlagSet(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); + this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.TUG); } } @@ -265,7 +266,7 @@ namespace BreCalClient if (App.Participant.IsTypeFlagSet(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); + this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.TERMINAL); } }