mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Sidebar - Added subitems support
This commit is contained in:
1 parent
229d93901b
commit
99a365be0b
33 files changed
+572
-162
No files matched your search
@@ -0,0 +1,21 @@
|
||||
<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"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:ui="clr-namespace:Artemis.UI"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Layout.LayoutDetailsView">
|
||||
<Border Classes="router-container">
|
||||
<Grid ColumnDefinitions="300,*" Margin="10">
|
||||
<Border Classes="card-condensed" Grid.Column="0" Margin="0 0 10 0">
|
||||
<TextBlock>Side panel</TextBlock>
|
||||
</Border>
|
||||
|
||||
<Border Classes="card-condensed" Grid.Column="1">
|
||||
<TextBlock>Main panel</TextBlock>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Layout;
|
||||
|
||||
public partial class LayoutDetailsView : ReactiveUserControl<LayoutDetailsViewModel>
|
||||
{
|
||||
public LayoutDetailsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Artemis.UI.Shared;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Layout;
|
||||
|
||||
public class LayoutDetailsViewModel : ActivatableViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<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"
|
||||
xmlns:layout="clr-namespace:Artemis.UI.Screens.Workshop.Layout"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Layout.LayoutListView"
|
||||
x:DataType="layout:LayoutListViewModel">
|
||||
<Border Classes="router-container">
|
||||
<Grid ColumnDefinitions="300,*" Margin="10">
|
||||
<Border Classes="card-condensed" Grid.Column="0" Margin="0 0 10 0">
|
||||
<TextBlock>Side panel</TextBlock>
|
||||
</Border>
|
||||
|
||||
<Border Classes="card-condensed" Grid.Column="1">
|
||||
<TextBlock>
|
||||
<Run Text="Layout list main panel, page: " /><Run Text="{CompiledBinding Page}"></Run>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Layout;
|
||||
|
||||
public partial class LayoutListView : ReactiveUserControl<LayoutListViewModel>
|
||||
{
|
||||
public LayoutListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Layout;
|
||||
|
||||
public class LayoutListViewModel : RoutableScreen<ActivatableViewModelBase, WorkshopListParameters>, IMainScreenViewModel
|
||||
{
|
||||
private int _page;
|
||||
|
||||
public int Page
|
||||
{
|
||||
get => _page;
|
||||
set => RaiseAndSetIfChanged(ref _page, value);
|
||||
}
|
||||
|
||||
public override Task OnNavigating(WorkshopListParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
|
||||
{
|
||||
Page = Math.Max(1, parameters.Page);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public ViewModelBase? TitleBarViewModel => null;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<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.Workshop.Profile.ProfileDetailsView">
|
||||
Welcome to Avalonia!
|
||||
</UserControl>
|
||||
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Profile;
|
||||
|
||||
public partial class ProfileDetailsView : ReactiveUserControl<ProfileDetailsViewModel>
|
||||
{
|
||||
public ProfileDetailsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Artemis.UI.Shared;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Profile;
|
||||
|
||||
public class ProfileDetailsViewModel : ActivatableViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<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"
|
||||
xmlns:profile="clr-namespace:Artemis.UI.Screens.Workshop.Profile"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Profile.ProfileListView"
|
||||
x:DataType="profile:ProfileListViewModel">
|
||||
<Border Classes="router-container">
|
||||
<Grid ColumnDefinitions="300,*" Margin="10">
|
||||
<Border Classes="card-condensed" Grid.Column="0" Margin="0 0 10 0">
|
||||
<TextBlock>Side panel</TextBlock>
|
||||
</Border>
|
||||
|
||||
<Border Classes="card-condensed" Grid.Column="1">
|
||||
<TextBlock>
|
||||
<Run Text="Profile list main panel, page: " /><Run Text="{CompiledBinding Page}"></Run>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Profile;
|
||||
|
||||
public partial class ProfileListView : ReactiveUserControl<ProfileListViewModel>
|
||||
{
|
||||
public ProfileListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Profile;
|
||||
|
||||
public class ProfileListViewModel : RoutableScreen<ActivatableViewModelBase, WorkshopListParameters>, IMainScreenViewModel
|
||||
{
|
||||
private int _page;
|
||||
|
||||
public int Page
|
||||
{
|
||||
get => _page;
|
||||
set => RaiseAndSetIfChanged(ref _page, value);
|
||||
}
|
||||
|
||||
public override Task OnNavigating(WorkshopListParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
|
||||
{
|
||||
Page = Math.Max(1, parameters.Page);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public ViewModelBase? TitleBarViewModel => null;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Artemis.UI.Screens.Workshop;
|
||||
|
||||
public class WorkshopListParameters
|
||||
{
|
||||
public int Page { get; set; }
|
||||
}
|
||||
@@ -2,35 +2,13 @@
|
||||
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"
|
||||
xmlns:builders="clr-namespace:Artemis.UI.Shared.Services.Builders;assembly=Artemis.UI.Shared"
|
||||
xmlns:controls1="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties;assembly=Artemis.UI.Shared"
|
||||
xmlns:workshop="clr-namespace:Artemis.UI.Screens.Workshop"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
|
||||
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker;assembly=Artemis.UI.Shared"
|
||||
xmlns:materialIconPicker="clr-namespace:Artemis.UI.Shared.MaterialIconPicker;assembly=Artemis.UI.Shared"
|
||||
xmlns:workshop1="clr-namespace:Artemis.WebClient.Workshop;assembly=Artemis.WebClient.Workshop"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:ui="clr-namespace:Artemis.UI"
|
||||
mc:Ignorable="d" d:DesignWidth="800"
|
||||
x:Class="Artemis.UI.Screens.Workshop.WorkshopView"
|
||||
x:DataType="workshop:WorkshopViewModel">
|
||||
<Border Classes="router-container">
|
||||
<Grid ColumnDefinitions="300,*" Margin="0 10">
|
||||
<Border Classes="card-condensed" Grid.Column="0" Margin="0 0 10 0">
|
||||
<ListBox ItemsSource="{CompiledBinding Test}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="workshop1:IGetEntries_Entries_Nodes">
|
||||
<Panel>
|
||||
<StackPanel Margin="4">
|
||||
<TextBlock Text="{CompiledBinding Name}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{CompiledBinding Author}" VerticalAlignment="Center" Classes="subtitle" FontSize="13" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
<ContentControl Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Content="{CompiledBinding CurrentUserViewModel}" Margin="8"></ContentControl>
|
||||
</Grid>
|
||||
<TextBlock>Workshop overview</TextBlock>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -1,4 +1,3 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop;
|
||||
@@ -9,5 +8,4 @@ public partial class WorkshopView : ReactiveUserControl<WorkshopViewModel>
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Screens.Workshop.CurrentUser;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.Builders;
|
||||
using Artemis.WebClient.Workshop;
|
||||
using Avalonia.Input;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
using StrawberryShake;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop;
|
||||
|
||||
public class WorkshopViewModel : ActivatableViewModelBase, IMainScreenViewModel
|
||||
public class WorkshopViewModel : RoutableScreen<object>, IMainScreenViewModel
|
||||
{
|
||||
private readonly IWorkshopClient _workshopClient;
|
||||
|
||||
public WorkshopViewModel(IScreen hostScreen, IWorkshopClient workshopClient, CurrentUserViewModel currentUserViewModel) : base(hostScreen, "workshop")
|
||||
public WorkshopViewModel()
|
||||
{
|
||||
CurrentUserViewModel = currentUserViewModel;
|
||||
_workshopClient = workshopClient;
|
||||
DisplayName = "Workshop";
|
||||
|
||||
Task.Run(() => GetEntries());
|
||||
}
|
||||
|
||||
public ObservableCollection<IGetEntries_Entries_Nodes> Test { get; set; } = new();
|
||||
public CurrentUserViewModel CurrentUserViewModel { get; set; }
|
||||
|
||||
private async Task GetEntries()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
IOperationResult<IGetEntriesResult> entries = await _workshopClient.GetEntries.ExecuteAsync();
|
||||
if (entries.Data?.Entries?.Nodes == null)
|
||||
return;
|
||||
|
||||
foreach (IGetEntries_Entries_Nodes getEntriesEntriesNodes in entries.Data.Entries.Nodes)
|
||||
{
|
||||
Console.WriteLine(getEntriesEntriesNodes);
|
||||
Test.Add(getEntriesEntriesNodes);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public ViewModelBase? TitleBarViewModel => null;
|
||||
}
|
||||
Reference in new issue
Block a user