mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Workshop - Did all the things (Markdown stuff)
This commit is contained in:
1 parent
c132edeb51
commit
a0536b4302
47 files changed
+1017
-521
No files matched your search
+4
-2
@@ -2,7 +2,9 @@
|
||||
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:library="clr-namespace:Artemis.UI.Screens.Workshop.Library"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Library.Tabs.SubmissionsDetailView">
|
||||
Welcome to Avalonia!
|
||||
x:Class="Artemis.UI.Screens.Workshop.Library.SubmissionsDetailView"
|
||||
x:DataType="library:SubmissionsDetailViewModel">
|
||||
<ContentControl Content="{CompiledBinding EntrySpecificationsViewModel}"></ContentControl>
|
||||
</UserControl>
|
||||
+1
-4
@@ -1,9 +1,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Library.Tabs;
|
||||
namespace Artemis.UI.Screens.Workshop.Library;
|
||||
|
||||
public partial class SubmissionsDetailView : ReactiveUserControl<SubmissionsDetailViewModel>
|
||||
{
|
||||
+9
-1
@@ -1,13 +1,21 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Screens.Workshop.Entries;
|
||||
using Artemis.UI.Screens.Workshop.Parameters;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Library.Tabs;
|
||||
namespace Artemis.UI.Screens.Workshop.Library;
|
||||
|
||||
public class SubmissionsDetailViewModel : RoutableScreen<WorkshopDetailParameters>
|
||||
{
|
||||
public EntrySpecificationsViewModel EntrySpecificationsViewModel { get; }
|
||||
|
||||
public SubmissionsDetailViewModel(EntrySpecificationsViewModel entrySpecificationsViewModel)
|
||||
{
|
||||
EntrySpecificationsViewModel = entrySpecificationsViewModel;
|
||||
}
|
||||
|
||||
public override Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
|
||||
{
|
||||
Console.WriteLine(parameters.EntryId);
|
||||
@@ -21,6 +21,7 @@ public class SubmissionsTabViewModel : RoutableScreen
|
||||
private readonly IWorkshopClient _client;
|
||||
private readonly SourceCache<IGetSubmittedEntries_SubmittedEntries, Guid> _entries;
|
||||
private readonly IWindowService _windowService;
|
||||
private readonly IRouter _router;
|
||||
private bool _isLoading = true;
|
||||
private bool _workshopReachable;
|
||||
|
||||
@@ -28,6 +29,7 @@ public class SubmissionsTabViewModel : RoutableScreen
|
||||
{
|
||||
_client = client;
|
||||
_windowService = windowService;
|
||||
_router = router;
|
||||
_entries = new SourceCache<IGetSubmittedEntries_SubmittedEntries, Guid>(e => e.Id);
|
||||
_entries.Connect().Bind(out ReadOnlyObservableCollection<IGetSubmittedEntries_SubmittedEntries> entries).Subscribe();
|
||||
|
||||
@@ -76,9 +78,9 @@ public class SubmissionsTabViewModel : RoutableScreen
|
||||
await _windowService.ShowDialogAsync<SubmissionWizardViewModel, bool>();
|
||||
}
|
||||
|
||||
private Task ExecuteNavigateToEntry(IGetSubmittedEntries_SubmittedEntries entry, CancellationToken cancellationToken)
|
||||
private async Task ExecuteNavigateToEntry(IGetSubmittedEntries_SubmittedEntries entry, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
await _router.Navigate($"workshop/library/submissions/{entry.Id}");
|
||||
}
|
||||
|
||||
private async Task GetEntries(CancellationToken ct)
|
||||
@@ -103,6 +105,4 @@ public class SubmissionsTabViewModel : RoutableScreen
|
||||
IsLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
public EntryType? EntryType => null;
|
||||
}
|
||||
@@ -8,7 +8,13 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Library.WorkshopLibraryView"
|
||||
x:DataType="library:WorkshopLibraryViewModel">
|
||||
<controls:NavigationView PaneDisplayMode="Top" MenuItemsSource="{CompiledBinding Tabs}" SelectedItem="{CompiledBinding SelectedTab}">
|
||||
<controls:NavigationView PaneDisplayMode="Top"
|
||||
MenuItemsSource="{CompiledBinding Tabs}"
|
||||
SelectedItem="{CompiledBinding SelectedTab}"
|
||||
IsBackEnabled="{CompiledBinding CanGoBack}"
|
||||
IsSettingsVisible="False"
|
||||
IsBackButtonVisible="True"
|
||||
BackRequested="NavigationView_OnBackRequested">
|
||||
<controls:NavigationView.Styles>
|
||||
<Styles>
|
||||
<Style Selector="controls|NavigationView:topnavminimal /template/ SplitView Border#ContentGridBorder">
|
||||
|
||||
@@ -3,16 +3,13 @@ using System.Reactive.Disposables;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using FluentAvalonia.UI.Media.Animation;
|
||||
using FluentAvalonia.UI.Navigation;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Library;
|
||||
|
||||
public partial class WorkshopLibraryView : ReactiveUserControl<WorkshopLibraryViewModel>
|
||||
{
|
||||
private int _lastIndex;
|
||||
|
||||
public WorkshopLibraryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -21,18 +18,11 @@ public partial class WorkshopLibraryView : ReactiveUserControl<WorkshopLibraryVi
|
||||
|
||||
private void Navigate(ViewModelBase viewModel)
|
||||
{
|
||||
Dispatcher.UIThread.Invoke(() => TabFrame.NavigateFromObject(viewModel, new FrameNavigationOptions {TransitionInfoOverride = GetTransitionInfo()}));
|
||||
Dispatcher.UIThread.Invoke(() => TabFrame.NavigateFromObject(viewModel));
|
||||
}
|
||||
|
||||
private SlideNavigationTransitionInfo GetTransitionInfo()
|
||||
|
||||
private void NavigationView_OnBackRequested(object? sender, NavigationViewBackRequestedEventArgs e)
|
||||
{
|
||||
if (ViewModel?.SelectedTab == null)
|
||||
return new SlideNavigationTransitionInfo();
|
||||
|
||||
SlideNavigationTransitionEffect effect = ViewModel.Tabs.IndexOf(ViewModel.SelectedTab) > _lastIndex ? SlideNavigationTransitionEffect.FromRight : SlideNavigationTransitionEffect.FromLeft;
|
||||
SlideNavigationTransitionInfo info = new() {Effect = effect};
|
||||
_lastIndex = ViewModel.Tabs.IndexOf(ViewModel.SelectedTab);
|
||||
|
||||
return info;
|
||||
ViewModel?.GoBack();
|
||||
}
|
||||
}
|
||||
@@ -4,35 +4,43 @@ using System.Reactive.Disposables;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Routing;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.WebClient.Workshop;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Library;
|
||||
|
||||
public class WorkshopLibraryViewModel : RoutableHostScreen<RoutableScreen>
|
||||
{
|
||||
private readonly IRouter _router;
|
||||
private RouteViewModel? _selectedTab;
|
||||
private ObservableAsPropertyHelper<bool>? _canGoBack;
|
||||
|
||||
/// <inheritdoc />
|
||||
public WorkshopLibraryViewModel(IRouter router)
|
||||
{
|
||||
_router = router;
|
||||
|
||||
Tabs = new ObservableCollection<RouteViewModel>
|
||||
{
|
||||
new("workshop/library/installed", "Installed"),
|
||||
new("workshop/library/submissions", "Submissions")
|
||||
new("Installed", "workshop/library/installed"),
|
||||
new("Submissions", "workshop/library/submissions")
|
||||
};
|
||||
|
||||
// Navigate on tab change
|
||||
this.WhenActivated(d => this.WhenAnyValue(vm => vm.SelectedTab)
|
||||
.WhereNotNull()
|
||||
.Subscribe(s => router.Navigate(s.Path, new RouterNavigationOptions {IgnoreOnPartialMatch = true}))
|
||||
.DisposeWith(d));
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
// Show back button on details page
|
||||
_canGoBack = _router.CurrentPath.Select(p => p != null && p.StartsWith("workshop/library/submissions/")).ToProperty(this, vm => vm.CanGoBack).DisposeWith(d);
|
||||
// Navigate on tab change
|
||||
this.WhenAnyValue(vm => vm.SelectedTab)
|
||||
.WhereNotNull()
|
||||
.Subscribe(s => router.Navigate(s.Path, new RouterNavigationOptions {IgnoreOnPartialMatch = true}))
|
||||
.DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public EntryType? EntryType => null;
|
||||
public bool CanGoBack => _canGoBack?.Value ?? false;
|
||||
public ObservableCollection<RouteViewModel> Tabs { get; }
|
||||
|
||||
public RouteViewModel? SelectedTab
|
||||
@@ -47,4 +55,9 @@ public class WorkshopLibraryViewModel : RoutableHostScreen<RoutableScreen>
|
||||
if (SelectedTab == null)
|
||||
await args.Router.Navigate(Tabs.First().Path);
|
||||
}
|
||||
|
||||
public void GoBack()
|
||||
{
|
||||
_router.GoBack();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user