mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
UI - Added routing (#802)
ColorGradient - Fixed GetColor returning the first stop if position was after the last stop
This commit is contained in:
1 parent
79309dcee7
commit
962b13c6ed
77 files changed
+2034
-854
No files matched your search
@@ -17,10 +17,10 @@
|
||||
<TrayIcon Icon="avares://Artemis.UI/Assets/Images/Logo/application.ico" ToolTipText="Artemis" Command="{CompiledBinding OpenScreen}" CommandParameter="Home">
|
||||
<TrayIcon.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="Home" Command="{CompiledBinding OpenScreen}" CommandParameter="Home" />
|
||||
<!-- <NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="Workshop" /> -->
|
||||
<NativeMenuItem Header="Surface Editor" Command="{CompiledBinding OpenScreen}" CommandParameter="Surface Editor" />
|
||||
<NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="Settings" />
|
||||
<NativeMenuItem Header="Home" Command="{CompiledBinding OpenScreen}" CommandParameter="home" />
|
||||
<!-- <NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" /> -->
|
||||
<NativeMenuItem Header="Surface Editor" Command="{CompiledBinding OpenScreen}" CommandParameter="surface-editor" />
|
||||
<NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="settings/releases" />
|
||||
<NativeMenuItemSeparator />
|
||||
<NativeMenuItem Header="Debugger" Command="{CompiledBinding OpenDebugger}" />
|
||||
<NativeMenuItem Header="Exit" Command="{CompiledBinding Exit}" />
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using Windows.UI.Notifications;
|
||||
using Artemis.UI.Screens.Settings;
|
||||
using Artemis.UI.Services.Updating;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.UI.Shared.Services.MainWindow;
|
||||
using Avalonia.Threading;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
@@ -17,19 +18,16 @@ namespace Artemis.UI.Windows.Providers;
|
||||
public class WindowsUpdateNotificationProvider : IUpdateNotificationProvider
|
||||
{
|
||||
private readonly Func<Guid, ReleaseInstaller> _getReleaseInstaller;
|
||||
private readonly Func<IScreen, SettingsViewModel> _getSettingsViewModel;
|
||||
private readonly IMainWindowService _mainWindowService;
|
||||
private readonly IUpdateService _updateService;
|
||||
private readonly IRouter _router;
|
||||
private CancellationTokenSource? _cancellationTokenSource;
|
||||
|
||||
public WindowsUpdateNotificationProvider(IMainWindowService mainWindowService,
|
||||
IUpdateService updateService,
|
||||
Func<IScreen, SettingsViewModel> getSettingsViewModel,
|
||||
Func<Guid, ReleaseInstaller> getReleaseInstaller)
|
||||
public WindowsUpdateNotificationProvider(IMainWindowService mainWindowService, IUpdateService updateService, IRouter router, Func<Guid, ReleaseInstaller> getReleaseInstaller)
|
||||
{
|
||||
_mainWindowService = mainWindowService;
|
||||
_updateService = updateService;
|
||||
_getSettingsViewModel = getSettingsViewModel;
|
||||
_router = router;
|
||||
_getReleaseInstaller = getReleaseInstaller;
|
||||
ToastNotificationManagerCompat.OnActivated += ToastNotificationManagerCompatOnOnActivated;
|
||||
}
|
||||
@@ -57,25 +55,15 @@ public class WindowsUpdateNotificationProvider : IUpdateNotificationProvider
|
||||
.Show();
|
||||
}
|
||||
|
||||
private void ViewRelease(string releaseVersion)
|
||||
private void ViewRelease(Guid? releaseId)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
Dispatcher.UIThread.Invoke(async () =>
|
||||
{
|
||||
_mainWindowService.OpenMainWindow();
|
||||
if (_mainWindowService.HostScreen == null)
|
||||
return;
|
||||
|
||||
// TODO: When proper routing has been implemented, use that here
|
||||
// Create a settings VM to navigate to
|
||||
SettingsViewModel settingsViewModel = _getSettingsViewModel(_mainWindowService.HostScreen);
|
||||
// Get the release tab
|
||||
ReleasesTabViewModel releaseTabViewModel = (ReleasesTabViewModel) settingsViewModel.SettingTabs.First(t => t is ReleasesTabViewModel);
|
||||
|
||||
// Navigate to the settings VM
|
||||
_mainWindowService.HostScreen.Router.Navigate.Execute(settingsViewModel);
|
||||
// Navigate to the release tab
|
||||
releaseTabViewModel.PreselectVersion = releaseVersion;
|
||||
settingsViewModel.SelectedTab = releaseTabViewModel;
|
||||
if (releaseId != null)
|
||||
await _router.Navigate($"settings/releases/{releaseId}");
|
||||
else
|
||||
await _router.Navigate($"settings/releases");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -173,7 +161,7 @@ public class WindowsUpdateNotificationProvider : IUpdateNotificationProvider
|
||||
if (action == "install")
|
||||
await InstallRelease(releaseId, releaseVersion);
|
||||
else if (action == "view-changes")
|
||||
ViewRelease(releaseVersion);
|
||||
ViewRelease(releaseId);
|
||||
else if (action == "cancel")
|
||||
_cancellationTokenSource?.Cancel();
|
||||
else if (action == "restart-for-update")
|
||||
|
||||
Reference in new issue
Block a user