localized the shipcall type combobox selection
This commit is contained in:
parent
f232285e76
commit
ec65355473
@ -4,13 +4,14 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:BreCalClient"
|
xmlns:local="clr-namespace:BreCalClient"
|
||||||
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
||||||
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
|
xmlns:api="clr-namespace:BreCalClient.misc.Model"
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
|
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
|
||||||
Title="{x:Static p:Resources.textEditShipcall}" Height="270" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
Title="{x:Static p:Resources.textEditShipcall}" Height="270" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
|
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
|
||||||
|
<local:EnumToStringConverter x:Key="enumToStringConverter" />
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -45,8 +46,8 @@
|
|||||||
<Button x:Name="buttonEditShips" Grid.Column="1" Grid.Row="6" Margin="2" Content="{x:Static p:Resources.textEditShips}" Click="buttonEditShips_Click" Visibility="Hidden" />
|
<Button x:Name="buttonEditShips" Grid.Column="1" Grid.Row="6" Margin="2" Content="{x:Static p:Resources.textEditShips}" Click="buttonEditShips_Click" Visibility="Hidden" />
|
||||||
|
|
||||||
<Label Content="{x:Static p:Resources.textType}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right" />
|
<Label Content="{x:Static p:Resources.textType}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right" />
|
||||||
|
|
||||||
<ComboBox x:Name="comboBoxCategories" Grid.Column="3" Margin="2" Grid.Row="0" SelectionChanged="comboBoxCategories_SelectionChanged"/>
|
<ComboBox ItemsSource="{local:Enumerate {x:Type api:ShipcallType}}" Grid.Column="3" Margin="2" Grid.Row="0" SelectionChanged="comboBoxCategories_SelectionChanged" x:Name="comboBoxCategories" />
|
||||||
|
|
||||||
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
|
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
|
||||||
<Grid Grid.Row="1" Grid.Column="3">
|
<Grid Grid.Row="1" Grid.Column="3">
|
||||||
|
|||||||
@ -51,14 +51,14 @@ namespace BreCalClient
|
|||||||
|
|
||||||
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
||||||
Array types = Enum.GetValues(typeof(ShipcallType));
|
Array types = Enum.GetValues(typeof(ShipcallType));
|
||||||
List<ShipcallType> shipcallTypes = new List<ShipcallType>();
|
List<ShipcallType> shipcallTypes = new();
|
||||||
bool first = true;
|
bool first = true;
|
||||||
foreach(ShipcallType shipcallType in types)
|
foreach(ShipcallType shipcallType in types)
|
||||||
{
|
{
|
||||||
if (!first) shipcallTypes.Add(shipcallType);
|
if (!first) shipcallTypes.Add(shipcallType);
|
||||||
else first = false;
|
else first = false;
|
||||||
}
|
}
|
||||||
this.comboBoxCategories.ItemsSource = shipcallTypes;
|
|
||||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
|
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
|
||||||
{
|
{
|
||||||
ShipcallType? type = this.comboBoxCategories.SelectedItem as ShipcallType?;
|
ShipcallType? type = GetShipcallTypeFromCombobox();
|
||||||
if (type != null)
|
if (type != null)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -162,6 +162,12 @@ namespace BreCalClient
|
|||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
|
|
||||||
|
ShipcallType? GetShipcallTypeFromCombobox()
|
||||||
|
{
|
||||||
|
EnumToStringConverter enumToStringConverter = new();
|
||||||
|
return (ShipcallType?)enumToStringConverter.ConvertBack(this.comboBoxCategories.SelectedItem, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
|
||||||
|
}
|
||||||
|
|
||||||
void CheckForCompletion()
|
void CheckForCompletion()
|
||||||
{
|
{
|
||||||
bool isEnabled = true;
|
bool isEnabled = true;
|
||||||
@ -175,7 +181,7 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShipcallType callType = (ShipcallType)comboBoxCategories.SelectedItem;
|
ShipcallType callType = GetShipcallTypeFromCombobox() ?? ShipcallType.Undefined;
|
||||||
switch (callType)
|
switch (callType)
|
||||||
{
|
{
|
||||||
case ShipcallType.Departure:
|
case ShipcallType.Departure:
|
||||||
@ -203,7 +209,7 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
if (this.ShipcallModel.Shipcall != null)
|
if (this.ShipcallModel.Shipcall != null)
|
||||||
{
|
{
|
||||||
this.ShipcallModel.Shipcall.Type = (ShipcallType) this.comboBoxCategories.SelectedItem;
|
this.ShipcallModel.Shipcall.Type = GetShipcallTypeFromCombobox() ?? ShipcallType.Undefined;
|
||||||
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
|
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
|
||||||
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
|
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
|
||||||
|
|
||||||
@ -284,7 +290,7 @@ namespace BreCalClient
|
|||||||
if (this.ShipcallModel.Shipcall != null)
|
if (this.ShipcallModel.Shipcall != null)
|
||||||
{
|
{
|
||||||
this.comboBoxTimeRef.SelectedIndex = this.ShipcallModel.Shipcall.TimeRefPoint ?? 0;
|
this.comboBoxTimeRef.SelectedIndex = this.ShipcallModel.Shipcall.TimeRefPoint ?? 0;
|
||||||
this.comboBoxCategories.SelectedItem = this.ShipcallModel.Shipcall.Type;
|
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)
|
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
|
||||||
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
||||||
// this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
|
// this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
|
||||||
|
|||||||
71
src/BreCalClient/EnumHelper.cs
Normal file
71
src/BreCalClient/EnumHelper.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// Copyright (c) 2024- schick Informatik
|
||||||
|
// Description: Helpers to display localized Enum values in Comboboxes
|
||||||
|
// https://stackoverflow.com/questions/29658721/enum-in-wpf-comboxbox-with-localized-names
|
||||||
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
|
namespace BreCalClient
|
||||||
|
{
|
||||||
|
|
||||||
|
#region class EnumToStringConverter
|
||||||
|
|
||||||
|
public sealed class EnumToStringConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{ return null; }
|
||||||
|
|
||||||
|
return Resources.Resources.ResourceManager.GetString(value.ToString() ?? "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string str = (string)value;
|
||||||
|
|
||||||
|
foreach (object enumValue in Enum.GetValues(targetType))
|
||||||
|
{
|
||||||
|
if (str == Resources.Resources.ResourceManager.GetString(enumValue.ToString() ?? ""))
|
||||||
|
{ return enumValue; }
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region class EnumerateExtension
|
||||||
|
|
||||||
|
public sealed class EnumerateExtension : MarkupExtension
|
||||||
|
{
|
||||||
|
public Type Type { get; set; }
|
||||||
|
|
||||||
|
public EnumerateExtension(Type type)
|
||||||
|
{
|
||||||
|
this.Type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
string[] names = Enum.GetNames(Type);
|
||||||
|
|
||||||
|
// skip value "0" == "Unknown" (we dont want this selectable in the Combobox)
|
||||||
|
// NOTE: This will only work in the future if the first element is always "undefined" aka unused
|
||||||
|
|
||||||
|
string[] values = new string[names.Length - 1];
|
||||||
|
for (int i = 0; i < names.Length - 1; i++)
|
||||||
|
{
|
||||||
|
values[i] = Resources.Resources.ResourceManager.GetString(names[i + 1]) ?? names[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@ -70,6 +70,8 @@ namespace BreCalClient
|
|||||||
// sort all entries
|
// sort all entries
|
||||||
allHistories.Sort((x, y) => { return y.Timestamp.CompareTo(x.Timestamp); });
|
allHistories.Sort((x, y) => { return y.Timestamp.CompareTo(x.Timestamp); });
|
||||||
|
|
||||||
|
EnumToStringConverter enumToStringConverter = new();
|
||||||
|
|
||||||
// create controls for all entries
|
// create controls for all entries
|
||||||
foreach (History history in allHistories)
|
foreach (History history in allHistories)
|
||||||
{
|
{
|
||||||
@ -84,7 +86,7 @@ namespace BreCalClient
|
|||||||
if (_shipcalls[history.ShipcallId].Shipcall != null)
|
if (_shipcalls[history.ShipcallId].Shipcall != null)
|
||||||
{
|
{
|
||||||
ShipcallType? type = _shipcalls[history.ShipcallId].Shipcall?.Type;
|
ShipcallType? type = _shipcalls[history.ShipcallId].Shipcall?.Type;
|
||||||
if (type != null) calltype = type.Value.ToString();
|
if (type != null) calltype = (string) (enumToStringConverter.Convert(type ?? ShipcallType.Undefined, typeof(ShipcallType), new(), System.Globalization.CultureInfo.CurrentCulture) ?? "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
45
src/BreCalClient/Resources/Resources.Designer.cs
generated
45
src/BreCalClient/Resources/Resources.Designer.cs
generated
@ -80,6 +80,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Incoming.
|
||||||
|
/// </summary>
|
||||||
|
public static string Arrival {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Arrival", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -200,6 +209,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Outgoing.
|
||||||
|
/// </summary>
|
||||||
|
public static string Departure {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Departure", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -250,6 +268,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Shifting.
|
||||||
|
/// </summary>
|
||||||
|
public static string Shifting {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Shifting", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -999,6 +1026,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Ships.
|
||||||
|
/// </summary>
|
||||||
|
public static string textShips {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textShips", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Show cancelled calls.
|
/// Looks up a localized string similar to Show cancelled calls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1277,6 +1313,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Undefined.
|
||||||
|
/// </summary>
|
||||||
|
public static string Undefined {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Undefined", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -481,4 +481,19 @@
|
|||||||
<data name="textTriggerManualRefresh" xml:space="preserve">
|
<data name="textTriggerManualRefresh" xml:space="preserve">
|
||||||
<value>Manuelle Aktualisierung der Anläufe auslösen</value>
|
<value>Manuelle Aktualisierung der Anläufe auslösen</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Arrival" xml:space="preserve">
|
||||||
|
<value>Einkommend</value>
|
||||||
|
</data>
|
||||||
|
<data name="Departure" xml:space="preserve">
|
||||||
|
<value>Ausgehend</value>
|
||||||
|
</data>
|
||||||
|
<data name="Shifting" xml:space="preserve">
|
||||||
|
<value>Verholung</value>
|
||||||
|
</data>
|
||||||
|
<data name="Undefined" xml:space="preserve">
|
||||||
|
<value>Unbekannt</value>
|
||||||
|
</data>
|
||||||
|
<data name="textShips" xml:space="preserve">
|
||||||
|
<value>Schiffe</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -121,6 +121,9 @@
|
|||||||
<data name="add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>add.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>add.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Arrival" xml:space="preserve">
|
||||||
|
<value>Incoming</value>
|
||||||
|
</data>
|
||||||
<data name="arrow_down_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="arrow_down_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>arrow_down_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>arrow_down_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
@ -157,6 +160,9 @@
|
|||||||
<data name="delete2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="delete2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>delete2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>delete2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Departure" xml:space="preserve">
|
||||||
|
<value>Outgoing</value>
|
||||||
|
</data>
|
||||||
<data name="edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>edit.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>edit.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
@ -172,6 +178,9 @@
|
|||||||
<data name="nav_refresh_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="nav_refresh_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>nav_refresh_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>nav_refresh_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Shifting" xml:space="preserve">
|
||||||
|
<value>Shifting</value>
|
||||||
|
</data>
|
||||||
<data name="ship2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="ship2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>ship2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>ship2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
@ -421,6 +430,9 @@
|
|||||||
<data name="textShipLength" xml:space="preserve">
|
<data name="textShipLength" xml:space="preserve">
|
||||||
<value>Ship length</value>
|
<value>Ship length</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textShips" xml:space="preserve">
|
||||||
|
<value>Ships</value>
|
||||||
|
</data>
|
||||||
<data name="textShowCancelledShipcalls" xml:space="preserve">
|
<data name="textShowCancelledShipcalls" xml:space="preserve">
|
||||||
<value>Show cancelled calls</value>
|
<value>Show cancelled calls</value>
|
||||||
</data>
|
</data>
|
||||||
@ -511,6 +523,9 @@
|
|||||||
<data name="umbrella_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="umbrella_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>umbrella_open.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>umbrella_open.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Undefined" xml:space="preserve">
|
||||||
|
<value>Undefined</value>
|
||||||
|
</data>
|
||||||
<data name="worker2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="worker2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>worker2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>worker2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@ -5,9 +5,13 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
||||||
xmlns:local="clr-namespace:BreCalClient"
|
xmlns:local="clr-namespace:BreCalClient"
|
||||||
|
xmlns:api="clr-namespace:BreCalClient.misc.Model"
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="56" d:DesignWidth="800" Loaded="UserControl_Loaded">
|
d:DesignHeight="56" d:DesignWidth="800" Loaded="UserControl_Loaded">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<local:EnumToStringConverter x:Key="enumToStringConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="28" />
|
<RowDefinition Height="28" />
|
||||||
@ -63,7 +67,7 @@
|
|||||||
<Label Grid.Column="1" Content="{x:Static p:Resources.textTo}" />
|
<Label Grid.Column="1" Content="{x:Static p:Resources.textTo}" />
|
||||||
<DatePicker x:Name="datePickerETATo" Grid.Column="2" Margin="2" SelectedDateChanged="datePickerETATo_SelectedDateChanged" SelectedDate="{Binding Path=EtaTo}"/>
|
<DatePicker x:Name="datePickerETATo" Grid.Column="2" Margin="2" SelectedDateChanged="datePickerETATo_SelectedDateChanged" SelectedDate="{Binding Path=EtaTo}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<xctk:CheckComboBox x:Name="comboBoxCategories" Grid.Column="4" Margin="2" ItemSelectionChanged="comboBoxCategories_ItemSelectionChanged" />
|
<xctk:CheckComboBox x:Name="comboBoxCategories" Grid.Column="4" Margin="2" ItemSelectionChanged="comboBoxCategories_ItemSelectionChanged" ItemsSource="{local:Enumerate {x:Type api:ShipcallType}}" />
|
||||||
<Grid Grid.Column="6" Grid.Row="0">
|
<Grid Grid.Column="6" Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width=".5*" />
|
<ColumnDefinition Width=".5*" />
|
||||||
|
|||||||
@ -101,8 +101,11 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
if(sfm.Categories != null)
|
if(sfm.Categories != null)
|
||||||
{
|
{
|
||||||
foreach(ShipcallType category in sfm.Categories)
|
EnumToStringConverter enumToStringConverter = new();
|
||||||
this.comboBoxCategories.SelectedItems.Add(category);
|
foreach (ShipcallType category in sfm.Categories)
|
||||||
|
{
|
||||||
|
this.comboBoxCategories.SelectedItems.Add(enumToStringConverter.Convert(category, typeof(ShipcallControl), new object(), System.Globalization.CultureInfo.CurrentCulture));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sfm.SearchString != null) this.textBoxSearch.Text = sfm.SearchString;
|
if (sfm.SearchString != null) this.textBoxSearch.Text = sfm.SearchString;
|
||||||
this.upDownShiplengthFrom.Value = sfm.ShipLengthFrom;
|
this.upDownShiplengthFrom.Value = sfm.ShipLengthFrom;
|
||||||
@ -129,7 +132,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(ShipcallType));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void datePickerETAFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
|
private void datePickerETAFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
|
||||||
@ -146,9 +149,15 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void comboBoxCategories_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
|
private void comboBoxCategories_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
EnumToStringConverter enumToStringConverter = new();
|
||||||
|
|
||||||
_model.Categories.Clear();
|
_model.Categories.Clear();
|
||||||
foreach(ShipcallType category in comboBoxCategories.SelectedItems)
|
foreach (string categoryString in comboBoxCategories.SelectedItems)
|
||||||
_model.Categories.Add(category);
|
{
|
||||||
|
ShipcallType? type = (ShipcallType?)enumToStringConverter.ConvertBack(categoryString, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
|
||||||
|
if(type != null)
|
||||||
|
_model.Categories.Add(type.Value);
|
||||||
|
}
|
||||||
|
|
||||||
SearchFilterChanged?.Invoke();
|
SearchFilterChanged?.Invoke();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
||||||
xmlns:local="clr-namespace:BreCalClient"
|
xmlns:local="clr-namespace:BreCalClient"
|
||||||
mc:Ignorable="d" Left="{local:SettingBinding W2Left}" Top="{local:SettingBinding W2Top}"
|
mc:Ignorable="d" Left="{local:SettingBinding W2Left}" Top="{local:SettingBinding W2Top}" Title="{x:Static p:Resources.textShips}"
|
||||||
Height="490" Width="800" ResizeMode="CanResize" Icon="Resources/containership.ico" Loaded="Window_Loaded">
|
Height="490" Width="800" ResizeMode="CanResize" Icon="Resources/containership.ico" Loaded="Window_Loaded">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user