Gui loading background

This commit is contained in:
2023-08-21 15:20:21 +02:00
parent fff07e5da7
commit 43c9d3ce76
6 changed files with 27 additions and 25 deletions

View File

@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<LinearGradientBrush x:Key="ContentSeparatorBrush">
<GradientStop Color="#0093a1a1" Offset="0" />
<GradientStop Color="#93a1a1" Offset="0.5" />
@@ -15,36 +14,29 @@
<SolidColorBrush Color="{DynamicResource AppBackgroundColor}" x:Key="AppBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource AppLoadingBackgroundColor}" x:Key="AppLoadingBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource ContainerBackgroundColor}" x:Key="ContainerBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource TransparentContainerBackgroundColor}"
x:Key="TransparentContainerBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource TransparentContainerBackgroundColor}" x:Key="TransparentContainerBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource ItemBackgroundColor}" x:Key="ItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource AlternativeItemBackgroundColor}"
x:Key="AlternativeItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource AlternativeItemBackgroundColor}" x:Key="AlternativeItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource SelectedItemBackgroundColor}" x:Key="SelectedItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedItemBackgroundColor}" x:Key="MarkedItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedSelectedItemBackgroundColor}"
x:Key="MarkedSelectedItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedAlternativeItemBackgroundColor}"
x:Key="MarkedAlternativeItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedSelectedItemBackgroundColor}" x:Key="MarkedSelectedItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedAlternativeItemBackgroundColor}" x:Key="MarkedAlternativeItemBackgroundBrush" />
<SolidColorBrush Color="{DynamicResource ForegroundColor}" x:Key="ForegroundBrush" />
<SolidColorBrush Color="{DynamicResource AccentColor}" x:Key="AccentBrush" />
<SolidColorBrush Color="{DynamicResource AccentComplementColor}" x:Key="AccentComplementBrush" />
<SolidColorBrush Color="{DynamicResource LightForegroundColor}" x:Key="LightForegroundBrush" />
<SolidColorBrush Color="{DynamicResource AlternativeItemForegroundColor}"
x:Key="AlternativeItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource AlternativeItemForegroundColor}" x:Key="AlternativeItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource SelectedItemForegroundColor}" x:Key="SelectedItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedItemForegroundColor}" x:Key="MarkedItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedAlternativeItemForegroundColor}"
x:Key="MarkedAlternativeItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedSelectedItemForegroundColor}"
x:Key="MarkedSelectedItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedAlternativeItemForegroundColor}" x:Key="MarkedAlternativeItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource MarkedSelectedItemForegroundColor}" x:Key="MarkedSelectedItemForegroundBrush" />
<SolidColorBrush Color="{DynamicResource ErrorColor}" x:Key="ErrorBrush" />
<SolidColorBrush Color="{DynamicResource SelectedItemBackgroundColor}"
x:Key="SystemControlHighlightListAccentLowBrush" />
<SolidColorBrush Color="{DynamicResource SelectedItemBackgroundColor}" x:Key="SystemControlHighlightListAccentLowBrush" />
</ResourceDictionary>

View File

@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="AppBackgroundColor">#E7073642</Color>
<Color x:Key="AppLoadingBackgroundColor">#80073642</Color>
<Color x:Key="ContainerBackgroundColor">#083e4c</Color>
<Color x:Key="TransparentContainerBackgroundColor">#D0083e4c</Color>
<Color x:Key="BarelyTransparentBackgroundColor">#80083e4c</Color>

View File

@@ -1,3 +1,4 @@
using Avalonia.Controls;
using DeclarativeProperty;
namespace FileTime.GuiApp.App.ViewModels;
@@ -8,4 +9,5 @@ public interface IMainWindowViewModelBase
bool Loading { get; }
IObservable<string?> MainFont { get; }
DeclarativeProperty<string> FatalError { get; }
IReadOnlyList<WindowTransparencyLevel> TransparencyLevelHint { get; }
}

View File

@@ -1,4 +1,5 @@
using System.Reactive.Subjects;
using Avalonia.Controls;
using DeclarativeProperty;
namespace FileTime.GuiApp.App.ViewModels;
@@ -9,4 +10,5 @@ public class MainWindowLoadingViewModel : IMainWindowViewModelBase
public IObservable<string?> MainFont { get; } = new BehaviorSubject<string?>("");
public DeclarativeProperty<string> Title { get; } = new("Loading...");
public DeclarativeProperty<string> FatalError { get; } = new();
public IReadOnlyList<WindowTransparencyLevel> TransparencyLevelHint { get; } = new[] {WindowTransparencyLevel.AcrylicBlur};
}

View File

@@ -1,5 +1,6 @@
using System.Reactive.Linq;
using System.Reflection;
using Avalonia.Controls;
using Avalonia.Input;
using DeclarativeProperty;
using FileTime.App.CommandPalette.Services;
@@ -43,6 +44,7 @@ public partial class MainWindowViewModel : IMainWindowViewModel
public bool Loading => false;
public IObservable<string?> MainFont => _fontService.MainFont.Select(x => x ?? "");
public DeclarativeProperty<string> FatalError { get; } = new();
public IReadOnlyList<WindowTransparencyLevel> TransparencyLevelHint { get; } = new[] {WindowTransparencyLevel.Blur};
public IGuiAppState AppState => _appState;
public DeclarativeProperty<string> Title { get; } = new();
public Action? FocusDefaultElement { get; set; }

View File

@@ -11,7 +11,7 @@
Opened="OnWindowOpened"
RequestedThemeVariant="Dark"
Title="FileTime"
TransparencyLevelHint="Blur"
TransparencyLevelHint="{Binding TransparencyLevelHint}"
d:DataContext="vm:MainWindowDesignViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
@@ -21,6 +21,7 @@
x:DataType="vm:IMainWindowViewModelBase"
xmlns="https://github.com/avaloniaui"
xmlns:appCoreModels="using:FileTime.App.Core.Models"
xmlns:converters="clr-namespace:FileTime.GuiApp.App.Converters"
xmlns:corevm="using:FileTime.App.Core.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
@@ -47,8 +48,11 @@
<StyleInclude Source="avares://FileTime.GuiApp.App/Resources/Styles.axaml" />
</Window.Styles>
<Grid Background="{DynamicResource AppBackgroundBrush}">
<Grid IsVisible="{Binding Loading, Converter={x:Static BoolConverters.Not}, FallbackValue=False}" x:DataType="vm:IMainWindowViewModel">
<Grid>
<Grid
Background="{DynamicResource AppBackgroundBrush}"
IsVisible="{Binding Loading, Converter={x:Static BoolConverters.Not}, FallbackValue=False}"
x:DataType="vm:IMainWindowViewModel">
<Grid ColumnDefinitions="250,*" RowDefinitions="Auto,*">
@@ -925,7 +929,7 @@
</Border>
</Grid>
<Grid IsVisible="{Binding Loading}">
<Grid Background="{DynamicResource AppLoadingBackgroundBrush}" IsVisible="{Binding Loading}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Image
Height="128"