mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Modules - Added enable override mechanism
Profile modules - Added animated module enable/disable
This commit is contained in:
1 parent
55a928bff6
commit
0c9187f75d
21 files changed
+442
-122
No files matched your search
@@ -2,6 +2,8 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Plugins.Modules;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
@@ -11,22 +13,41 @@ namespace Artemis.UI.Screens.Module
|
||||
{
|
||||
public class ModuleRootViewModel : Conductor<Screen>.Collection.OneActive
|
||||
{
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IProfileEditorVmFactory _profileEditorVmFactory;
|
||||
private readonly IKernel _kernel;
|
||||
|
||||
public ModuleRootViewModel(Core.Plugins.Modules.Module module, IProfileEditorVmFactory profileEditorVmFactory, IKernel kernel)
|
||||
public ModuleRootViewModel(Core.Plugins.Modules.Module module, IModuleService moduleService, IProfileEditorVmFactory profileEditorVmFactory, IKernel kernel)
|
||||
{
|
||||
DisplayName = module?.DisplayName;
|
||||
Module = module;
|
||||
|
||||
_moduleService = moduleService;
|
||||
_profileEditorVmFactory = profileEditorVmFactory;
|
||||
_kernel = kernel;
|
||||
|
||||
Task.Run(AddTabsAsync);
|
||||
}
|
||||
|
||||
public Core.Plugins.Modules.Module Module { get; }
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _moduleService.SetActiveModuleOverride(Module);
|
||||
await AddTabsAsync();
|
||||
});
|
||||
base.OnActivate();
|
||||
}
|
||||
|
||||
protected override void OnDeactivate()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _moduleService.SetActiveModuleOverride(null);
|
||||
});
|
||||
base.OnDeactivate();
|
||||
}
|
||||
|
||||
private async Task AddTabsAsync()
|
||||
{
|
||||
// Give the screen a moment to active without freezing the UI thread
|
||||
|
||||
Reference in new issue
Block a user