Skip to content

Commit

Permalink
Added CoreBoy.Avalonia project to provide cross-platform GUI for the …
Browse files Browse the repository at this point in the history
…emulator
  • Loading branch information
fknzxlegend1 committed Apr 24, 2020
1 parent 6d35e05 commit b7b38f5
Show file tree
Hide file tree
Showing 11 changed files with 504 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CoreBoy.Avalonia/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="CoreBoy.Avalonia.App">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
</Application.Styles>
</Application>
24 changes: 24 additions & 0 deletions CoreBoy.Avalonia/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;

namespace CoreBoy.Avalonia
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}

public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}

base.OnFrameworkInitializationCompleted();
}
}
}
27 changes: 27 additions & 0 deletions CoreBoy.Avalonia/CoreBoy.Avalonia.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.9.9" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.9" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.9" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ReactiveUI" Version="11.3.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CoreBoy\CoreBoy.csproj" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions CoreBoy.Avalonia/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Setter needed in order to dinamically construct the ViewModels in the MainWindow constructor", Scope = "member", Target = "~P:CoreBoy.Avalonia.MenuItemViewModel.Items")]
36 changes: 36 additions & 0 deletions CoreBoy.Avalonia/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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="CoreBoy.Avalonia.MainWindow"
Title="CoreBoy"
>
<Grid Background="Gray">

<Grid.RowDefinitions>
<RowDefinition MaxHeight="20"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>

<DockPanel Background="White" Grid.Row="0">
<Menu DockPanel.Dock="Top" Items="{Binding MenuItems}">

<Menu.Styles>
<Style Selector="MenuItem">
<Setter Property="Header" Value="{Binding Header}"/>
<Setter Property="Items" Value="{Binding Items}"/>
<Setter Property="Command" Value="{Binding Command}"/>
<Setter Property="CommandParameter" Value="{Binding CommandParameter}"/>
</Style>
</Menu.Styles>

</Menu>
</DockPanel>

<Image x:Name="ImageBox" Grid.Row ="1">

</Image>

</Grid>
</Window>
Loading

0 comments on commit b7b38f5

Please sign in to comment.