mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Add splash window.
This commit is contained in:
@@ -13,9 +13,9 @@ namespace RomRepoMgr
|
|||||||
public override void OnFrameworkInitializationCompleted()
|
public override void OnFrameworkInitializationCompleted()
|
||||||
{
|
{
|
||||||
if(ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if(ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
desktop.MainWindow = new MainWindow
|
desktop.MainWindow = new SplashWindow
|
||||||
{
|
{
|
||||||
DataContext = new MainWindowViewModel()
|
DataContext = new SplashWindowViewModel()
|
||||||
};
|
};
|
||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
base.OnFrameworkInitializationCompleted();
|
||||||
|
|||||||
11
RomRepoMgr/Assets/emblem-checked.svg
Normal file
11
RomRepoMgr/Assets/emblem-checked.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<svg viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<style
|
||||||
|
type="text/css"
|
||||||
|
id="current-color-scheme">
|
||||||
|
.ColorScheme-PositiveText {
|
||||||
|
color:#27ae60;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<rect style="fill:currentColor;fill-opacity:1;stroke:none" class="ColorScheme-PositiveText" height="8" rx="1" width="8"/>
|
||||||
|
<path d="M6 2L3 5 1.5 3.5l-1 1L3 7l4-4z" fill="#fff"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 407 B |
11
RomRepoMgr/Assets/emblem-error.svg
Normal file
11
RomRepoMgr/Assets/emblem-error.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<svg viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<style
|
||||||
|
type="text/css"
|
||||||
|
id="current-color-scheme">
|
||||||
|
.ColorScheme-NegativeText {
|
||||||
|
color:#da4453;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<path style="fill:currentColor;fill-opacity:1;stroke:none" class="ColorScheme-NegativeText" d="M1 0C.446 0 0 .446 0 1v6c0 .554.446 1 1 1h6c.554 0 1-.446 1-1V1c0-.554-.446-1-1-1z"/>
|
||||||
|
<path d="M2 1L1 2l2 2-2 2 1 1 2-2 2 2 1-1-2-2 2-2-1-1-2 2z" fill="#fff"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 485 B |
4
RomRepoMgr/Assets/emblem-question.svg
Normal file
4
RomRepoMgr/Assets/emblem-question.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<svg viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect fill="#9b59b6" height="8" rx="1" width="8"/>
|
||||||
|
<path d="M4 1a2 2 0 0 0-2 2h1a1 1 0 0 1 1-1 1 1 0 0 1 1 1 1 1 0 0 1-1 1H3v2h1V5a2 2 0 0 0 2-2 2 2 0 0 0-2-2zM3 7h1v1H3z" fill="#fff"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 260 B |
@@ -24,7 +24,6 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Logging.Serilog;
|
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
|
|
||||||
namespace RomRepoMgr
|
namespace RomRepoMgr
|
||||||
|
|||||||
@@ -14,8 +14,9 @@
|
|||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="0.9.12" />
|
<PackageReference Include="Avalonia" Version="0.10.0-preview3" />
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="0.9.12" />
|
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview3" />
|
||||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.12" />
|
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0-preview3" />
|
||||||
|
<PackageReference Include="Svg.Skia.Avalonia" Version="0.10.0-preview3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
173
RomRepoMgr/ViewModels/SplashWindowViewModel.cs
Normal file
173
RomRepoMgr/ViewModels/SplashWindowViewModel.cs
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// RomRepoMgr - ROM repository manager
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2020 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System.Reactive;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
|
namespace RomRepoMgr.ViewModels
|
||||||
|
{
|
||||||
|
public sealed class SplashWindowViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
string _exitButtonText;
|
||||||
|
bool _exitVisible;
|
||||||
|
bool _loadingDatabaseError;
|
||||||
|
bool _loadingDatabaseOk;
|
||||||
|
string _loadingDatabaseText;
|
||||||
|
bool _loadingDatabaseUnknown;
|
||||||
|
bool _loadingSettingsError;
|
||||||
|
bool _loadingSettingsOk;
|
||||||
|
string _loadingSettingsText;
|
||||||
|
bool _loadingSettingsUnknown;
|
||||||
|
string _loadingText;
|
||||||
|
bool _migratingDatabaseError;
|
||||||
|
bool _migratingDatabaseOk;
|
||||||
|
string _migratingDatabaseText;
|
||||||
|
bool _migratingDatabaseUnknown;
|
||||||
|
|
||||||
|
public SplashWindowViewModel()
|
||||||
|
{
|
||||||
|
ExitCommand = ReactiveCommand.Create(ExecuteExitCommand);
|
||||||
|
|
||||||
|
LoadStrings();
|
||||||
|
|
||||||
|
LoadingSettingsOk = false;
|
||||||
|
LoadingSettingsError = false;
|
||||||
|
LoadingSettingsUnknown = true;
|
||||||
|
LoadingDatabaseOk = false;
|
||||||
|
LoadingDatabaseError = false;
|
||||||
|
LoadingDatabaseUnknown = true;
|
||||||
|
MigratingDatabaseOk = false;
|
||||||
|
MigratingDatabaseError = false;
|
||||||
|
MigratingDatabaseUnknown = true;
|
||||||
|
ExitVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReactiveCommand<Unit, Unit> ExitCommand { get; }
|
||||||
|
|
||||||
|
public string LoadingText
|
||||||
|
{
|
||||||
|
get => _loadingText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string LoadingSettingsText
|
||||||
|
{
|
||||||
|
get => _loadingSettingsText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingSettingsText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingSettingsOk
|
||||||
|
{
|
||||||
|
get => _loadingSettingsOk;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingSettingsOk, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingSettingsError
|
||||||
|
{
|
||||||
|
get => _loadingSettingsError;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingSettingsError, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingSettingsUnknown
|
||||||
|
{
|
||||||
|
get => _loadingSettingsUnknown;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingSettingsUnknown, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string LoadingDatabaseText
|
||||||
|
{
|
||||||
|
get => _loadingDatabaseText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingDatabaseText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingDatabaseOk
|
||||||
|
{
|
||||||
|
get => _loadingDatabaseOk;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingDatabaseOk, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingDatabaseError
|
||||||
|
{
|
||||||
|
get => _loadingDatabaseError;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingDatabaseError, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingDatabaseUnknown
|
||||||
|
{
|
||||||
|
get => _loadingDatabaseUnknown;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _loadingDatabaseUnknown, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MigratingDatabaseText
|
||||||
|
{
|
||||||
|
get => _migratingDatabaseText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _migratingDatabaseText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MigratingDatabaseOk
|
||||||
|
{
|
||||||
|
get => _migratingDatabaseOk;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _migratingDatabaseOk, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MigratingDatabaseError
|
||||||
|
{
|
||||||
|
get => _migratingDatabaseError;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _migratingDatabaseError, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MigratingDatabaseUnknown
|
||||||
|
{
|
||||||
|
get => _migratingDatabaseUnknown;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _migratingDatabaseUnknown, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ExitVisible
|
||||||
|
{
|
||||||
|
get => _exitVisible;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _exitVisible, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ExitButtonText
|
||||||
|
{
|
||||||
|
get => _exitButtonText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _exitButtonText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void ExecuteExitCommand() =>
|
||||||
|
(Application.Current.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
|
||||||
|
|
||||||
|
void LoadStrings()
|
||||||
|
{
|
||||||
|
LoadingText = "ROM Repository Manager";
|
||||||
|
LoadingSettingsText = "Loading settings...";
|
||||||
|
LoadingDatabaseText = "Loading database...";
|
||||||
|
MigratingDatabaseText = "Migrating database...";
|
||||||
|
ExitButtonText = "Exit";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
73
RomRepoMgr/Views/SplashWindow.xaml
Normal file
73
RomRepoMgr/Views/SplashWindow.xaml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="clr-namespace:RomRepoMgr.ViewModels;assembly=RomRepoMgr"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:svg="clr-namespace:Svg.Skia.Avalonia;assembly=Svg.Skia.Avalonia" mc:Ignorable="d" d:DesignWidth="450"
|
||||||
|
d:DesignHeight="250" x:Class="RomRepoMgr.Views.SplashWindow" Icon="/Assets/avalonia-logo.ico"
|
||||||
|
Title="ROM Repository Manager" SystemDecorations="BorderOnly" WindowStartupLocation="CenterScreen" Width="250"
|
||||||
|
Height="120">
|
||||||
|
<Design.DataContext>
|
||||||
|
<vm:SplashWindowViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<!-- Icons from KDE's Breeze-->
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top" Orientation="Vertical" Margin="5">
|
||||||
|
<TextBlock Text="{Binding LoadingText}" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Top" />
|
||||||
|
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding LoadingSettingsOk}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-checked.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding LoadingSettingsError}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-error.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding LoadingSettingsUnknown}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-question.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<TextBlock Text="{Binding LoadingSettingsText}" VerticalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding LoadingDatabaseOk}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-checked.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding LoadingDatabaseError}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-error.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding LoadingDatabaseUnknown}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-question.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<TextBlock Text="{Binding LoadingDatabaseText}" VerticalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding MigratingDatabaseOk}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-checked.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding MigratingDatabaseError}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-error.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Image MaxWidth="24" MaxHeight="24" IsVisible="{Binding MigratingDatabaseUnknown}">
|
||||||
|
<Image.Source>
|
||||||
|
<svg:SvgImage Source="/Assets/emblem-question.svg" />
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<TextBlock Text="{Binding MigratingDatabaseText}" VerticalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
<Button Command="{Binding ExitCommand}" IsVisible="{Binding ExitVisible}" HorizontalAlignment="Right">
|
||||||
|
<TextBlock Text="{Binding ExitButtonText}" />
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Window>
|
||||||
37
RomRepoMgr/Views/SplashWindow.xaml.cs
Normal file
37
RomRepoMgr/Views/SplashWindow.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// RomRepoMgr - ROM repository manager
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2020 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace RomRepoMgr.Views
|
||||||
|
{
|
||||||
|
public sealed class SplashWindow : Window
|
||||||
|
{
|
||||||
|
public SplashWindow() => InitializeComponent();
|
||||||
|
|
||||||
|
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user