-
Notifications
You must be signed in to change notification settings - Fork 9
KAR richtingnummers instelbaar in GUI + toevoegen aan SpecGen #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -408,6 +408,42 @@ public bool CheckWagenNummer | |
| } | ||
| } | ||
|
|
||
| [Browsable(false)] | ||
| public static bool KARSignaalGroepNummersInParameters => | ||
| ControllerAccessProvider.Default.Controller.PrioData.KARSignaalGroepNummersInParameters; | ||
|
|
||
| [Browsable(false)] | ||
| public static bool VerlaagHogeSG => | ||
| ControllerAccessProvider.Default.Controller.PrioData.VerlaagHogeSignaalGroepNummers; | ||
|
|
||
| [Browsable(false)] | ||
| public bool HasKAROV => PrioIngreep.HasPrioIngreepKAR(); | ||
|
|
||
| [Browsable(false)] | ||
| public int KARSignaalGroepNummer | ||
| { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dit kan ik niet helemaal plaatsen. Functioneel zou ik het beste vinden, indien je als gebruiker gewoon in kunt vullen wat je in wilt vullen, en dat ook in het model komt. Deze code lijkt eigenstandig iets te doen met de ingevoerde waarde op basis van instellingen die hier buiten beeld vallen. Mijn voorstel zou zijn: hier gewoon één waarde met een simpele get-set, en dan in de code generatie deze logica toepassen op basis van de algemene instellingen.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Graag zou ik deze PR mergen met de master, deze code vind ik evenwel toch wat problematisch, vooral omdat ik niet kan volgen wat functioneel de bedoeling is.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deze logica staat al in de code generator. Is hier bedoeld om hetzelfde te tonen als dat er gegenereerd wordt. Indien nog geen SG nummer bestaat (KARSGN == 0) wordt het richtingnummer bepaald obv de fasecyclus via TryParse. Is de signaalgroep > 200 dan wordt er 200 afgetrokken. Test op <= 400 is omdat je anders alsnog boven de 200 uit zou komen (462 - 200 is alsnog 262). |
||
| get | ||
| { | ||
| if ((PrioIngreep.KARSignaalGroepNummer == 0) && (int.TryParse(PrioIngreep.FaseCyclus, out var iFc))) | ||
| if ((iFc > 200) && VerlaagHogeSG) | ||
| return iFc - 200; | ||
| else | ||
| return iFc; | ||
| else if ((PrioIngreep.KARSignaalGroepNummer > 0) && (PrioIngreep.KARSignaalGroepNummer <= 200)) | ||
| return PrioIngreep.KARSignaalGroepNummer; | ||
| else if (VerlaagHogeSG && (PrioIngreep.KARSignaalGroepNummer > 200) && (PrioIngreep.KARSignaalGroepNummer <= 400)) | ||
| return PrioIngreep.KARSignaalGroepNummer - 200; | ||
| else | ||
| return 0; | ||
| } | ||
| set | ||
| { | ||
| if (VerlaagHogeSG && (value > 200) && (value <= 400)) value = value - 200; | ||
| PrioIngreep.KARSignaalGroepNummer = value; | ||
| OnPropertyChanged(nameof(KARSignaalGroepNummer), broadcast: true); | ||
| } | ||
| } | ||
|
|
||
| [Browsable(false)] | ||
| [Description("Check op ritcategorie")] | ||
| public bool CheckRitCategorie | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,40 @@ public bool Sirene | |
| } | ||
| } | ||
|
|
||
| [Browsable(false)] | ||
| public static bool KARSignaalGroepNummersInParameters => | ||
| ControllerAccessProvider.Default.Controller.PrioData.KARSignaalGroepNummersInParameters; | ||
|
|
||
| [Browsable(false)] | ||
| public static bool VerlaagHogeSG => | ||
| ControllerAccessProvider.Default.Controller.PrioData.VerlaagHogeSignaalGroepNummers; | ||
|
|
||
| [Description("KAR richtingnummer HD")] | ||
| [BrowsableCondition(nameof(KARSignaalGroepNummersInParameters))] | ||
| public int KARSignaalGroepNummerHD | ||
| { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zie vorige opmerkingen: mijn voorstel zou zijn de logica te verplaatsen naar de code generatie |
||
| get | ||
| { | ||
| if ((_HDIngreep.KARSignaalGroepNummerHD == 0) && (int.TryParse(_HDIngreep.FaseCyclus, out var iFc))) | ||
| if ((iFc > 200) && VerlaagHogeSG) | ||
| return iFc - 200; | ||
| else | ||
| return iFc; | ||
| else if ((_HDIngreep.KARSignaalGroepNummerHD > 0) && (_HDIngreep.KARSignaalGroepNummerHD <= 200)) | ||
| return _HDIngreep.KARSignaalGroepNummerHD; | ||
| else if ((_HDIngreep.KARSignaalGroepNummerHD > 200) && (_HDIngreep.KARSignaalGroepNummerHD <= 400)) | ||
| return HDIngreep.KARSignaalGroepNummerHD - 200; | ||
| else | ||
| return 0; | ||
| } | ||
| set | ||
| { | ||
| if (VerlaagHogeSG && (value > 200) && (value <= 400)) value = value - 200; | ||
| _HDIngreep.KARSignaalGroepNummerHD = value; | ||
| OnPropertyChanged(nameof(KARSignaalGroepNummerHD), broadcast: true); | ||
| } | ||
| } | ||
|
|
||
| [Browsable(false)] | ||
| public bool OpticomAvailable => OpticomIngangen != null && OpticomIngangen.Any(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merk op dat
AutoGridal kolommen aanmaakt viaColumns="Auto,*". Je kunt dus dezeGridverwijderen ten gunste van gewoon direct in de lijst opnemen vanLabelenTextBoxThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er is een geneste Grid omdat er twee visibility condities zijn: HasKAROV en KARSignaalGroepNummersInParameters. De een werkt nu op de geneste Grid, de ander op Label en TextBox. Wanneer 1 van beide ontbreekt mag de optie niet getoond worden (vind ik tenminste ;-) ).
Ik heb gepoogd om eea te maken met een booleanAndConverter (via MultiValueConverter), maar dat kreeg ik niet werkend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dit kun je in het ViewModel oplossen. Bv.:
Vervolgens kun je in de View gewoon een regulier Binding doen op de TwoConditions property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HasKAROV is gebaseerd op een extension (?) HasPrioIngreepKAR() .
public bool HasKAROV => PrioIngreep.HasPrioIngreepKAR();Ik weet niet hoe je daar een setter bij maakt.