1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Workshop - Fixed uploading layouts trying to write a ZIP file to desktop

UI - Always show user icon regardless of window
This commit is contained in:
RobertBeekman 2024-01-30 22:12:57 +01:00
parent 17bd62e673
commit 6364ce3fc4
7 changed files with 30 additions and 42 deletions

View File

@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
xmlns:profileEditor="clr-namespace:Artemis.UI.Screens.ProfileEditor" xmlns:profileEditor="clr-namespace:Artemis.UI.Screens.ProfileEditor"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
@ -10,12 +9,6 @@
x:DataType="profileEditor:ProfileEditorTitleBarViewModel"> x:DataType="profileEditor:ProfileEditorTitleBarViewModel">
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
<ContentControl Grid.Row="0" Grid.Column="0" Content="{CompiledBinding MenuBarViewModel}" windowing:AppWindow.AllowInteractionInTitleBar="True" HorizontalAlignment="Left" /> <ContentControl Grid.Row="0" Grid.Column="0" Content="{CompiledBinding MenuBarViewModel}" windowing:AppWindow.AllowInteractionInTitleBar="True" HorizontalAlignment="Left" />
<Button Grid.Column="1" Classes="title-bar-button" <ContentControl Grid.Row="0" Grid.Column="1" Content="{CompiledBinding DefaultTitleBarViewModel}" HorizontalAlignment="Right" />
Command="{CompiledBinding ShowDebugger}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
windowing:AppWindow.AllowInteractionInTitleBar="True">
<avalonia:MaterialIcon Kind="Bug" />
</Button>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -1,4 +1,5 @@
using Artemis.UI.Screens.ProfileEditor.MenuBar; using Artemis.UI.Screens.ProfileEditor.MenuBar;
using Artemis.UI.Screens.Root;
using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared; using Artemis.UI.Shared;
@ -6,18 +7,12 @@ namespace Artemis.UI.Screens.ProfileEditor;
public class ProfileEditorTitleBarViewModel : ViewModelBase public class ProfileEditorTitleBarViewModel : ViewModelBase
{ {
private readonly IDebugService _debugService; public ProfileEditorTitleBarViewModel( MenuBarViewModel menuBarViewModel, DefaultTitleBarViewModel defaultTitleBarViewModel)
public ProfileEditorTitleBarViewModel(IDebugService debugService, MenuBarViewModel menuBarViewModel)
{ {
MenuBarViewModel = menuBarViewModel; MenuBarViewModel = menuBarViewModel;
_debugService = debugService; DefaultTitleBarViewModel = defaultTitleBarViewModel;
} }
public MenuBarViewModel MenuBarViewModel { get; } public MenuBarViewModel MenuBarViewModel { get; }
public DefaultTitleBarViewModel DefaultTitleBarViewModel { get; }
public void ShowDebugger()
{
_debugService.ShowDebugger();
}
} }

View File

@ -8,7 +8,15 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="root:DefaultTitleBarViewModel" x:DataType="root:DefaultTitleBarViewModel"
x:Class="Artemis.UI.Screens.Root.DefaultTitleBarView"> x:Class="Artemis.UI.Screens.Root.DefaultTitleBarView">
<Button Classes="title-bar-button" Command="{CompiledBinding ShowDebugger}" VerticalAlignment="Top" HorizontalAlignment="Right" windowing:AppWindow.AllowInteractionInTitleBar="True" > <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="42">
<avalonia:MaterialIcon Kind="Bug"></avalonia:MaterialIcon> <ContentControl Width="28"
</Button> Height="28"
Margin="0 0 29 0"
VerticalAlignment="Center"
Content="{CompiledBinding CurrentUserViewModel}"
windowing:AppWindow.AllowInteractionInTitleBar="True" />
<Button Classes="title-bar-button" Command="{CompiledBinding ShowDebugger}" windowing:AppWindow.AllowInteractionInTitleBar="True" VerticalAlignment="Top">
<avalonia:MaterialIcon Kind="Bug"></avalonia:MaterialIcon>
</Button>
</StackPanel>
</UserControl> </UserControl>

View File

