From d329e673c05ae4ebcfca15eba39463019ab032c2 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Wed, 28 Oct 2020 22:30:49 +0100 Subject: [PATCH] fix AddToDefaultGroup for settings options --- zero.Core/Options/SettingsOptions.cs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/zero.Core/Options/SettingsOptions.cs b/zero.Core/Options/SettingsOptions.cs index 8969313d..dc94b4d7 100644 --- a/zero.Core/Options/SettingsOptions.cs +++ b/zero.Core/Options/SettingsOptions.cs @@ -1,4 +1,5 @@ -using zero.Core.Entities; +using System.Linq; +using zero.Core.Entities; namespace zero.Core.Options { @@ -38,15 +39,21 @@ namespace zero.Core.Options public void AddToDefaultGroup(SettingsArea item, int index = -1) { - // TODO find default group - //if (index > -1 && index < Items.Count) - //{ - // Items.Insert(index, item); - //} - //else - //{ - // Items.Add(item); - //} + SettingsGroup group = Items.FirstOrDefault(x => x.Name == "@settings.groups.system"); + + if (group == null) + { + return; + } + + if (index > -1 && index < group.Items.Count) + { + group.Items.Insert(index, item); + } + else + { + group.Items.Add(item); + } } } }