135 lines
5.0 KiB
C#
135 lines
5.0 KiB
C#
// Copyright (c) 2017 schick Informatik
|
|
// Description: Detailansicht für PRE72H
|
|
//
|
|
|
|
using System.Windows;
|
|
|
|
using bsmd.database;
|
|
using ENI2.Util;
|
|
using System.Windows.Controls;
|
|
|
|
namespace ENI2.DetailViewControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for PSC72hDetailControl.xaml
|
|
/// </summary>
|
|
public partial class PSC72hDetailControl : DetailBaseControl
|
|
{
|
|
|
|
private Message _pre72hMessage;
|
|
|
|
private static string[] hullConfiguration = {
|
|
Properties.Resources.textSingleHull,
|
|
Properties.Resources.textSingleHullBallast,
|
|
Properties.Resources.textDoubleHull
|
|
};
|
|
|
|
private static string[] conditionCargoTanks =
|
|
{
|
|
Properties.Resources.textFull,
|
|
Properties.Resources.textEmpty,
|
|
Properties.Resources.textInert
|
|
};
|
|
|
|
public PSC72hDetailControl()
|
|
{
|
|
InitializeComponent();
|
|
this.Loaded += PSC72hDetailControl_Loaded;
|
|
}
|
|
|
|
private void PSC72hDetailControl_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.RegisterCheckboxChange(this.checkBoxTanker, Message.NotificationClass.PRE72H);
|
|
this.RegisterComboboxIndexChange(this.comboBoxTankerHullConfig, Message.NotificationClass.PRE72H);
|
|
this.RegisterComboboxIndexChange(this.comboBoxConditionCargoBallastTanks, Message.NotificationClass.PRE72H);
|
|
this.RegisterTextboxChange(this.textBoxNatureOfCargo, Message.NotificationClass.PRE72H);
|
|
this.RegisterDoubleUpDownChange(this.doubleUpDownVolumeOfCargo, Message.NotificationClass.PRE72H);
|
|
this.RegisterTextboxChange(this.textBoxPlannedOperations, Message.NotificationClass.PRE72H);
|
|
this.RegisterTextboxChange(this.textBoxPlannedWorks, Message.NotificationClass.PRE72H);
|
|
this.RegisterDatePickerChange(this.datePickerLastExpandedInspection, Message.NotificationClass.PRE72H);
|
|
this.RegisterDoubleUpDownChange(this.doubleUpDownPlannedPeriodOfStay, Message.NotificationClass.PRE72H);
|
|
this.checkBoxTanker.Checked += CheckBoxTanker_Checked;
|
|
this.checkBoxTanker.Unchecked += CheckBoxTanker_Checked;
|
|
}
|
|
|
|
private void CheckBoxTanker_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
bool isTanker = this.checkBoxTanker.IsChecked ?? false;
|
|
this.doubleUpDownVolumeOfCargo.IsEnabled = isTanker;
|
|
this.doubleUpDownVolumeOfCargo.IsReadOnly = !isTanker;
|
|
this.comboBoxTankerHullConfig.IsEnabled = isTanker;
|
|
this.comboBoxConditionCargoBallastTanks.IsEnabled = isTanker;
|
|
this.textBoxNatureOfCargo.IsEnabled = isTanker;
|
|
this.textBoxNatureOfCargo.IsReadOnly = !isTanker;
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
foreach (Message aMessage in this.Messages)
|
|
{
|
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.PRE72H) { this._pre72hMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
|
}
|
|
|
|
|
|
#region PRE72H
|
|
|
|
if (this._pre72hMessage == null)
|
|
{
|
|
this._pre72hMessage = this.Core.CreateMessage(Message.NotificationClass.PRE72H);
|
|
this.Messages.Add(this._pre72hMessage);
|
|
}
|
|
|
|
PRE72H pre72h = null;
|
|
if (this._pre72hMessage.Elements.Count > 0)
|
|
pre72h = this._pre72hMessage.Elements[0] as PRE72H;
|
|
if (pre72h == null)
|
|
{
|
|
pre72h = new PRE72H();
|
|
pre72h.MessageCore = this.Core;
|
|
pre72h.MessageHeader = this._pre72hMessage;
|
|
_pre72hMessage.Elements.Add(pre72h);
|
|
}
|
|
|
|
this.comboBoxTankerHullConfig.ItemsSource = hullConfiguration;
|
|
this.comboBoxConditionCargoBallastTanks.ItemsSource = conditionCargoTanks;
|
|
|
|
this.groupBoxPre72H.DataContext = pre72h;
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
#region Highlighting
|
|
|
|
public override void HighlightErrorMessageContainer()
|
|
{
|
|
if (this._pre72hMessage.HasErrors)
|
|
HighlightService.HighlightControl(this.groupBoxPre72H, HighlightService.HighlightStyle.ERROR, this._pre72hMessage);
|
|
|
|
}
|
|
|
|
public override void HighlightViolationMessageContainer()
|
|
{
|
|
if (this._pre72hMessage.HasViolations)
|
|
HighlightService.HighlightControl(this.groupBoxPre72H, HighlightService.HighlightStyle.VIOLATION, this._pre72hMessage);
|
|
}
|
|
|
|
#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
|
|
|
|
}
|
|
|
|
}
|