mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
UI - Unload current page when closing screen
UI - Restore last page when opening via double click on tray icon Windows - Fixed settings tray menu item opening release tab
This commit is contained in:
1 parent
f3a4ccea8b
commit
811917c1c9
14 files changed
+104
-20
No files matched your search
@@ -0,0 +1,7 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Root.BlankView">
|
||||
</UserControl>
|
||||
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.Root;
|
||||
|
||||
public partial class BlankView : UserControl
|
||||
{
|
||||
public BlankView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Artemis.UI.Shared;
|
||||
|
||||
namespace Artemis.UI.Screens.Root;
|
||||
|
||||
public class BlankViewModel : ViewModelBase, IMainScreenViewModel
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ViewModelBase? TitleBarViewModel => null;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class RootViewModel : RoutableScreen<IMainScreenViewModel>, IMainWindowPr
|
||||
mainWindowService.ConfigureMainWindowProvider(this);
|
||||
|
||||
DisplayAccordingToSettings();
|
||||
OpenScreen = ReactiveCommand.Create<string>(ExecuteOpenScreen);
|
||||
OpenScreen = ReactiveCommand.Create<string?>(ExecuteOpenScreen);
|
||||
OpenDebugger = ReactiveCommand.CreateFromTask(ExecuteOpenDebugger);
|
||||
Exit = ReactiveCommand.CreateFromTask(ExecuteExit);
|
||||
this.WhenAnyValue(vm => vm.Screen).Subscribe(UpdateTitleBarViewModel);
|
||||
@@ -72,11 +72,13 @@ public class RootViewModel : RoutableScreen<IMainScreenViewModel>, IMainWindowPr
|
||||
registrationService.RegisterBuiltInDataModelDisplays();
|
||||
registrationService.RegisterBuiltInDataModelInputs();
|
||||
registrationService.RegisterBuiltInPropertyEditors();
|
||||
|
||||
_router.Navigate("home");
|
||||
});
|
||||
}
|
||||
|
||||
public SidebarViewModel SidebarViewModel { get; }
|
||||
public ReactiveCommand<string, Unit> OpenScreen { get; }
|
||||
public ReactiveCommand<string?, Unit> OpenScreen { get; }
|
||||
public ReactiveCommand<Unit, Unit> OpenDebugger { get; }
|
||||
public ReactiveCommand<Unit, Unit> Exit { get; }
|
||||
|
||||
@@ -133,8 +135,11 @@ public class RootViewModel : RoutableScreen<IMainScreenViewModel>, IMainWindowPr
|
||||
|
||||
#region Tray commands
|
||||
|
||||
private void ExecuteOpenScreen(string path)
|
||||
private void ExecuteOpenScreen(string? path)
|
||||
{
|
||||
if (path != null)
|
||||
_router.ClearPreviousWindowRoute();
|
||||
|
||||
// The window will open on the UI thread at some point, respond to that to select the chosen screen
|
||||
MainWindowOpened += OnEventHandler;
|
||||
OpenMainWindow();
|
||||
@@ -143,7 +148,8 @@ public class RootViewModel : RoutableScreen<IMainScreenViewModel>, IMainWindowPr
|
||||
{
|
||||
MainWindowOpened -= OnEventHandler;
|
||||
// Avoid threading issues by running this on the UI thread
|
||||
Dispatcher.UIThread.InvokeAsync(async () => await _router.Navigate(path));
|
||||
if (path != null)
|
||||
Dispatcher.UIThread.InvokeAsync(async () => await _router.Navigate(path));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
@@ -88,7 +86,6 @@ public class SidebarViewModel : ActivatableViewModelBase
|
||||
|
||||
SidebarCategories = categoryViewModels;
|
||||
});
|
||||
SelectedScreen = SidebarScreen.Screens.First();
|
||||
}
|
||||
|
||||
public SidebarScreenViewModel SidebarScreen { get; }
|
||||
|
||||
Reference in new issue
Block a user