Shipcall list now working with traffic light on bound property, data from server

This commit is contained in:
Daniel Schick 2023-07-27 12:55:39 +02:00
parent 8a9e3884fe
commit 3148ed32b1
17 changed files with 691 additions and 137 deletions

View File

@ -1,7 +1,7 @@
//----------------------
// <auto-generated>
// Generated REST API Client Code Generator v1.7.17.0 on 14.07.2023 16:01:23
// Generated REST API Client Code Generator v1.7.17.0 on 26.07.2023 19:35:38
// Using the tool OpenAPI Generator v6.6.0
// </auto-generated>
//----------------------
@ -117,10 +117,10 @@ namespace BreCalClient.misc.Api
/// gets a particular participant entry corresponding to user id
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Participant</returns>
Participant ParticipantGet(int userId, int operationIndex = 0);
/// <returns>List&lt;Participant&gt;</returns>
List<Participant> ParticipantGet(int? userId = default(int?), int operationIndex = 0);
/// <summary>
/// gets a particular participant entry corresponding to user id
/// </summary>
@ -128,18 +128,17 @@ namespace BreCalClient.misc.Api
///
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Participant</returns>
ApiResponse<Participant> ParticipantGetWithHttpInfo(int userId, int operationIndex = 0);
/// <returns>ApiResponse of List&lt;Participant&gt;</returns>
ApiResponse<List<Participant>> ParticipantGetWithHttpInfo(int? userId = default(int?), int operationIndex = 0);
/// <summary>
/// Gets a list of ship calls
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>List&lt;Shipcall&gt;</returns>
List<Shipcall> ShipcallsGet(int participantId, int operationIndex = 0);
List<Shipcall> ShipcallsGet(int operationIndex = 0);
/// <summary>
/// Gets a list of ship calls
/// </summary>
@ -147,10 +146,9 @@ namespace BreCalClient.misc.Api
///
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of List&lt;Shipcall&gt;</returns>
ApiResponse<List<Shipcall>> ShipcallsGetWithHttpInfo(int participantId, int operationIndex = 0);
ApiResponse<List<Shipcall>> ShipcallsGetWithHttpInfo(int operationIndex = 0);
/// <summary>
/// Create a new ship call
/// </summary>
@ -369,11 +367,11 @@ namespace BreCalClient.misc.Api
///
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Participant</returns>
System.Threading.Tasks.Task<Participant> ParticipantGetAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <returns>Task of List&lt;Participant&gt;</returns>
System.Threading.Tasks.Task<List<Participant>> ParticipantGetAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// gets a particular participant entry corresponding to user id
/// </summary>
@ -381,11 +379,11 @@ namespace BreCalClient.misc.Api
///
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (Participant)</returns>
System.Threading.Tasks.Task<ApiResponse<Participant>> ParticipantGetWithHttpInfoAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <returns>Task of ApiResponse (List&lt;Participant&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Participant>>> ParticipantGetWithHttpInfoAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Gets a list of ship calls
/// </summary>
@ -393,11 +391,10 @@ namespace BreCalClient.misc.Api
///
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of List&lt;Shipcall&gt;</returns>
System.Threading.Tasks.Task<List<Shipcall>> ShipcallsGetAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<List<Shipcall>> ShipcallsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Gets a list of ship calls
/// </summary>
@ -405,11 +402,10 @@ namespace BreCalClient.misc.Api
///
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (List&lt;Shipcall&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Shipcall>>> ShipcallsGetWithHttpInfoAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<ApiResponse<List<Shipcall>>> ShipcallsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Create a new ship call
/// </summary>
@ -1051,22 +1047,22 @@ namespace BreCalClient.misc.Api
/// gets a particular participant entry corresponding to user id
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Participant</returns>
public Participant ParticipantGet(int userId, int operationIndex = 0)
/// <returns>List&lt;Participant&gt;</returns>
public List<Participant> ParticipantGet(int? userId = default(int?), int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse<Participant> localVarResponse = ParticipantGetWithHttpInfo(userId);
BreCalClient.misc.Client.ApiResponse<List<Participant>> localVarResponse = ParticipantGetWithHttpInfo(userId);
return localVarResponse.Data;
}
/// <summary>
/// gets a particular participant entry corresponding to user id
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Participant</returns>
public BreCalClient.misc.Client.ApiResponse<Participant> ParticipantGetWithHttpInfo(int userId, int operationIndex = 0)
/// <returns>ApiResponse of List&lt;Participant&gt;</returns>
public BreCalClient.misc.Client.ApiResponse<List<Participant>> ParticipantGetWithHttpInfo(int? userId = default(int?), int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
@ -1085,7 +1081,10 @@ namespace BreCalClient.misc.Api
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
if (userId != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId));
}
localVarRequestOptions.Operation = "DefaultApi.ParticipantGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
@ -1094,7 +1093,7 @@ namespace BreCalClient.misc.Api
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Get<Participant>("/participant", localVarRequestOptions, this.Configuration);
var localVarResponse = this.Client.Get<List<Participant>>("/participant", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ParticipantGet", localVarResponse);
@ -1109,24 +1108,24 @@ namespace BreCalClient.misc.Api
/// gets a particular participant entry corresponding to user id
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Participant</returns>
public async System.Threading.Tasks.Task<Participant> ParticipantGetAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
/// <returns>Task of List&lt;Participant&gt;</returns>
public async System.Threading.Tasks.Task<List<Participant>> ParticipantGetAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse<Participant> localVarResponse = await ParticipantGetWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false);
BreCalClient.misc.Client.ApiResponse<List<Participant>> localVarResponse = await ParticipantGetWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// gets a particular participant entry corresponding to user id
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call.</param>
/// <param name="userId">**Id of user**. *Example: 2*. User id returned by verify call. (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (Participant)</returns>
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<Participant>> ParticipantGetWithHttpInfoAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
/// <returns>Task of ApiResponse (List&lt;Participant&gt;)</returns>
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<List<Participant>>> ParticipantGetWithHttpInfoAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
@ -1145,7 +1144,10 @@ namespace BreCalClient.misc.Api
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
if (userId != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId));
}
localVarRequestOptions.Operation = "DefaultApi.ParticipantGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
@ -1154,7 +1156,7 @@ namespace BreCalClient.misc.Api
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.GetAsync<Participant>("/participant", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
var localVarResponse = await this.AsynchronousClient.GetAsync<List<Participant>>("/participant", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ParticipantGet", localVarResponse);
@ -1169,22 +1171,20 @@ namespace BreCalClient.misc.Api
/// Gets a list of ship calls
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>List&lt;Shipcall&gt;</returns>
public List<Shipcall> ShipcallsGet(int participantId, int operationIndex = 0)
public List<Shipcall> ShipcallsGet(int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse<List<Shipcall>> localVarResponse = ShipcallsGetWithHttpInfo(participantId);
BreCalClient.misc.Client.ApiResponse<List<Shipcall>> localVarResponse = ShipcallsGetWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Gets a list of ship calls
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of List&lt;Shipcall&gt;</returns>
public BreCalClient.misc.Client.ApiResponse<List<Shipcall>> ShipcallsGetWithHttpInfo(int participantId, int operationIndex = 0)
public BreCalClient.misc.Client.ApiResponse<List<Shipcall>> ShipcallsGetWithHttpInfo(int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
@ -1203,7 +1203,6 @@ namespace BreCalClient.misc.Api
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId));
localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
@ -1227,24 +1226,22 @@ namespace BreCalClient.misc.Api
/// Gets a list of ship calls
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of List&lt;Shipcall&gt;</returns>
public async System.Threading.Tasks.Task<List<Shipcall>> ShipcallsGetAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<List<Shipcall>> ShipcallsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse<List<Shipcall>> localVarResponse = await ShipcallsGetWithHttpInfoAsync(participantId, operationIndex, cancellationToken).ConfigureAwait(false);
BreCalClient.misc.Client.ApiResponse<List<Shipcall>> localVarResponse = await ShipcallsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// Gets a list of ship calls
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (List&lt;Shipcall&gt;)</returns>
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<List<Shipcall>>> ShipcallsGetWithHttpInfoAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<List<Shipcall>>> ShipcallsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
@ -1263,7 +1260,6 @@ namespace BreCalClient.misc.Api
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId));
localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
@ -6010,7 +6006,7 @@ namespace BreCalClient.misc.Model
/// <param name="recommendedTugs">recommendedTugs.</param>
/// <param name="created">created.</param>
/// <param name="modified">modified.</param>
public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime etd = default(DateTime), int arrivalBerthId = default(int), int departureBerthId = default(int), bool tugReguired = default(bool), bool pilotRequired = default(bool), int flags = default(int), bool pierSide = default(bool), bool bunkering = default(bool), bool replenishing = default(bool), float draft = default(float), DateTime tidalWindowFrom = default(DateTime), DateTime tidalWindowTo = default(DateTime), bool rainSensitiveCargo = default(bool), int recommendedTugs = default(int), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugReguired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishing = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
{
this.Id = id;
this.ShipId = shipId;
@ -6022,6 +6018,11 @@ namespace BreCalClient.misc.Model
throw new ArgumentNullException("voyage is a required property for Shipcall and cannot be null");
}
this.Voyage = voyage;
// to ensure "etd" is required (not null)
if (etd == null)
{
throw new ArgumentNullException("etd is a required property for Shipcall and cannot be null");
}
this.Etd = etd;
this.ArrivalBerthId = arrivalBerthId;
this.DepartureBerthId = departureBerthId;
@ -6064,72 +6065,72 @@ namespace BreCalClient.misc.Model
/// Gets or Sets Etd
/// </summary>
[DataMember(Name = "etd", IsRequired = true, EmitDefaultValue = true)]
public DateTime Etd { get; set; }
public DateTime? Etd { get; set; }
/// <summary>
/// Gets or Sets ArrivalBerthId
/// </summary>
[DataMember(Name = "arrival_berth_id", EmitDefaultValue = true)]
public int ArrivalBerthId { get; set; }
public int? ArrivalBerthId { get; set; }
/// <summary>
/// Gets or Sets DepartureBerthId
/// </summary>
[DataMember(Name = "departure_berth_id", EmitDefaultValue = true)]
public int DepartureBerthId { get; set; }
public int? DepartureBerthId { get; set; }
/// <summary>
/// Gets or Sets TugReguired
/// </summary>
[DataMember(Name = "tug_reguired", EmitDefaultValue = true)]
public bool TugReguired { get; set; }
public bool? TugReguired { get; set; }
/// <summary>
/// Gets or Sets PilotRequired
/// </summary>
[DataMember(Name = "pilot_required", EmitDefaultValue = true)]
public bool PilotRequired { get; set; }
public bool? PilotRequired { get; set; }
/// <summary>
/// Gets or Sets Flags
/// </summary>
[DataMember(Name = "flags", EmitDefaultValue = true)]
public int Flags { get; set; }
public int? Flags { get; set; }
/// <summary>
/// Gets or Sets PierSide
/// </summary>
[DataMember(Name = "pier_side", EmitDefaultValue = true)]
public bool PierSide { get; set; }
public bool? PierSide { get; set; }
/// <summary>
/// Gets or Sets Bunkering
/// </summary>
[DataMember(Name = "bunkering", EmitDefaultValue = true)]
public bool Bunkering { get; set; }
public bool? Bunkering { get; set; }
/// <summary>
/// Gets or Sets Replenishing
/// </summary>
[DataMember(Name = "replenishing", EmitDefaultValue = true)]
public bool Replenishing { get; set; }
public bool? Replenishing { get; set; }
/// <summary>
/// Gets or Sets Draft
/// </summary>
[DataMember(Name = "draft", EmitDefaultValue = true)]
public float Draft { get; set; }
public float? Draft { get; set; }
/// <summary>
/// Gets or Sets TidalWindowFrom
/// </summary>
[DataMember(Name = "tidal_window_from", EmitDefaultValue = true)]
public DateTime TidalWindowFrom { get; set; }
public DateTime? TidalWindowFrom { get; set; }
/// <summary>
/// Gets or Sets TidalWindowTo
/// </summary>
[DataMember(Name = "tidal_window_to", EmitDefaultValue = true)]
public DateTime TidalWindowTo { get; set; }
public DateTime? TidalWindowTo { get; set; }
/// <summary>
/// Gets or Sets RainSensitiveCargo
/// </summary>
[DataMember(Name = "rain_sensitive_cargo", EmitDefaultValue = true)]
public bool RainSensitiveCargo { get; set; }
public bool? RainSensitiveCargo { get; set; }
/// <summary>
/// Gets or Sets RecommendedTugs
/// </summary>
[DataMember(Name = "recommended_tugs", EmitDefaultValue = true)]
public int RecommendedTugs { get; set; }
public int? RecommendedTugs { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
@ -6230,39 +6231,48 @@ namespace BreCalClient.misc.Model
) &&
(
this.ArrivalBerthId == input.ArrivalBerthId ||
this.ArrivalBerthId.Equals(input.ArrivalBerthId)
(this.ArrivalBerthId != null &&
this.ArrivalBerthId.Equals(input.ArrivalBerthId))
) &&
(
this.DepartureBerthId == input.DepartureBerthId ||
this.DepartureBerthId.Equals(input.DepartureBerthId)
(this.DepartureBerthId != null &&
this.DepartureBerthId.Equals(input.DepartureBerthId))
) &&
(
this.TugReguired == input.TugReguired ||
this.TugReguired.Equals(input.TugReguired)
(this.TugReguired != null &&
this.TugReguired.Equals(input.TugReguired))
) &&
(
this.PilotRequired == input.PilotRequired ||
this.PilotRequired.Equals(input.PilotRequired)
(this.PilotRequired != null &&
this.PilotRequired.Equals(input.PilotRequired))
) &&
(
this.Flags == input.Flags ||
this.Flags.Equals(input.Flags)
(this.Flags != null &&
this.Flags.Equals(input.Flags))
) &&
(
this.PierSide == input.PierSide ||
this.PierSide.Equals(input.PierSide)
(this.PierSide != null &&
this.PierSide.Equals(input.PierSide))
) &&
(
this.Bunkering == input.Bunkering ||
this.Bunkering.Equals(input.Bunkering)
(this.Bunkering != null &&
this.Bunkering.Equals(input.Bunkering))
) &&
(
this.Replenishing == input.Replenishing ||
this.Replenishing.Equals(input.Replenishing)
(this.Replenishing != null &&
this.Replenishing.Equals(input.Replenishing))
) &&
(
this.Draft == input.Draft ||
this.Draft.Equals(input.Draft)
(this.Draft != null &&
this.Draft.Equals(input.Draft))
) &&
(
this.TidalWindowFrom == input.TidalWindowFrom ||
@ -6276,11 +6286,13 @@ namespace BreCalClient.misc.Model
) &&
(
this.RainSensitiveCargo == input.RainSensitiveCargo ||
this.RainSensitiveCargo.Equals(input.RainSensitiveCargo)
(this.RainSensitiveCargo != null &&
this.RainSensitiveCargo.Equals(input.RainSensitiveCargo))
) &&
(
this.RecommendedTugs == input.RecommendedTugs ||
this.RecommendedTugs.Equals(input.RecommendedTugs)
(this.RecommendedTugs != null &&
this.RecommendedTugs.Equals(input.RecommendedTugs))
) &&
(
this.Created == input.Created ||
@ -6317,15 +6329,42 @@ namespace BreCalClient.misc.Model
{
hashCode = (hashCode * 59) + this.Etd.GetHashCode();
}
if (this.ArrivalBerthId != null)
{
hashCode = (hashCode * 59) + this.ArrivalBerthId.GetHashCode();
}
if (this.DepartureBerthId != null)
{
hashCode = (hashCode * 59) + this.DepartureBerthId.GetHashCode();
}
if (this.TugReguired != null)
{
hashCode = (hashCode * 59) + this.TugReguired.GetHashCode();
}
if (this.PilotRequired != null)
{
hashCode = (hashCode * 59) + this.PilotRequired.GetHashCode();
}
if (this.Flags != null)
{
hashCode = (hashCode * 59) + this.Flags.GetHashCode();
}
if (this.PierSide != null)
{
hashCode = (hashCode * 59) + this.PierSide.GetHashCode();
}
if (this.Bunkering != null)
{
hashCode = (hashCode * 59) + this.Bunkering.GetHashCode();
}
if (this.Replenishing != null)
{
hashCode = (hashCode * 59) + this.Replenishing.GetHashCode();
}
if (this.Draft != null)
{
hashCode = (hashCode * 59) + this.Draft.GetHashCode();
}
if (this.TidalWindowFrom != null)
{
hashCode = (hashCode * 59) + this.TidalWindowFrom.GetHashCode();
@ -6334,8 +6373,14 @@ namespace BreCalClient.misc.Model
{
hashCode = (hashCode * 59) + this.TidalWindowTo.GetHashCode();
}
if (this.RainSensitiveCargo != null)
{
hashCode = (hashCode * 59) + this.RainSensitiveCargo.GetHashCode();
}
if (this.RecommendedTugs != null)
{
hashCode = (hashCode * 59) + this.RecommendedTugs.GetHashCode();
}
if (this.Created != null)
{
hashCode = (hashCode * 59) + this.Created.GetHashCode();

View File

@ -48,13 +48,13 @@ paths:
/shipcalls:
get:
summary: Gets a list of ship calls
parameters:
- name: participant_id
in: query
required: true
description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls"
schema:
type: integer
#parameters:
# - name: participant_id
# in: query
# required: true
# description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls"
# schema:
# type: integer
responses:
200:
description: ship call list
@ -133,7 +133,7 @@ paths:
parameters:
- name: user_id
in: query
required: true
required: false
description: "**Id of user**. *Example: 2*. User id returned by verify call."
schema:
type: integer
@ -143,7 +143,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/participant'
$ref: '#/components/schemas/participant_list'
400:
$ref: '#/components/responses/400'
401:
@ -326,38 +326,53 @@ components:
format: date-time
voyage:
type: string
nullable: true
etd:
type: string
format: date-time
nullable: true
arrival_berth_id:
type: integer
nullable: true
departure_berth_id:
type: integer
nullable: true
tug_reguired:
type: boolean
nullable: true
pilot_required:
type: boolean
nullable: true
flags:
type: integer
nullable: true
pier_side:
type: boolean
nullable: true
bunkering:
type: boolean
nullable: true
replenishing:
type: boolean
nullable: true
draft:
type: number
format: float
nullable: true
tidal_window_from:
type: string
format: date-time
nullable: true
tidal_window_to:
type: string
format: date-time
nullable: true
rain_sensitive_cargo:
type: boolean
nullable: true
recommended_tugs:
type: integer
nullable: true
created:
type: string
format: date-time
@ -513,6 +528,11 @@ components:
format: date-time
nullable: true
participant_list:
type: array
items:
$ref: '#/components/schemas/participant'
login_result:
type: object
description: result structure of a successful login attempt
@ -530,7 +550,8 @@ components:
user_phone:
type: string
exp:
type: float
type: number
format: float
token:
type: string

View File

@ -7,6 +7,15 @@
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\trafficlight_green.png" />
<None Remove="Resources\trafficlight_off.png" />
<None Remove="Resources\trafficlight_on.png" />
<None Remove="Resources\trafficlight_red.png" />
<None Remove="Resources\trafficlight_red_yellow.png" />
<None Remove="Resources\trafficlight_yellow.png" />
</ItemGroup>
<ItemGroup>
<Page Remove="Resources\StringResources.xaml" />
<Page Remove="StringResources.de.xaml" />
@ -29,6 +38,12 @@
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Resources\StringResources.xaml" />
<Resource Include="Resources\trafficlight_green.png" />
<Resource Include="Resources\trafficlight_off.png" />
<Resource Include="Resources\trafficlight_on.png" />
<Resource Include="Resources\trafficlight_red.png" />
<Resource Include="Resources\trafficlight_red_yellow.png" />
<Resource Include="Resources\trafficlight_yellow.png" />
</ItemGroup>
<ItemGroup>
@ -40,4 +55,19 @@
<PackageReference Include="RestSharp" Version="108.0.2" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
extensions: designer.cs generated.cs
extensions: .cs .cpp .h
// Copyright (c) 2023 schick Informatik
// Description:
//
extensions: .aspx .ascx
<%--
Copyright (c) 2023 schick Informatik
--%>
extensions: .vb
'Sample license text.
extensions: .xml .config .xsd
<!--
Sample license text.
-->

View File

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded">
Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing">
<xctk:BusyIndicator Name="busyIndicator" IsBusy="True">
<xctk:BusyIndicator.ProgressBarStyle>
@ -45,7 +45,9 @@
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<ListBox x:Name="listBoxShipCalls" Grid.Row="0" />
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel x:Name="stackPanel"/>
</ScrollViewer>
<StatusBar Grid.Row="1">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>

View File

@ -1,9 +1,15 @@
using System;
// Copyright (c) 2023 schick Informatik
// Description: Bremen calling main window
//
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -26,14 +32,16 @@ namespace BreCalClient
/// </summary>
public partial class MainWindow : Window
{
DefaultApi _api;
ObservableCollection<ShipcallControlModel> _controlModels = new();
List<Ship> _ships = new();
Dictionary<int, Ship> _shipLookupDict = new();
List<Berth> _berths = new();
Dictionary<int, Berth> _berthLookupDict = new();
List<Participant> _participants = new();
Dictionary<int, Participant> _participantLookupDict = new();
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
private DefaultApi _api;
private ObservableCollection<ShipcallControlModel> _controlModels = new();
private List<Ship> _ships = new();
private ConcurrentDictionary<int, Ship> _shipLookupDict = new();
private List<Berth> _berths = new();
private ConcurrentDictionary<int, Berth> _berthLookupDict = new();
private List<Participant> _participants = new();
private Dictionary<int, Participant> _participantLookupDict = new();
private CancellationTokenSource _tokenSource = new CancellationTokenSource();
public MainWindow()
{
@ -49,6 +57,11 @@ namespace BreCalClient
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_tokenSource.Cancel();
}
private async void buttonLogin_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(this.textPassword.Password) || string.IsNullOrEmpty(this.textUsername.Text))
@ -100,32 +113,68 @@ namespace BreCalClient
this._ships = await _api.ShipsGetAsync();
foreach(var ship in this._ships)
_shipLookupDict[ship.Id] = ship;
// this._participants = await _api.ParticipantGetAsync();
this._participants = await _api.ParticipantGetAsync();
foreach(Participant participant in this._participants)
this._participantLookupDict[participant.Id] = participant;
_ = Task.Run(() => RefreshShipcalls());
}
private async void RefreshShipcalls()
public async Task RefreshShipcalls()
{
List<Shipcall> shipcalls = await _api.ShipcallsGetAsync(0); // TODO: this must return all current calls
while (!_tokenSource.Token.IsCancellationRequested)
{
List<Shipcall> shipcalls = await _api.ShipcallsGetAsync();
foreach (Shipcall shipcall in shipcalls)
{
ShipcallControlModel? selectedSCMModel = null;
foreach(ShipcallControlModel scm in this._controlModels)
{
if(scm.Shipcall?.Id == shipcall.Id)
{
selectedSCMModel = scm;
break;
}
}
// TODO: find out if we already have this thing
// yes: update values
if(selectedSCMModel != null)
{
selectedSCMModel.Shipcall = shipcall;
}
else
{
// no: create new entry
ShipcallControlModel scm = new ShipcallControlModel();
scm.Shipcall = shipcall;
if(this._shipLookupDict.ContainsKey(shipcall.Id))
scm.Ship = this._shipLookupDict[shipcall.Id];
if (this._shipLookupDict.ContainsKey(shipcall.ShipId))
scm.Ship = this._shipLookupDict[shipcall.ShipId];
_controlModels.Add(scm);
this.Dispatcher.Invoke(new Action(() =>
{
ShipcallControl sc = new ShipcallControl();
sc.Height = 80;
sc.ShipcallControlModel = scm;
this.stackPanel.Children.Add(sc);
}));
}
}
// TODO: sort this list somehow
// test for deletion, anything in the display that is not in the lookup result
foreach(ShipcallControlModel scm in this._controlModels)
{
}
await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token);
}
}
#endregion
}
}

