Files
Artemis/src/Artemis.UI/Screens/Module/ModuleRootViewModel.cs
T
Robert f4c1c9de3d UI VM factories - Shortened names for readibility
Layer properties - Ensure only LayerBrushes can add properties and make sure that method instantiates a keyframe engine
Layer properties UI - Respond to properties being added/removed
2020-02-12 14:03:18 +01:00

43 lines
1.3 KiB
C#

using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Plugins.Abstract;
using Artemis.UI.Ninject.Factories;
using Stylet;
namespace Artemis.UI.Screens.Module
{
public class ModuleRootViewModel : Conductor<Screen>.Collection.OneActive
{
private readonly IProfileEditorVmFactory _profileEditorVmFactory;
public ModuleRootViewModel(Core.Plugins.Abstract.Module module, IProfileEditorVmFactory profileEditorVmFactory)
{
DisplayName = module?.DisplayName;
Module = module;
_profileEditorVmFactory = profileEditorVmFactory;
Task.Run(AddTabsAsync);
}
public Core.Plugins.Abstract.Module Module { get; }
private async Task AddTabsAsync()
{
// Give the screen a moment to active without freezing the UI thread
await Task.Delay(400);
// Create the profile editor and module VMs
if (Module is ProfileModule profileModule)
{
var profileEditor = _profileEditorVmFactory.Create(profileModule);
Items.Add(profileEditor);
}
var moduleViewModels = Module.GetViewModels();
Items.AddRange(moduleViewModels);
ActiveItem = Items.FirstOrDefault();
}
}
}