@ -1,4 +1,5 @@
using Artemis.UI.Services.Interfaces; using Artemis.UI.Screens.Workshop.CurrentUser;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared; using Artemis.UI.Shared;
namespace Artemis.UI.Screens.Root; namespace Artemis.UI.Screens.Root;
@ -7,11 +8,14 @@ public class DefaultTitleBarViewModel : ViewModelBase
{ {
private readonly IDebugService _debugService; private readonly IDebugService _debugService;
public DefaultTitleBarViewModel(IDebugService debugService) public DefaultTitleBarViewModel(IDebugService debugService, CurrentUserViewModel currentUserViewModel)
{ {
_debugService = debugService; _debugService = debugService;
CurrentUserViewModel = currentUserViewModel;
} }
public CurrentUserViewModel CurrentUserViewModel { get; }
public void ShowDebugger() public void ShowDebugger()
{ {
_debugService.ShowDebugger(); _debugService.ShowDebugger();

View File

@ -4,15 +4,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:search="clr-namespace:Artemis.UI.Screens.Workshop.Search" xmlns:search="clr-namespace:Artemis.UI.Screens.Workshop.Search"
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Workshop.Search.SearchView" x:Class="Artemis.UI.Screens.Workshop.Search.SearchView"
x:DataType="search:SearchViewModel"> x:DataType="search:SearchViewModel">
<UserControl.Styles> <UserControl.Styles>
<StyleInclude Source="SearchViewStyles.axaml" /> <StyleInclude Source="SearchViewStyles.axaml" />
</UserControl.Styles> </UserControl.Styles>
<Panel Margin="0 5"> <Panel>
<AutoCompleteBox Name="SearchBox" <AutoCompleteBox Name="SearchBox"
Margin="0 5"
MaxWidth="500" MaxWidth="500"
Watermark="Search" Watermark="Search"
MinimumPopulateDelay="0:0:0.8" MinimumPopulateDelay="0:0:0.8"
@ -28,18 +28,11 @@
</AutoCompleteBox.ItemTemplate> </AutoCompleteBox.ItemTemplate>
</AutoCompleteBox> </AutoCompleteBox>
<ContentControl HorizontalAlignment="Right" <ContentControl HorizontalAlignment="Right"
Width="28" Content="{CompiledBinding DefaultTitleBarViewModel}"
Height="28"
Margin="0 0 75 0"
Content="{CompiledBinding CurrentUserViewModel}"
windowing:AppWindow.AllowInteractionInTitleBar="True" /> windowing:AppWindow.AllowInteractionInTitleBar="True" />
<Border VerticalAlignment="Top" CornerRadius="4 4 0 0" ClipToBounds="True" MaxWidth="500"> <Border VerticalAlignment="Top" CornerRadius="4 4 0 0" ClipToBounds="True" MaxWidth="500" Margin="0 5">
<ProgressBar IsIndeterminate="True" VerticalAlignment="Top" IsVisible="{CompiledBinding IsLoading}"></ProgressBar> <ProgressBar IsIndeterminate="True" VerticalAlignment="Top" IsVisible="{CompiledBinding IsLoading}"></ProgressBar>
</Border> </Border>
<Button Classes="title-bar-button" Command="{CompiledBinding ShowDebugger}" Margin="0 -5 0 0" VerticalAlignment="Top" HorizontalAlignment="Right" windowing:AppWindow.AllowInteractionInTitleBar="True" >
<avalonia:MaterialIcon Kind="Bug"></avalonia:MaterialIcon>
</Button>
</Panel> </Panel>
</UserControl> </UserControl>

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.UI.Screens.Root;
using Artemis.UI.Screens.Workshop.CurrentUser; using Artemis.UI.Screens.Workshop.CurrentUser;
using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared; using Artemis.UI.Shared;
@ -24,19 +25,19 @@ public partial class SearchViewModel : ViewModelBase
[Notify] private SearchResultViewModel? _selectedEntry; [Notify] private SearchResultViewModel? _selectedEntry;
[Notify] private bool _isLoading; [Notify] private bool _isLoading;
public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, CurrentUserViewModel currentUserViewModel, IDebugService debugService) public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, IDebugService debugService, DefaultTitleBarViewModel defaultTitleBarViewModel)
{ {
_logger = logger; _logger = logger;
_workshopClient = workshopClient; _workshopClient = workshopClient;
_workshopService = workshopService; _workshopService = workshopService;
_debugService = debugService; _debugService = debugService;
CurrentUserViewModel = currentUserViewModel; DefaultTitleBarViewModel = defaultTitleBarViewModel;
SearchAsync = ExecuteSearchAsync; SearchAsync = ExecuteSearchAsync;
this.WhenAnyValue(vm => vm.SelectedEntry).WhereNotNull().Subscribe(NavigateToEntry); this.WhenAnyValue(vm => vm.SelectedEntry).WhereNotNull().Subscribe(NavigateToEntry);
} }
public CurrentUserViewModel CurrentUserViewModel { get; } public DefaultTitleBarViewModel DefaultTitleBarViewModel { get; }
public Func<string?, CancellationToken, Task<IEnumerable<object>>> SearchAsync { get; } public Func<string?, CancellationToken, Task<IEnumerable<object>>> SearchAsync { get; }

View File

@ -54,12 +54,6 @@ public class LayoutEntryUploadHandler : IEntryUploadHandler
CopyImage(layoutPath, customData.Image, archive); CopyImage(layoutPath, customData.Image, archive);
} }
} }
archiveStream.Seek(0, SeekOrigin.Begin);
await using (FileStream fileStream = new(@"C:\Users\Robert\Desktop\layout-test.zip", FileMode.OpenOrCreate))
{
await archiveStream.CopyToAsync(fileStream, cancellationToken);
}
archiveStream.Seek(0, SeekOrigin.Begin); archiveStream.Seek(0, SeekOrigin.Begin);
// Submit the archive // Submit the archive