Skip to content

Commit c543812

Browse files
committed
allow user to set custom values for CargoObject cargo category
1 parent ce110d5 commit c543812

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

Gui/ViewModels/LocoTypes/Objects/CargoViewModel.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Definitions.ObjectModels.Objects.Cargo;
22
using PropertyModels.ComponentModel.DataAnnotations;
3+
using ReactiveUI;
4+
using System.ComponentModel;
35

46
namespace Gui.ViewModels;
57

@@ -15,7 +17,30 @@ public uint16_t CargoTransferTime
1517
public CargoCategory CargoCategory
1618
{
1719
get => Model.CargoCategory;
18-
set => Model.CargoCategory = value;
20+
set
21+
{
22+
if (Model.CargoCategory != value)
23+
{
24+
Model.CargoCategory = value;
25+
this.RaisePropertyChanged(nameof(CargoCategory));
26+
this.RaisePropertyChanged(nameof(CargoCategoryOverride));
27+
}
28+
}
29+
}
30+
31+
[Description("Allows the user to set a custom value for the cargo category.")]
32+
public uint16_t CargoCategoryOverride
33+
{
34+
get => (uint16_t)Model.CargoCategory;
35+
set
36+
{
37+
if ((uint16_t)Model.CargoCategory != value)
38+
{
39+
Model.CargoCategory = (CargoCategory)value;
40+
this.RaisePropertyChanged(nameof(CargoCategory));
41+
this.RaisePropertyChanged(nameof(CargoCategoryOverride));
42+
}
43+
}
1944
}
2045

2146
[EnumProhibitValues<CargoObjectFlags>(CargoObjectFlags.None)]

0 commit comments

Comments
 (0)