View File

@ -0,0 +1,123 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BreCalClient.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BreCalClient.Resources.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] trafficlight_green {
get {
object obj = ResourceManager.GetObject("trafficlight_green", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] trafficlight_off {
get {
object obj = ResourceManager.GetObject("trafficlight_off", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] trafficlight_on {
get {
object obj = ResourceManager.GetObject("trafficlight_on", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] trafficlight_red {
get {
object obj = ResourceManager.GetObject("trafficlight_red", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] trafficlight_red_yellow {
get {
object obj = ResourceManager.GetObject("trafficlight_red_yellow", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] trafficlight_yellow {
get {
object obj = ResourceManager.GetObject("trafficlight_yellow", resourceCulture);
return ((byte[])(obj));
}
}
}
}

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="trafficlight_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_off.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_on.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_red_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_red_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -4,9 +4,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BreCalClient"
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="800">
<Grid>
d:DesignHeight="100" d:DesignWidth="800" Loaded="UserControl_Loaded">
<Border Width="1" BorderBrush="Red" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="100">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height=".3*"/>
<RowDefinition Height=".3*"/>
@ -19,7 +21,7 @@
<ColumnDefinition Width=".1*" />
</Grid.ColumnDefinitions>
<Viewbox Grid.Column="0" Grid.Row="0" Grid.RowSpan="2">
<TextBlock x:Name="textBlockShipname" Text="{Binding Ship+Name}" />
<TextBlock x:Name="textBlockShipname" Text="{Binding Ship.Name}" />
</Viewbox>
<Grid Grid.Row="2" Grid.Column="0">
<Grid.ColumnDefinitions>
@ -29,23 +31,60 @@
<ColumnDefinition Width=".3*" />
</Grid.ColumnDefinitions>
<Viewbox>
<TextBlock Text="IMO" />
<TextBlock Text="IMO:"/>
</Viewbox>
<Viewbox Grid.Column="1">
<TextBlock Text="{Binding Ship+IMO}" />
<TextBlock Text="{Binding Ship.Imo}" TextAlignment="Right"/>
</Viewbox>
<Viewbox Grid.Column="2">
<TextBlock Text="Callsign" />
<TextBlock Text="Callsign:" />
</Viewbox>
<Viewbox Grid.Column="3">
<TextBlock Text="{Binding Ship+Callsign}" />
<TextBlock Text="{Binding Ship.Callsign}" />
</Viewbox>
</Grid>
<Viewbox Grid.Column="1" Grid.Row="0">
<TextBlock Text="ETA" />
<TextBlock Text="ETA:" />
</Viewbox>
<Viewbox Grid.Column="2" Grid.Row="0">
<TextBlock Text="{Binding Shipcall.Eta}" />
</Viewbox>
<Viewbox Grid.Column="1" Grid.Row="1">
<TextBlock Text="ETD" />
<TextBlock Text="ETD:" />
</Viewbox>
<Viewbox Grid.Column="2" Grid.Row="1">
<TextBlock Text="{Binding Shipcall.Etd}" />
</Viewbox>
<Viewbox Grid.Column="2" Grid.Row="3">
<TextBlock Text="" />
</Viewbox>
<Image Margin="2" Grid.Column="3" Grid.Row="0" Grid.RowSpan="3">
<Image.Style>
<Style TargetType="Image">
<Setter Property="Source" Value="{Binding NotFolderImage}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.OFF}">
<Setter Property="Source" Value="./Resources/trafficlight_off.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.RED}">
<Setter Property="Source" Value="./Resources/trafficlight_red.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.RED_YELLOW}">
<Setter Property="Source" Value="./Resources/trafficlight_red_yellow.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.GREEN}">
<Setter Property="Source" Value="./Resources/trafficlight_green.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.ALL}">
<Setter Property="Source" Value="./Resources/trafficlight_on.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.YELLOW}">
<Setter Property="Source" Value="./Resources/trafficlight_yellow.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Grid>
</Border>
</UserControl>

View File

@ -1,4 +1,8 @@
using System;
// Copyright (c) 2023 schick Informatik
// Description: Custom control to display a ship call
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -20,9 +24,33 @@ namespace BreCalClient
/// </summary>
public partial class ShipcallControl : UserControl
{
#region Construction
public ShipcallControl()
{
InitializeComponent();
}
#endregion
#region Properties
/// <summary>
/// this is our datasource
/// </summary>
public ShipcallControlModel? ShipcallControlModel { get; set; }
#endregion
#region event handler
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this.ShipcallControlModel;
}
#endregion
}
}

View File

@ -1,5 +1,9 @@
using BreCalClient.misc.Model;
// Copyright (c) 2023 schick Informatik
// Description: Container model for shipcall related info
//
using BreCalClient.misc.Model;
using System;
namespace BreCalClient
{
@ -9,7 +13,65 @@ namespace BreCalClient
/// </summary>
public class ShipcallControlModel
{
public enum TrafficLightMode
{
OFF,
GREEN,
YELLOW,
RED,
RED_YELLOW,
ALL
};
[Flags]
public enum StatusFlags
{
RED,
GREEN,
YELLOW,
BLINK_1,
BLINK_2
};
public Shipcall? Shipcall { get; set; }
public Ship? Ship { get; set; }
public string Test { get { return "Gurkensalat"; } }
public TrafficLightMode LightMode
{
get
{
if(IsFlagSet(StatusFlags.RED))
{
if(IsFlagSet((StatusFlags)StatusFlags.YELLOW))
{
if(IsFlagSet(StatusFlags.GREEN))
{
return TrafficLightMode.ALL;
}
return TrafficLightMode.RED_YELLOW;
}
return TrafficLightMode.RED;
}
if(IsFlagSet(StatusFlags.YELLOW))
return TrafficLightMode.YELLOW;
if(IsFlagSet(StatusFlags.GREEN))
return TrafficLightMode.GREEN;
return TrafficLightMode.OFF;
}
}
#region private helper
private bool IsFlagSet(StatusFlags flag)
{
if(this.Shipcall == null) return false;
return (this.Shipcall.Flags & (int) flag) != 0;
}
#endregion
}
}