1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 13:28:33 +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:d="http://schemas.microsoft.com/expression/blend/2008"
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:profileEditor="clr-namespace:Artemis.UI.Screens.ProfileEditor"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
@ -10,12 +9,6 @@
x:DataType="profileEditor:ProfileEditorTitleBarViewModel">
<Grid ColumnDefinitions="*,Auto">
<ContentControl Grid.Row="0" Grid.Column="0" Content="{CompiledBinding MenuBarViewModel}" windowing:AppWindow.AllowInteractionInTitleBar="True" HorizontalAlignment="Left" />
<Button Grid.Column="1" Classes="title-bar-button"
Command="{CompiledBinding ShowDebugger}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
windowing:AppWindow.AllowInteractionInTitleBar="True">
<avalonia:MaterialIcon Kind="Bug" />
</Button>
<ContentControl Grid.Row="0" Grid.Column="1" Content="{CompiledBinding DefaultTitleBarViewModel}" HorizontalAlignment="Right" />
</Grid>
</UserControl>

View File

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

View File

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

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;
namespace Artemis.UI.Screens.Root;
@ -7,11 +8,14 @@ public class DefaultTitleBarViewModel : ViewModelBase
{
private readonly IDebugService _debugService;
public DefaultTitleBarViewModel(IDebugService debugService)
public DefaultTitleBarViewModel(IDebugService debugService, CurrentUserViewModel currentUserViewModel)
{
_debugService = debugService;
CurrentUserViewModel = currentUserViewModel;
}
public CurrentUserViewModel CurrentUserViewModel { get; }
public void ShowDebugger()
{
_debugService.ShowDebugger();

View File

@ -4,15 +4,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:search="clr-namespace:Artemis.UI.Screens.Workshop.Search"
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"
x:Class="Artemis.UI.Screens.Workshop.Search.SearchView"
x:DataType="search:SearchViewModel">
<UserControl.Styles>
<StyleInclude Source="SearchViewStyles.axaml" />
</UserControl.Styles>
<Panel Margin="0 5">
<Panel>
<AutoCompleteBox Name="SearchBox"
Margin="0 5"
MaxWidth="500"
Watermark="Search"
MinimumPopulateDelay="0:0:0.8"
@ -28,18 +28,11 @@
</AutoCompleteBox.ItemTemplate>
</AutoCompleteBox>
<ContentControl HorizontalAlignment="Right"
Width="28"
Height="28"
Margin="0 0 75 0"
Content="{CompiledBinding CurrentUserViewModel}"
Content="{CompiledBinding DefaultTitleBarViewModel}"
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>
</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>
</UserControl>

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Artemis.UI.Screens.Root;
using Artemis.UI.Screens.Workshop.CurrentUser;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared;
@ -24,19 +25,19 @@ public partial class SearchViewModel : ViewModelBase
[Notify] private SearchResultViewModel? _selectedEntry;
[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;
_workshopClient = workshopClient;
_workshopService = workshopService;
_debugService = debugService;
CurrentUserViewModel = currentUserViewModel;
DefaultTitleBarViewModel = defaultTitleBarViewModel;
SearchAsync = ExecuteSearchAsync;
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; }

View File

@ -54,12 +54,6 @@ public class LayoutEntryUploadHandler : IEntryUploadHandler
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);
// Submit the archive