mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
UI - Fixed empty screen when opening from tray
UI - Fixed editor getting stuck when closed to tray
This commit is contained in:
parent
311bdee8da
commit
e2f456866a
@ -8,6 +8,7 @@ using System.Reactive.Subjects;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Services.MainWindow;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using DynamicData;
|
||||
using ReactiveUI;
|
||||
@ -40,6 +41,7 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
IModuleService moduleService,
|
||||
IRgbService rgbService,
|
||||
ILayerBrushService layerBrushService,
|
||||
IMainWindowService mainWindowService,
|
||||
IWindowService windowService)
|
||||
{
|
||||
_logger = logger;
|
||||
@ -78,6 +80,9 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
.Throttle(TimeSpan.FromSeconds(1))
|
||||
.SelectMany(async _ => await AutoSaveProfileAsync())
|
||||
.Subscribe();
|
||||
|
||||
// When the main window closes, stop editing
|
||||
mainWindowService.MainWindowClosed += (_, _) => ChangeCurrentProfileConfiguration(null);
|
||||
}
|
||||
|
||||
public IObservable<ProfileConfiguration?> ProfileConfiguration { get; }
|
||||
|
||||
@ -40,7 +40,7 @@ public class PlaybackViewModel : ActivatableViewModelBase
|
||||
_lastUpdate = DateTime.MinValue;
|
||||
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Render, Update);
|
||||
updateTimer.Start();
|
||||
Disposable.Create(() => updateTimer.Stop());
|
||||
Disposable.Create(() => updateTimer.Stop()).DisposeWith(d);
|
||||
});
|
||||
|
||||
PlayFromStart = ReactiveCommand.Create(ExecutePlayFromStart);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
@ -92,12 +91,11 @@ namespace Artemis.UI.Screens.Root
|
||||
set => RaiseAndSetIfChanged(ref _titleBarViewModel, value);
|
||||
}
|
||||
|
||||
private void CurrentMainWindowOnClosed(object? sender, EventArgs e)
|
||||
private void CurrentMainWindowOnClosing(object? sender, EventArgs e)
|
||||
{
|
||||
_lifeTime.MainWindow = null;
|
||||
SidebarViewModel = null;
|
||||
Router.NavigateAndReset.Execute(new EmptyViewModel(this, "blank")).Subscribe();
|
||||
|
||||
OnMainWindowClosed();
|
||||
}
|
||||
|
||||
@ -190,7 +188,7 @@ namespace Artemis.UI.Screens.Root
|
||||
SidebarViewModel = _sidebarVmFactory.SidebarViewModel(this);
|
||||
_lifeTime.MainWindow = new MainWindow {DataContext = this};
|
||||
_lifeTime.MainWindow.Show();
|
||||
_lifeTime.MainWindow.Closed += CurrentMainWindowOnClosed;
|
||||
_lifeTime.MainWindow.Closing += CurrentMainWindowOnClosing;
|
||||
}
|
||||
|
||||
_lifeTime.MainWindow.WindowState = WindowState.Normal;
|
||||
|
||||
@ -52,7 +52,6 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
new SidebarScreenViewModel<SurfaceEditorViewModel>(MaterialIconKind.Devices, "Surface Editor"),
|
||||
new SidebarScreenViewModel<SettingsViewModel>(MaterialIconKind.Cog, "Settings")
|
||||
};
|
||||
_selectedSidebarScreen = SidebarScreens.First();
|
||||
|
||||
UpdateProfileCategories();
|
||||
UpdateHeaderDevice();
|
||||
@ -81,6 +80,8 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
_hostScreen.Router.Navigate.Execute(profileEditorVmFactory.ProfileEditorViewModel(_hostScreen));
|
||||
})
|
||||
.DisposeWith(disposables);
|
||||
|
||||
SelectedSidebarScreen = SidebarScreens.First();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user