mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
UI - Improved menu iotem swapping
This commit is contained in:
parent
d32ac329c8
commit
77227b7e6e
@ -178,21 +178,17 @@ namespace Artemis.UI.Screens
|
||||
if (!PinSidebar.Value)
|
||||
_sidebarViewModel.IsSidebarOpen = false;
|
||||
|
||||
// Don't do a fade when selecting a module because the editor is so bulky the animation slows things down
|
||||
if (!(_sidebarViewModel.SelectedItem is ModuleRootViewModel))
|
||||
ActiveItemReady = false;
|
||||
|
||||
// Allow the menu to close, it's slower but feels more responsive, funny how that works right
|
||||
Execute.PostToUIThreadAsync(async () =>
|
||||
Execute.PostToUIThread(async () =>
|
||||
{
|
||||
if (PinSidebar.Value)
|
||||
await Task.Delay(200);
|
||||
else
|
||||
await Task.Delay(400);
|
||||
|
||||
ActiveItem = _sidebarViewModel.SelectedItem;
|
||||
await Task.Delay(200);
|
||||
ActiveItemReady = true;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ using Artemis.Core.Services;
|
||||
using Artemis.UI.Events;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Screens.Home;
|
||||
using Artemis.UI.Screens.Modules;
|
||||
using Artemis.UI.Screens.News;
|
||||
using Artemis.UI.Screens.Settings;
|
||||
using Artemis.UI.Screens.SurfaceEditor;
|
||||
@ -200,12 +201,19 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
|
||||
private void ActivateViewModel<T>()
|
||||
{
|
||||
if (SelectedItem != null && SelectedItem.GetType() == typeof(T))
|
||||
return;
|
||||
SelectedItem = (IScreen) _kernel.Get<T>();
|
||||
}
|
||||
|
||||
private void ActivateModule(INavigationItem sidebarItem)
|
||||
{
|
||||
SelectedItem = SidebarModules.ContainsKey(sidebarItem) ? _moduleVmFactory.CreateModuleRootViewModel(SidebarModules[sidebarItem]) : null;
|
||||
if (!SidebarModules.ContainsKey(sidebarItem))
|
||||
return;
|
||||
if (SelectedItem is ModuleRootViewModel moduleRootViewModel && moduleRootViewModel.Module == SidebarModules[sidebarItem])
|
||||
return;
|
||||
|
||||
SelectedItem = _moduleVmFactory.CreateModuleRootViewModel(SidebarModules[sidebarItem]);
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user