Added workshop home, changed VM routing structure

This commit is contained in:
Robert committed 2023-07-08 21:44:39 +02:00
1 parent 99a365be0b
commit 65f81ab768
34 files changed
+667 -75

No files matched your search

@@ -7,7 +7,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Sidebar.SidebarScreenView"
x:DataType="vm:SidebarScreenViewModel">
<StackPanel Orientation="Horizontal" Background="Transparent" PointerReleased="InputElement_OnPointerReleased" DoubleTapped="InputElement_OnDoubleTapped">
<StackPanel Orientation="Horizontal" Height="34" Background="Transparent" PointerPressed="InputElement_OnPointerPressed" DoubleTapped="InputElement_OnDoubleTapped" >
<avalonia:MaterialIcon Kind="{CompiledBinding Icon}" Width="18" Height="18" />
<TextBlock Margin="10 0" VerticalAlignment="Center" FontSize="13" Text="{CompiledBinding DisplayName}" />
</StackPanel>
@@ -1,6 +1,4 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.Screens.Sidebar;
@@ -14,12 +12,18 @@ public partial class SidebarScreenView : ReactiveUserControl<SidebarScreenViewMo
private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
{
// if (ViewModel != null)
// ViewModel.IsExpanded = !ViewModel.IsExpanded;
if (ViewModel != null)
ViewModel.IsExpanded = !ViewModel.IsExpanded;
}
private void InputElement_OnDoubleTapped(object? sender, TappedEventArgs e)
{
e.Handled = true;
}
private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
{
if (ViewModel != null)
ViewModel.IsExpanded = !ViewModel.IsExpanded;
}
}
@@ -2,11 +2,7 @@
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Routing;
using Artemis.UI.Shared.Services;
using Avalonia.Threading;
using Material.Icons;
using ReactiveUI;
namespace Artemis.UI.Screens.Sidebar;
@@ -22,7 +18,7 @@ public class SidebarScreenViewModel : ViewModelBase
DisplayName = displayName;
Screens = screens ?? new ObservableCollection<SidebarScreenViewModel>();
}
public MaterialIconKind Icon { get; }
public string Path { get; }
public string RootPath { get; }
@@ -56,15 +52,12 @@ public class SidebarScreenViewModel : ViewModelBase
public void ExpandIfRequired(SidebarScreenViewModel selected)
{
if (selected == this && Screens.Any())
{
IsExpanded = true;
if (selected == this)
return;
}
if (Screens.Contains(selected))
IsExpanded = true;
foreach (SidebarScreenViewModel sidebarScreenViewModel in Screens)
sidebarScreenViewModel.ExpandIfRequired(selected);
}