Profile modules - Added option to provide default profiles

Profiles - Run adaption on freshly imported profiles when activating
Profiles - Run adaption on freshly imported profiles when surface changes
This commit is contained in:
Robert committed 2021-05-15 22:41:15 +02:00
1 parent c7c78dfecc
commit 14f82284ac
7 files changed
+121 -53

No files matched your search

@@ -14,7 +14,6 @@ using Artemis.UI.Screens.ProfileEditor.LayerProperties;
using Artemis.UI.Screens.ProfileEditor.ProfileTree;
using Artemis.UI.Screens.ProfileEditor.Visualization;
using Artemis.UI.Shared.Services;
using MaterialDesignThemes.Wpf;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor
@@ -59,7 +58,6 @@ namespace Artemis.UI.Screens.ProfileEditor
Module = module;
DialogService = dialogService;
DefaultProfiles = new BindableCollection<ProfileDescriptor>(module.DefaultProfiles);
Profiles = new BindableCollection<ProfileDescriptor>();
// Populate the panels
@@ -100,9 +98,6 @@ namespace Artemis.UI.Screens.ProfileEditor
set => SetAndNotify(ref _profileViewModel, value);
}
public BindableCollection<ProfileDescriptor> DefaultProfiles { get; }
public bool HasDefaultProfiles => DefaultProfiles.Any();
public BindableCollection<ProfileDescriptor> Profiles
{
get => _profiles;
@@ -392,9 +387,7 @@ namespace Artemis.UI.Screens.ProfileEditor
{
// Get all profiles from the database
Profiles.Clear();
Profiles.AddRange(_profileService.GetProfileDescriptors(Module));
Profiles.AddRange(Module.DefaultProfiles.Where(d => Profiles.All(p => p.Id != d.Id)));
Profiles.Sort(p => p.Name);
Profiles.AddRange(_profileService.GetProfileDescriptors(Module).OrderBy(p => p.Name));
}
}
}