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) switch(this.ShipcallControlModel?.LightMode)
{ {
case ShipcallControlModel.TrafficLightMode.GREEN: case EvaluationType.Green:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/check.png")); this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/check.png"));
break; break;
case ShipcallControlModel.TrafficLightMode.YELLOW: case EvaluationType.Yellow:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/sign_warning.png")); this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/sign_warning.png"));
break; break;
case ShipcallControlModel.TrafficLightMode.RED: case EvaluationType.Red:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/delete2.png")); this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/delete2.png"));
break; break;
default: default:
break; break;
@ -252,22 +252,13 @@ namespace BreCalClient
{ {
if (this.ShipcallControlModel?.Shipcall?.Evaluation != null) 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 this.Background = this.ShipcallControlModel.LightMode switch
switch (resultColor)
{ {
//case ShipcallControlModel.TrafficLightMode.GREEN: // ShipcallControlModel.TrafficLightMode.GREEN => this.Background = Brushes.LightGreen,
// this.Background = Brushes.LightGreen; EvaluationType.Yellow => Brushes.LightYellow,
// break; EvaluationType.Red => new SolidColorBrush(Color.FromArgb(200, 255, 100, 100)),
case ShipcallControlModel.TrafficLightMode.YELLOW: _ => Brushes.Transparent,
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;
}
} }
} }

View File

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