fixed init when Port has been preselected but no berth
This commit is contained in:
parent
f0c33868d2
commit
7f011d7dc9
@ -49,8 +49,7 @@ namespace BreCalClient
|
||||
#region Event handler
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
|
||||
{
|
||||
|
||||
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
||||
Array types = Enum.GetValues(typeof(ShipcallType));
|
||||
@ -60,10 +59,7 @@ namespace BreCalClient
|
||||
{
|
||||
if (!first) shipcallTypes.Add(shipcallType);
|
||||
else first = false;
|
||||
}
|
||||
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
}
|
||||
|
||||
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
|
||||
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports.Where(x => App.Participant.Ports.Contains(x.Id));
|
||||
@ -326,8 +322,8 @@ namespace BreCalClient
|
||||
this.comboBoxTimeRef.SelectedIndex = this.ShipcallModel.Shipcall.TimeRefPoint ?? 1;
|
||||
this.comboBoxCategories.SelectedItem = new EnumToStringConverter().Convert(this.ShipcallModel.Shipcall.Type, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
|
||||
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
|
||||
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
||||
// this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
|
||||
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
||||
|
||||
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
|
||||
if (BreCalLists.Ships.Find(x => x.Ship.Id == this.ShipcallModel.Shipcall.ShipId) != null)
|
||||
{
|
||||
@ -338,6 +334,16 @@ namespace BreCalClient
|
||||
}
|
||||
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
||||
|
||||
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
|
||||
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
|
||||
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
|
||||
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
|
||||
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
|
||||
|
||||
// Filter agency combobox by port
|
||||
List<Participant> availableAgencies = BreCalLists.GetParticipants(this.ShipcallModel.Shipcall.PortId, ParticipantType.AGENCY);
|
||||
this.comboBoxAgency.ItemsSource = availableAgencies;
|
||||
|
||||
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
|
||||
{
|
||||
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
||||
@ -358,9 +364,7 @@ namespace BreCalClient
|
||||
this.comboBoxAgency.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
|
||||
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
|
||||
|
||||
this.comboBoxHarbour.SelectionChanged += this.comboBoxHarbour_SelectionChanged;
|
||||
|
||||
this.comboBoxHarbour.IsEnabled = this.ShipcallModel.AllowPortChange;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user