Fix for traffic light status

This commit is contained in:
Daniel Schick 2024-05-02 09:09:24 +02:00
parent 45db6daffe
commit 707ffd0d59
2 changed files with 26 additions and 45 deletions

View File

@ -228,14 +228,14 @@ namespace BreCalClient
switch(this.ShipcallControlModel?.LightMode)
{
case ShipcallControlModel.TrafficLightMode.GREEN:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/check.png"));
case EvaluationType.Green:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/check.png"));
break;
case ShipcallControlModel.TrafficLightMode.YELLOW:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/sign_warning.png"));
case EvaluationType.Yellow:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/sign_warning.png"));
break;
case ShipcallControlModel.TrafficLightMode.RED:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/delete2.png"));
case EvaluationType.Red:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/delete2.png"));
break;
default:
break;
@ -252,22 +252,13 @@ namespace BreCalClient
{
if (this.ShipcallControlModel?.Shipcall?.Evaluation != null)
{
ShipcallControlModel.TrafficLightMode resultColor = (ShipcallControlModel.TrafficLightMode)(this.ShipcallControlModel?.Shipcall?.Evaluation ?? 0); // der nullable Operator hier ist so doof, die VS validation blickts einfach nicht
switch (resultColor)
this.Background = this.ShipcallControlModel.LightMode switch
{
//case ShipcallControlModel.TrafficLightMode.GREEN:
// this.Background = Brushes.LightGreen;
// break;
case ShipcallControlModel.TrafficLightMode.YELLOW:
this.Background = Brushes.LightYellow;
break;
case ShipcallControlModel.TrafficLightMode.RED:
this.Background = new SolidColorBrush(Color.FromArgb(200, 255, 100, 100));
break;
default:
this.Background = Brushes.Transparent;
break;
}
// ShipcallControlModel.TrafficLightMode.GREEN => this.Background = Brushes.LightGreen,
EvaluationType.Yellow => Brushes.LightYellow,
EvaluationType.Red => new SolidColorBrush(Color.FromArgb(200, 255, 100, 100)),
_ => Brushes.Transparent,
};
}
}

View File

@ -18,16 +18,6 @@ namespace BreCalClient
#region Enumerations
public enum TrafficLightMode
{
OFF,
GREEN,
YELLOW,
RED,
RED_YELLOW,
ALL
};
[Flags]
public enum StatusFlags
{
@ -74,20 +64,20 @@ namespace BreCalClient
}
}
public TrafficLightMode LightMode
public EvaluationType LightMode
{
get
{
TrafficLightMode tlm = TrafficLightMode.OFF;
EvaluationType elm = EvaluationType.Undefined;
if (this.Shipcall != null)
{
if(this.Shipcall.Evaluation.HasValue)
{
tlm = (TrafficLightMode)this.Shipcall.Evaluation;
elm = this.Shipcall.Evaluation.Value;
}
}
return tlm;
return elm;
}
}