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