Merge branch 'feature/updating' into feature/gh-actions

This commit is contained in:
Robert committed 2023-02-26 16:06:10 +01:00
commit 1351796f42
49 files changed
+1467 -451

No files matched your search

@@ -20,7 +20,7 @@
<PackageReference Include="Material.Icons.Avalonia" Version="1.1.10" />
<PackageReference Include="ReactiveUI" Version="17.1.50" />
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
<PackageReference Include="RGB.NET.Core" Version="1.0.0" />
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.12" />
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
</ItemGroup>
<ItemGroup>
@@ -0,0 +1,34 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
using Humanizer;
using Humanizer.Bytes;
namespace Artemis.UI.Shared.Converters;
/// <summary>
/// Converts bytes to a string
/// </summary>
public class BytesToStringConverter : IValueConverter
{
/// <inheritdoc />
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is int intBytes)
return intBytes.Bytes().Humanize();
if (value is long longBytes)
return longBytes.Bytes().Humanize();
if (value is double doubleBytes)
return doubleBytes.Bytes().Humanize();
return value;
}
/// <inheritdoc />
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is string formatted && ByteSize.TryParse(formatted, out ByteSize result))
return result.Bytes;
return value;
}
}
@@ -7,7 +7,7 @@ namespace Artemis.UI.Shared.DryIoc;
/// <summary>
/// Provides an extension method to register services onto a DryIoc <see cref="IContainer"/>.
/// </summary>
public static class UIContainerExtensions
public static class ContainerExtensions
{
/// <summary>
/// Registers shared UI services into the container.
@@ -1,4 +1,5 @@
using System;
using ReactiveUI;
namespace Artemis.UI.Shared.Services.MainWindow;
@@ -12,6 +13,11 @@ public interface IMainWindowService : IArtemisSharedUIService
/// </summary>
bool IsMainWindowOpen { get; }
/// <summary>
/// Gets or sets the host screen contained in the main window
/// </summary>
IScreen? HostScreen { get; set; }
/// <summary>
/// Sets up the main window provider that controls the state of the main window
/// </summary>
@@ -1,4 +1,5 @@
using System;
using ReactiveUI;
namespace Artemis.UI.Shared.Services.MainWindow;
@@ -6,6 +7,12 @@ internal class MainWindowService : IMainWindowService
{
private IMainWindowProvider? _mainWindowManager;
/// <inheritdoc />
public bool IsMainWindowOpen { get; private set; }
/// <inheritdoc />
public IScreen? HostScreen { get; set; }
protected virtual void OnMainWindowOpened()
{
MainWindowOpened?.Invoke(this, EventArgs.Empty);
@@ -64,8 +71,6 @@ internal class MainWindowService : IMainWindowService
OnMainWindowUnfocused();
}
public bool IsMainWindowOpen { get; private set; }
public void ConfigureMainWindowProvider(IMainWindowProvider mainWindowProvider)
{
if (mainWindowProvider == null) throw new ArgumentNullException(nameof(mainWindowProvider));
@@ -56,7 +56,7 @@ public class DuplicateNode : INodeEditorCommand, IDisposable
if (targetCollection == null)
continue;
while (targetCollection.Count() < sourceCollection.Count())
targetCollection.CreatePin();
targetCollection.Add(targetCollection.CreatePin());
}
// Copy the storage
@@ -21,6 +21,7 @@
<!-- Custom styles -->
<StyleInclude Source="/Styles/Border.axaml" />
<StyleInclude Source="/Styles/Skeleton.axaml" />
<StyleInclude Source="/Styles/Button.axaml" />
<StyleInclude Source="/Styles/Condensed.axaml" />
<StyleInclude Source="/Styles/ColorPickerButton.axaml" />
+174
View File
@@ -0,0 +1,174 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Grid ColumnDefinitions="*,*">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Margin="20" Grid.Column="0">
<StackPanel>
<TextBlock Classes="h1">This is heading 1</TextBlock>
<TextBlock Classes="h2">This is heading 2</TextBlock>
<TextBlock Classes="h3">This is heading 3</TextBlock>
<TextBlock Classes="h4">This is heading 4</TextBlock>
<TextBlock Classes="h5">This is heading 5</TextBlock>
<TextBlock Classes="h6">This is heading 6</TextBlock>
<TextBlock>This is regular text</TextBlock>
<TextBlock>This is regular text</TextBlock>
<TextBlock>This is regular text</TextBlock>
</StackPanel>
</Grid>
<Grid Margin="20" Grid.Column="1">
<StackPanel>
<Border Width="400" Classes="skeleton-text h1"></Border>
<Border Width="400" Classes="skeleton-text h2"></Border>
<Border Width="400" Classes="skeleton-text h3"></Border>
<Border Width="400" Classes="skeleton-text h4"></Border>
<Border Width="400" Classes="skeleton-text h5"></Border>
<Border Width="400" Classes="skeleton-text h6"></Border>
<Border Width="400" Classes="skeleton-text"></Border>
<Border Width="400" Classes="skeleton-text"></Border>
<Border Width="400" Classes="skeleton-text"></Border>
</StackPanel>
<StackPanel>
<StackPanel.Styles>
<Style Selector="TextBlock">
<Setter Property="Background" Value="#55ff0000"></Setter>
</Style>
</StackPanel.Styles>
<TextBlock Classes="h1">This is heading 1</TextBlock>
<TextBlock Classes="h2">This is heading 2</TextBlock>
<TextBlock Classes="h3">This is heading 3</TextBlock>
<TextBlock Classes="h4">This is heading 4</TextBlock>
<TextBlock Classes="h5">This is heading 5</TextBlock>
<TextBlock Classes="h6">This is heading 6</TextBlock>
<TextBlock>This is regular text</TextBlock>
</StackPanel>
</Grid>
<Grid Margin="20" Grid.Column="0" Row="1">
<StackPanel Spacing="2">
<Border Width="400" Classes="skeleton-text h1 no-margin"></Border>
<Border Width="400" Classes="skeleton-text h2 no-margin"></Border>
<Border Width="400" Classes="skeleton-text h3 no-margin"></Border>
<Border Width="400" Classes="skeleton-text h4 no-margin"></Border>
<Border Width="400" Classes="skeleton-text h5 no-margin"></Border>
<Border Width="400" Classes="skeleton-text h6 no-margin"></Border>
<Border Width="400" Classes="skeleton-text no-margin"></Border>
<Border Width="400" Classes="skeleton-text no-margin"></Border>
<Border Width="400" Classes="skeleton-text no-margin"></Border>
</StackPanel>
<StackPanel Spacing="2">
<StackPanel.Styles>
<Style Selector="TextBlock">
<Setter Property="Background" Value="#55ff0000"></Setter>
</Style>
</StackPanel.Styles>
<TextBlock Classes="h1 no-margin">This is heading 1</TextBlock>
<TextBlock Classes="h2 no-margin">This is heading 2</TextBlock>
<TextBlock Classes="h3 no-margin">This is heading 3</TextBlock>
<TextBlock Classes="h4 no-margin">This is heading 4</TextBlock>
<TextBlock Classes="h5 no-margin">This is heading 5</TextBlock>
<TextBlock Classes="h6 no-margin">This is heading 6</TextBlock>
<TextBlock>This is regular text</TextBlock>
</StackPanel>
</Grid>
</Grid>
</Design.PreviewWith>
<Styles.Resources>
<CornerRadius x:Key="CardCornerRadius">8</CornerRadius>
</Styles.Resources>
<Style Selector="Border.skeleton-text">
<Setter Property="Height" Value="17"></Setter>
<Setter Property="Margin" Value="0 1" />
<Setter Property="IsHitTestVisible" Value="False" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Style.Animations>
<Animation Duration="0:0:1.5" IterationCount="Infinite" PlaybackDirection="Normal">
<KeyFrame Cue="0%">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="-100%,-100%" EndPoint="0%,0%">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Gray" />
<GradientStop Offset="0.4" Color="#595959" />
<GradientStop Offset="0.6" Color="#595959" />
<GradientStop Offset="1" Color="Gray" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="100%,100%" EndPoint="200%,200%">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Gray" />
<GradientStop Offset="0.4" Color="#595959" />
<GradientStop Offset="0.6" Color="#595959" />
<GradientStop Offset="1" Color="Gray" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="Border.skeleton-text.h1">
<Setter Property="Height" Value="65" />
<Setter Property="Margin" Value="0 10 0 20" />
<Setter Property="CornerRadius" Value="8" />
</Style>
<Style Selector="Border.skeleton-text.h2">
<Setter Property="Height" Value="44" />
<Setter Property="Margin" Value="0 10 0 20" />
<Setter Property="CornerRadius" Value="8" />
</Style>
<Style Selector="Border.skeleton-text.h3">
<Setter Property="Height" Value="33" />
<Setter Property="Margin" Value="0 5 0 15" />
</Style>
<Style Selector="Border.skeleton-text.h4">
<Setter Property="Height" Value="28" />
<Setter Property="Margin" Value="0 2 0 12" />
</Style>
<Style Selector="Border.skeleton-text.h5">
<Setter Property="Height" Value="20" />
<Setter Property="Margin" Value="0 2 0 7" />
</Style>
<Style Selector="Border.skeleton-text.h6">
<Setter Property="Height" Value="15" />
<Setter Property="Margin" Value="0 2 0 4" />
</Style>
<Style Selector="Border.skeleton-text.h1.no-margin">
<Setter Property="Margin" Value="0 10 0 10" />
</Style>
<Style Selector="Border.skeleton-text.h2.no-margin">
<Setter Property="Margin" Value="0 10 0 10" />
</Style>
<Style Selector="Border.skeleton-text.h3.no-margin">
<Setter Property="Margin" Value="0 5 0 5" />
</Style>
<Style Selector="Border.skeleton-text.h4.no-margin">
<Setter Property="Margin" Value="0 2 0 2" />
</Style>
<Style Selector="Border.skeleton-text.h5.no-margin">
<Setter Property="Margin" Value="0 2 0 2" />
</Style>
<Style Selector="Border.skeleton-text.h6.no-margin">
<Setter Property="Margin" Value="0 2 0 2" />
</Style>
</Styles>