Skip to content

Commit cbd1790

Browse files
committed
* update
1 parent 67b84dc commit cbd1790

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

src/AasxPackageLogic/DispEditHelperEntities.cs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ public void DisplayOrEditAasEntitySubmodelOrRef(
17781778
DispSmeListAddNewHelper<ISubmodelElement>(env, stack, repo,
17791779
key: "SubmodelElement:",
17801780
submodel.SubmodelElements,
1781-
setValueLambda: (sml) => submodel.SubmodelElements = sml,
1781+
setOutput: (sml) => submodel.SubmodelElements = sml,
17821782
superMenu: superMenu,
17831783
basedOnSemanticId: submodel.SemanticId);
17841784

@@ -2662,7 +2662,7 @@ public void DisplayOrEditAasEntityOperationVariable(
26622662
if (parentContainer != null && parentContainer is Aas.Operation operation)
26632663
{
26642664
// hope is OK to refer to two lists!
2665-
if (operation.InputVariables.Contains(ov))
2665+
if (operation.InputVariables?.Contains(ov) == true)
26662666
{
26672667
this.EntityListUpDownDeleteHelper<Aas.IOperationVariable>(
26682668
stack, repo,
@@ -2671,15 +2671,15 @@ public void DisplayOrEditAasEntityOperationVariable(
26712671
ov,
26722672
env, "OperationVariable:");
26732673
}
2674-
else if (operation.OutputVariables.Contains(ov))
2674+
else if (operation.OutputVariables?.Contains(ov) == true)
26752675
{
26762676
this.EntityListUpDownDeleteHelper<Aas.IOperationVariable>(
26772677
stack, repo,
26782678
operation.OutputVariables,
26792679
(lst) => { operation.OutputVariables = lst; },
26802680
ov, env, "OperationVariable:");
26812681
}
2682-
else if (operation.InoutputVariables.Contains(ov))
2682+
else if (operation.InoutputVariables?.Contains(ov) == true)
26832683
{
26842684
this.EntityListUpDownDeleteHelper<Aas.IOperationVariable>(
26852685
stack, repo,
@@ -3223,7 +3223,7 @@ public void DisplayOrEditAasEntitySubmodelElement(
32233223
DispSmeListAddNewHelper(env, stack, repo,
32243224
key: "SubmodelElement:",
32253225
listOfSME,
3226-
setValueLambda: (sml) =>
3226+
setOutput: (sml) =>
32273227
{
32283228
if (sme is Aas.SubmodelElementCollection)
32293229
(sme as Aas.SubmodelElementCollection).Value = sml;
@@ -3336,7 +3336,8 @@ public void DisplayOrEditAasEntitySubmodelElement(
33363336
new[] {
33373337
new HintCheck(
33383338
() => { return ovl == null || ovl.Count < 1; },
3339-
"This collection of OperationVariables currently has no elements, yet. " +
3339+
"This list of OperationVariables currently has no elements, yet. " +
3340+
(ovl == null ? "List is null! " : "List is empty! ") +
33403341
"Please check, which in- and out-variables are required.",
33413342
severityLevel: HintCheck.Severity.Notice)
33423343
});
@@ -3509,7 +3510,7 @@ public void DisplayOrEditAasEntitySubmodelElement(
35093510
DispSmeListAddNewHelper<IDataElement>(env, stack, repo,
35103511
key: "annotation:",
35113512
are.Annotations,
3512-
setValueLambda: (sml) => are.Annotations = sml,
3513+
setOutput: (sml) => are.Annotations = sml,
35133514
superMenu: superMenu,
35143515
basedOnSemanticId: are.SemanticId);
35153516

src/AasxPackageLogic/DispEditHelperMiniModules.cs

+16-18
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,7 @@ public void DispSmeListAddNewHelper<T>(
18411841
Aas.Environment env,
18421842
AnyUiStackPanel stack, ModifyRepo repo, string key,
18431843
List<T> smeList,
1844-
Action<List<T>> setValueLambda = null,
1844+
Action<List<T>> setOutput = null,
18451845
AasxMenu superMenu = null,
18461846
Aas.IReference basedOnSemanticId = null) where T : class, ISubmodelElement
18471847
{
@@ -1856,7 +1856,8 @@ public void DispSmeListAddNewHelper<T>(
18561856
this.AddHintBubble(stack, hintMode, new[] {
18571857
new HintCheck(
18581858
() => { return smeList == null || smeList.Count < 1; },
1859-
"This element currently has no SubmodelElements, yet. " +
1859+
"This element currently has no SubmodelElements, yet. " +
1860+
(smeList == null ? "List is null! " : "List is empty! ") +
18601861
"These are the actual carriers of information. " +
18611862
"You could create them by clicking the 'Add ..' buttons below. " +
18621863
"Subsequently, when having a SubmodelElement established, " +
@@ -1866,24 +1867,29 @@ public void DispSmeListAddNewHelper<T>(
18661867

18671868
// menu
18681869
var isDataElem = typeof(IDataElement).IsAssignableFrom(typeof(T));
1870+
1871+
// 0 and 1
18691872
var menu = new AasxMenu()
18701873
.AddAction("add-prop", "Add Property",
18711874
"Adds a new Property to the containing collection.")
18721875
.AddAction("add-mlp", "Add MultiLang.Prop.",
18731876
"Adds a new MultiLanguageProperty to the containing collection.");
18741877

1878+
// 2
18751879
if (!isDataElem)
18761880
menu.AddAction("add-smc", "Add Collection",
18771881
"Adds a new SubmodelElementCollection to the containing collection.");
18781882
else
18791883
menu.AddAction("add-range", "Add Range",
18801884
"Adds a new Range to the containing collection.");
18811885

1886+
// 3
18821887
menu.AddAction("add-named", "Add other ..",
1883-
"Adds a selected kind of SubmodelElement to the containing collection.",
1884-
args: new AasxMenuListOfArgDefs()
1885-
.Add("Kind", "Name (not abbreviated) of kind of SubmodelElement."));
1888+
"Adds a selected kind of SubmodelElement to the containing collection.",
1889+
args: new AasxMenuListOfArgDefs()
1890+
.Add("Kind", "Name (not abbreviated) of kind of SubmodelElement."));
18861891

1892+
// 4
18871893
if (smtElemItem.Count > 0)
18881894
{
18891895
menu.AddAction("add-smt-guided", "Add SMT guided ..",
@@ -1935,16 +1941,9 @@ public void DispSmeListAddNewHelper<T>(
19351941
defaultHelper: Options.Curr.GetCreateDefaultHelper());
19361942

19371943
// add
1938-
T smw = sme2;
1939-
if (smeList == null)
1940-
{
1941-
smeList = new List<T>();
1942-
setValueLambda?.Invoke(smeList);
1943-
}
1944-
19451944
smeList = smeList ?? new List<T>();
1946-
smeList.Add(smw);
1947-
setValueLambda(smeList);
1945+
smeList.Add(sme2);
1946+
setOutput?.Invoke(smeList);
19481947

19491948
// make some more adjustments
19501949
if (sme2 is IMultiLanguageProperty mlp)
@@ -2007,12 +2006,11 @@ public void DispSmeListAddNewHelper<T>(
20072006
item.SmtRec.PopulateReferable(sme, item.Cd);
20082007

20092008
// add & confirm
2010-
var smw = sme as T;
2011-
if (smw != null)
2009+
if (sme != null)
20122010
{
20132011
smeList = smeList ?? new List<T>();
2014-
smeList.Add(smw);
2015-
setValueLambda(smeList);
2012+
smeList.Add(sme);
2013+
setOutput(smeList);
20162014

20172015
this.AddDiaryEntry(sme, new DiaryEntryStructChange(
20182016
StructuralChangeReason.Create));

0 commit comments

Comments
 (0)