mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add Avalonia skeleton.
This commit is contained in:
53
.idea/.idea.Aaru/.idea/contentModel.xml
generated
53
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -3,7 +3,7 @@
|
||||
<component name="ContentModelStore">
|
||||
<e p="C:\Users\claunia\AppData\Local\JetBrains\Rider2020.1\extResources" t="IncludeRecursive" />
|
||||
<e p="C:\Users\claunia\AppData\Local\JetBrains\Rider2020.1\resharper-host\Local\Transient\ReSharperHost\v201\SolutionCaches\_Aaru.795230756.00" t="ExcludeRecursive" />
|
||||
<e p="C:\Users\claunia\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-1\201.6668.91.plugins\puppet\lib\stubs" t="IncludeRecursive" />
|
||||
<e p="C:\Users\claunia\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-1\201.6668.112.plugins\puppet\lib\stubs" t="IncludeRecursive" />
|
||||
<e p="C:\Users\claunia\Development\Aaru\Aaru" t="IncludeFlat">
|
||||
<e p=".git\info\exclude" t="IncludeRecursive" />
|
||||
<e p=".git\modules\Aaru.Checksums\info\exclude" t="IncludeRecursive" />
|
||||
@@ -74,6 +74,9 @@
|
||||
<e p="Debug" t="Include">
|
||||
<e p="netcoreapp3.0" t="Include">
|
||||
<e p="Aaru.AssemblyInfo.cs" t="Include" />
|
||||
<e p="Avalonia" t="Include">
|
||||
<e p="resources" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
@@ -83,37 +86,6 @@
|
||||
</e>
|
||||
<e p="Settings.StyleCop" t="Include" />
|
||||
</e>
|
||||
<e p="Aaru.Avalon" t="IncludeRecursive">
|
||||
<e p="Aaru.Avalon.csproj" t="IncludeRecursive" />
|
||||
<e p="App.xaml" t="Include" />
|
||||
<e p="App.xaml.cs" t="Include" />
|
||||
<e p="Assets" t="Include">
|
||||
<e p="avalonia-logo.ico" t="Include" />
|
||||
</e>
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="Models" t="Include" />
|
||||
<e p="nuget.config" t="Include" />
|
||||
<e p="obj" t="ExcludeRecursive">
|
||||
<e p="Debug" t="Include">
|
||||
<e p="netcoreapp3.0" t="Include">
|
||||
<e p="Aaru.Avalon.AssemblyInfo.cs" t="Include" />
|
||||
<e p="Avalonia" t="Include">
|
||||
<e p="resources" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
<e p="Program.cs" t="Include" />
|
||||
<e p="ViewLocator.cs" t="Include" />
|
||||
<e p="ViewModels" t="Include">
|
||||
<e p="MainWindowViewModel.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>
|
||||
</e>
|
||||
<e p="Aaru.Checksums" t="IncludeRecursive">
|
||||
<e p=".editorconfig" t="Include" />
|
||||
<e p=".gitignore" t="Include" />
|
||||
@@ -944,9 +916,11 @@
|
||||
<e p="ZZZNoFilter.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Aaru.Gui" t="IncludeRecursive">
|
||||
<e p=".Aaru.Gui.csproj.kate-swp" t="Include" />
|
||||
<e p="Aaru.Gui.csproj" t="IncludeRecursive" />
|
||||
<e p="App.xaml" t="Include" />
|
||||
<e p="App.xaml.cs" t="Include" />
|
||||
<e p="Assets" t="Include">
|
||||
<e p="avalonia-logo.ico" t="Include" />
|
||||
<e p="Icons" t="Include">
|
||||
<e p="oxygen" t="Include">
|
||||
<e p="32x32" t="Include">
|
||||
@@ -1276,10 +1250,14 @@
|
||||
<e p="frmPrintHex.xeto" t="Include" />
|
||||
<e p="frmPrintHex.xeto.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Models" t="Include" />
|
||||
<e p="obj" t="ExcludeRecursive">
|
||||
<e p="Debug" t="Include">
|
||||
<e p="netcoreapp3.0" t="Include">
|
||||
<e p="Aaru.Gui.AssemblyInfo.cs" t="Include" />
|
||||
<e p="Avalonia" t="Include">
|
||||
<e p="resources" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
@@ -1318,6 +1296,15 @@
|
||||
<e p="tabXboxInfo.xeto" t="Include" />
|
||||
<e p="tabXboxInfo.xeto.cs" t="Include" />
|
||||
</e>
|
||||
<e p="ViewLocator.cs" t="Include" />
|
||||
<e p="ViewModels" t="Include">
|
||||
<e p="MainWindowViewModel.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>
|
||||
</e>
|
||||
<e p="Aaru.Helpers" t="IncludeRecursive">
|
||||
<e p=".editorconfig" t="Include" />
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
<PackageReference Include="Eto.Forms" Version="2.5.0" />
|
||||
<PackageReference Include="Eto.Serialization.Xaml" Version="2.5.0" />
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.3.0" />
|
||||
<PackageReference Include="Avalonia" Version="0.9.0" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.9.0" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Aaru.Core\Aaru.Core.csproj" />
|
||||
@@ -304,6 +307,20 @@
|
||||
<EmbeddedResource Include="Assets\Icons\oxygen\32x32\media-flash-sd-mmc.png" />
|
||||
<EmbeddedResource Include="Assets\Icons\oxygen\32x32\media-tape.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets" />
|
||||
<Folder Include="Models\" />
|
||||
<Compile Update="**\*.xaml.cs">
|
||||
<DependentUpon>%(Filename)</DependentUpon>
|
||||
</Compile>
|
||||
<AvaloniaResource Include="**\*.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</AvaloniaResource>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\MainWindow.xaml" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4')) and '$(OS)' == 'Unix'">
|
||||
<!-- When compiling .NET SDK 2.0 projects targeting .NET 4.x on Mono using 'dotnet build' you -->
|
||||
<!-- have to teach MSBuild where the Mono copy of the reference asssemblies is -->
|
||||
|
||||
13
Aaru.Gui/App.xaml
Normal file
13
Aaru.Gui/App.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:gui="clr-namespace:Aaru.Gui"
|
||||
x:Class="Aaru.Gui.App">
|
||||
<Application.DataTemplates>
|
||||
<gui:ViewLocator/>
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
29
Aaru.Gui/App.xaml.cs
Normal file
29
Aaru.Gui/App.xaml.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Aaru.Gui.ViewModels;
|
||||
using Aaru.Gui.Views;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Aaru.Gui
|
||||
{
|
||||
public class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = new MainWindow
|
||||
{
|
||||
DataContext = new MainWindowViewModel(),
|
||||
};
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Aaru.Gui/Assets/avalonia-logo.ico
Normal file
BIN
Aaru.Gui/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
32
Aaru.Gui/ViewLocator.cs
Normal file
32
Aaru.Gui/ViewLocator.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Aaru.Gui.ViewModels;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
|
||||
namespace Aaru.Gui
|
||||
{
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
public bool SupportsRecycling => false;
|
||||
|
||||
public IControl Build(object data)
|
||||
{
|
||||
var name = data.GetType().FullName.Replace("ViewModel", "View");
|
||||
var type = Type.GetType(name);
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
return (Control)Activator.CreateInstance(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
}
|
||||
|
||||
public bool Match(object data)
|
||||
{
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Aaru.Gui/ViewModels/MainWindowViewModel.cs
Normal file
7
Aaru.Gui/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
public string Greeting => "Welcome to Avalonia!";
|
||||
}
|
||||
}
|
||||
8
Aaru.Gui/ViewModels/ViewModelBase.cs
Normal file
8
Aaru.Gui/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
}
|
||||
17
Aaru.Gui/Views/MainWindow.xaml
Normal file
17
Aaru.Gui/Views/MainWindow.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<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.MainWindow"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="Aaru.Gui">
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
|
||||
</Window>
|
||||
22
Aaru.Gui/Views/MainWindow.xaml.cs
Normal file
22
Aaru.Gui/Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Aaru.Gui.Views
|
||||
{
|
||||
public class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Aaru.sln
11
Aaru.sln
@@ -1,4 +1,3 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29102.190
|
||||
@@ -35,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru.Database", "Aaru.Datab
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru.Dto", "Aaru.Dto\Aaru.Dto.csproj", "{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aaru.Gui", "Aaru.Gui\Aaru.Gui.csproj", "{18C4C44D-2562-4B6D-8181-32D7EA067D96}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -171,6 +172,14 @@ Global
|
||||
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|x86.Build.0 = Release|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{18C4C44D-2562-4B6D-8181-32D7EA067D96}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -200,6 +200,7 @@
|
||||
<Name>Aaru.Checksums</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Aaru.Database\Aaru.Database.csproj" />
|
||||
<ProjectReference Include="..\Aaru.Gui\Aaru.Gui.csproj" />
|
||||
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj">
|
||||
<Project>{F8BDF57B-1571-4CD0-84B3-B422088D359A}</Project>
|
||||
<Name>Aaru.Helpers</Name>
|
||||
@@ -281,8 +282,10 @@
|
||||
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
|
||||
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
|
||||
<PackageReference Include="Avalonia" Version="0.9.0" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.9.0" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
<DebugPackage>-dbg</DebugPackage>
|
||||
<Optimize>false</Optimize>
|
||||
|
||||
19
Aaru/Main.cs
19
Aaru/Main.cs
@@ -36,6 +36,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Aaru.Gui;
|
||||
using Aaru.Commands;
|
||||
using Aaru.Commands.Device;
|
||||
using Aaru.Commands.Filesystem;
|
||||
@@ -46,6 +47,9 @@ using Aaru.Core;
|
||||
using Aaru.Database;
|
||||
using Aaru.Settings;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Avalonia;
|
||||
using Avalonia.Logging.Serilog;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Aaru
|
||||
{
|
||||
@@ -55,7 +59,6 @@ namespace Aaru
|
||||
static string _assemblyTitle;
|
||||
static AssemblyInformationalVersionAttribute _assemblyVersion;
|
||||
|
||||
[STAThread]
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
object[] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
||||
@@ -68,6 +71,13 @@ namespace Aaru
|
||||
|
||||
_assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
|
||||
if(args.Length == 1 &&
|
||||
args[0].ToLowerInvariant() == "gui")
|
||||
{
|
||||
return BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
AaruConsole.WriteLineEvent += System.Console.WriteLine;
|
||||
AaruConsole.WriteEvent += System.Console.Write;
|
||||
AaruConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
|
||||
@@ -157,5 +167,12 @@ namespace Aaru
|
||||
AaruConsole.WriteLine("{0}", _assemblyCopyright);
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToDebug()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user