122 lines
4.8 KiB
C#
122 lines
4.8 KiB
C#
// Copyright (c) 2017 schick Informatik
|
|
// Description: Bearbeitungsmaske STAT
|
|
//
|
|
|
|
using System.Windows;
|
|
|
|
using bsmd.database;
|
|
using ENI2.EditControls;
|
|
using System.Windows.Media;
|
|
using ENI2.Util;
|
|
using System.Windows.Controls;
|
|
|
|
namespace ENI2.DetailViewControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for ShipDataDetailControl.xaml
|
|
/// </summary>
|
|
public partial class ShipDataDetailControl : DetailBaseControl
|
|
{
|
|
private Message _statMessage;
|
|
|
|
public ShipDataDetailControl()
|
|
{
|
|
InitializeComponent();
|
|
Loaded += ShipDataDetailControl_Loaded;
|
|
}
|
|
|
|
private void ShipDataDetailControl_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.RegisterTextboxChange(this.textBoxVesselName, Message.NotificationClass.STAT);
|
|
this.RegisterComboboxValueChange(this.comboBoxVesselType, Message.NotificationClass.STAT);
|
|
this.RegisterComboboxValueChange(this.comboBoxTransportMode, Message.NotificationClass.STAT);
|
|
this.RegisterComboboxValueChange(this.comboBoxFlag, Message.NotificationClass.STAT);
|
|
this.RegisterIntegerUpDownChange(this.integerUpDownGrossTonnage, Message.NotificationClass.STAT);
|
|
this.RegisterDoubleUpDownChange(this.doubleUpDownLength, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxMMSI, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxCallsign, Message.NotificationClass.STAT);
|
|
this.RegisterLocodeChange(this.locodePortOfRegistry, Message.NotificationClass.STAT);
|
|
this.RegisterDoubleUpDownChange(this.doubleUpDownBeam, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxInmarsatCallNumber, Message.NotificationClass.STAT);
|
|
|
|
this.RegisterTextboxChange(this.textBoxCompanyName, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxStreetNumber, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxPostalCode, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxCountry, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxCompanyId, Message.NotificationClass.STAT);
|
|
this.RegisterTextboxChange(this.textBoxCity, Message.NotificationClass.STAT);
|
|
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
foreach (Message aMessage in this.Messages)
|
|
{
|
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.STAT) { this._statMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
|
}
|
|
|
|
#region STAT
|
|
|
|
if (this._statMessage == null)
|
|
{
|
|
this._statMessage = this.Core.CreateMessage(Message.NotificationClass.STAT);
|
|
this.Messages.Add(this._statMessage);
|
|
}
|
|
|
|
STAT stat = null;
|
|
if (this._statMessage.Elements.Count > 0)
|
|
stat = this._statMessage.Elements[0] as STAT;
|
|
if (stat == null)
|
|
{
|
|
stat = new STAT();
|
|
stat.MessageCore = this.Core;
|
|
stat.MessageHeader = this._statMessage;
|
|
_statMessage.Elements.Add(stat);
|
|
}
|
|
|
|
this.comboBoxFlag.ItemsSource = CREW.NationalityDict;
|
|
//this.comboBoxFlag.KeyUp += ComboBox_KeyUp;
|
|
this.comboBoxVesselType.ItemsSource = STAT.VesselTypeDict;
|
|
//this.comboBoxVesselType.KeyUp += ComboBox_KeyUp;
|
|
this.comboBoxTransportMode.ItemsSource = STAT.TransportModeDict;
|
|
//this.comboBoxTransportMode.KeyUp += ComboBox_KeyUp;
|
|
this.shipDataGroupBox.DataContext = stat;
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
#region Highlighting
|
|
|
|
public override void HighlightErrorMessageContainer()
|
|
{
|
|
if (this._statMessage.HasErrors)
|
|
{
|
|
HighlightService.HighlightControl(this.shipDataGroupBox, HighlightService.HighlightStyle.ERROR, this._statMessage);
|
|
}
|
|
}
|
|
|
|
public override void HighlightViolationMessageContainer()
|
|
{
|
|
if (this._statMessage.HasViolations)
|
|
HighlightService.HighlightControl(this.shipDataGroupBox, HighlightService.HighlightStyle.VIOLATION, this._statMessage);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region mouse wheel
|
|
|
|
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
|
{
|
|
ScrollViewer scv = (ScrollViewer)sender;
|
|
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
|
|
e.Handled = true;
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|