mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add splash window skeleton.
This commit is contained in:
3
.idea/.idea.Aaru/.idea/contentModel.xml
generated
3
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -1299,11 +1299,14 @@
|
||||
<e p="ViewLocator.cs" t="Include" />
|
||||
<e p="ViewModels" t="Include">
|
||||
<e p="MainWindowViewModel.cs" t="Include" />
|
||||
<e p="SplashWindowViewModel.cs" t="Include" />
|
||||
<e p="ViewModelBase.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Views" t="Include">
|
||||
<e p="MainWindow.xaml" t="Include" />
|
||||
<e p="MainWindow.xaml.cs" t="Include" />
|
||||
<e p="SplashWindow.xaml" t="Include" />
|
||||
<e p="SplashWindow.xaml.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="Aaru.Helpers" t="IncludeRecursive">
|
||||
|
||||
@@ -317,6 +317,12 @@
|
||||
<SubType>Designer</SubType>
|
||||
</AvaloniaResource>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<AvaloniaResource Update="Views\SplashWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</AvaloniaResource>
|
||||
<Compile Update="Views\SplashWindow.xaml.cs">
|
||||
<DependentUpon>SplashWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\MainWindow.xaml" />
|
||||
|
||||
@@ -8,18 +8,15 @@ namespace Aaru.Gui
|
||||
{
|
||||
public class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public override void Initialize() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
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()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
45
Aaru.Gui/ViewModels/SplashWindowViewModel.cs
Normal file
45
Aaru.Gui/ViewModels/SplashWindowViewModel.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class SplashWindowViewModel : ViewModelBase
|
||||
{
|
||||
double _currentProgress;
|
||||
double _maxProgress;
|
||||
string _message;
|
||||
|
||||
public string Message
|
||||
{
|
||||
get => _message;
|
||||
set => this.RaiseAndSetIfChanged(ref _message, value);
|
||||
}
|
||||
|
||||
public double MaxProgress
|
||||
{
|
||||
get => _maxProgress;
|
||||
set => this.RaiseAndSetIfChanged(ref _maxProgress, value);
|
||||
}
|
||||
|
||||
public double CurrentProgress
|
||||
{
|
||||
get => _currentProgress;
|
||||
set => this.RaiseAndSetIfChanged(ref _currentProgress, value);
|
||||
}
|
||||
|
||||
internal void OnOpened()
|
||||
{
|
||||
Message = "Welcome to Aaru!";
|
||||
MaxProgress = 2;
|
||||
CurrentProgress = 0;
|
||||
|
||||
Dispatcher.UIThread.Post(InitializeConsole);
|
||||
}
|
||||
|
||||
void InitializeConsole()
|
||||
{
|
||||
CurrentProgress++;
|
||||
Message = "Initializing console...";
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Aaru.Gui/Views/SplashWindow.xaml
Normal file
20
Aaru.Gui/Views/SplashWindow.xaml
Normal file
@@ -0,0 +1,20 @@
|
||||
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:Aaru.Gui.ViewModels;assembly=Aaru.Gui"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800"
|
||||
d:DesignHeight="450" x:Class="Aaru.Gui.Views.SplashWindow" Icon="/Assets/avalonia-logo.ico" Title="Aaru"
|
||||
HasSystemDecorations="False">
|
||||
<Design.DataContext>
|
||||
<vm:SplashWindowViewModel />
|
||||
</Design.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Image Source="/Assets/avalonia-logo.ico" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Grid.Row="0" />
|
||||
<TextBlock Text="{Binding Message}" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" />
|
||||
<ProgressBar Maximum="{Binding MaxProgress}" Minimum="0" Value="{Binding CurrentProgress}"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Grid.Row="2" />
|
||||
</Grid>
|
||||
</Window>
|
||||
27
Aaru.Gui/Views/SplashWindow.xaml.cs
Normal file
27
Aaru.Gui/Views/SplashWindow.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Aaru.Gui.ViewModels;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Aaru.Gui.Views
|
||||
{
|
||||
public class SplashWindow : Window
|
||||
{
|
||||
public SplashWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
protected override void OnOpened(EventArgs e)
|
||||
{
|
||||
base.OnOpened(e);
|
||||
(DataContext as SplashWindowViewModel)?.OnOpened();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user