This repository has been archived on 2025-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
BreCal/src/BreCalClient/ShipcallControl.xaml.cs

99 lines
2.9 KiB
C#

// Copyright (c) 2023 schick Informatik
// Description: Show general shipcall info
//
using System;
using System.Windows;
using System.Windows.Controls;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for ShipcallControl.xaml
/// </summary>
public partial class ShipcallControl : UserControl
{
#region Construction
public ShipcallControl()
{
InitializeComponent();
}
#endregion
#region events
public event Action<ShipcallControl>? EditRequested;
public event Action<ShipcallControl>? TimesRequested;
public event Action<ShipcallControl>? OpenExtraRequested;
#endregion
#region Properties
/// <summary>
/// this is our datasource
/// </summary>
public ShipcallControlModel? ShipcallControlModel { get; set; }
#endregion
#region public methods
public void RefreshData()
{
if (this.ShipcallControlModel == null) return;
string? name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.AGENCY);
if (name != null)
this.labelAgent.Content = name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.MOORING);
if (name != null)
this.labelMooring.Content = name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.PILOT);
if (name != null)
this.labelPilot.Content = name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TUG);
if (name != null)
this.labelTug.Content = name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
if (name != null)
this.labelPortAuthority.Content = name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL);
if (name != null)
this.labelTerminal.Content = name;
}
#endregion
#region event handler
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this.ShipcallControlModel;
}
private void buttonListTimes_Click(object sender, RoutedEventArgs e)
{
this.TimesRequested?.Invoke(this);
}
private void buttonEditShipcall_Click(object sender, RoutedEventArgs e)
{
this.EditRequested?.Invoke(this);
}
private void buttonOpenDropDown_Click(object sender, RoutedEventArgs e)
{
this.OpenExtraRequested?.Invoke(this);
}
#endregion
}
}