fix AddToDefaultGroup for settings options

This commit is contained in:
2020-10-28 22:30:49 +01:00
parent 3ffaf0b6e1
commit d329e673c0
+17 -10
View File
@@ -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);
}
}
}
}