feat: initialize projects.
This commit is contained in:
54
.gitignore
vendored
54
.gitignore
vendored
@@ -348,3 +348,57 @@ MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
|
||||
#################
|
||||
## Rider
|
||||
#################
|
||||
.idea
|
||||
|
||||
#################
|
||||
## VS Code
|
||||
#################
|
||||
.vscode/
|
||||
|
||||
#################
|
||||
## Cake
|
||||
#################
|
||||
tools/*
|
||||
!tools/packages.config
|
||||
.nuget
|
||||
artifacts/
|
||||
nuget
|
||||
Avalonia.XBuild.sln
|
||||
project.lock.json
|
||||
.idea/*
|
||||
|
||||
|
||||
##################
|
||||
## BenchmarkDotNet
|
||||
##################
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
dirs.sln
|
||||
|
||||
|
||||
##################
|
||||
# Xcode
|
||||
##################
|
||||
Index/
|
||||
Logs/
|
||||
ModuleCache.noindex/
|
||||
Build/Intermediates.noindex/
|
||||
build-intermediate
|
||||
obj-Direct2D1/
|
||||
obj-Skia/
|
||||
|
||||
##################
|
||||
# Vim
|
||||
##################
|
||||
.vim
|
||||
coc-settings.json
|
||||
.ccls-cache
|
||||
.ccls
|
||||
*.map
|
||||
src/Web/Avalonia.Web.Blazor/wwwroot/*.js
|
||||
src/Web/Avalonia.Web.Blazor/Interop/Typescript/*.js
|
||||
28
Ursa.sln
Normal file
28
Ursa.sln
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa", "src\Ursa\Ursa.csproj", "{14E5B6D1-E3ED-41D7-9664-37ABE3B22558}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa.Demo", "demo\Ursa.Demo\Ursa.Demo.csproj", "{407A91FD-A88B-459B-8DCE-8C6AA98279FE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa.Themes.Semi", "src\Ursa.Themes.Semi\Ursa.Themes.Semi.csproj", "{53B5F277-3AEB-4661-ACAE-15CFFF2ED800}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{14E5B6D1-E3ED-41D7-9664-37ABE3B22558}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{14E5B6D1-E3ED-41D7-9664-37ABE3B22558}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{14E5B6D1-E3ED-41D7-9664-37ABE3B22558}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{14E5B6D1-E3ED-41D7-9664-37ABE3B22558}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{407A91FD-A88B-459B-8DCE-8C6AA98279FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{407A91FD-A88B-459B-8DCE-8C6AA98279FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{407A91FD-A88B-459B-8DCE-8C6AA98279FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{407A91FD-A88B-459B-8DCE-8C6AA98279FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{53B5F277-3AEB-4661-ACAE-15CFFF2ED800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{53B5F277-3AEB-4661-ACAE-15CFFF2ED800}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{53B5F277-3AEB-4661-ACAE-15CFFF2ED800}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{53B5F277-3AEB-4661-ACAE-15CFFF2ED800}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
9
demo/Ursa.Demo/App.axaml
Normal file
9
demo/Ursa.Demo/App.axaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application
|
||||
x:Class="Ursa.Demo.App"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Ursa.Demo">
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/LightTheme.axaml" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
33
demo/Ursa.Demo/App.axaml.cs
Normal file
33
demo/Ursa.Demo/App.axaml.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Data.Core;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Demo.ViewModels;
|
||||
using Ursa.Demo.Views;
|
||||
|
||||
namespace Ursa.Demo;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
// Line below is needed to remove Avalonia data validation.
|
||||
// Without this line you will get duplicate validations from both Avalonia and CT
|
||||
ExpressionObserver.DataValidators.RemoveAll(x => x is DataAnnotationsValidationPlugin);
|
||||
desktop.MainWindow = new MainWindow
|
||||
{
|
||||
DataContext = new MainWindowViewModel(),
|
||||
};
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
BIN
demo/Ursa.Demo/Assets/avalonia-logo.ico
Normal file
BIN
demo/Ursa.Demo/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
20
demo/Ursa.Demo/Program.cs
Normal file
20
demo/Ursa.Demo/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
|
||||
namespace Ursa.Demo;
|
||||
|
||||
class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace();
|
||||
}
|
||||
5
demo/Ursa.Demo/Roots.xml
Normal file
5
demo/Ursa.Demo/Roots.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<linker>
|
||||
<!-- Can be removed if CompiledBinding and no reflection are used -->
|
||||
<assembly fullname="Ursa.Demo" preserve="All" />
|
||||
<assembly fullname="Avalonia.Themes.Fluent" preserve="All" />
|
||||
</linker>
|
||||
29
demo/Ursa.Demo/Ursa.Demo.csproj
Normal file
29
demo/Ursa.Demo/Ursa.Demo.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<None Remove=".gitignore" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootDescriptor Include="Roots.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview4" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
<PackageReference Include="Semi.Avalonia" Version="0.1.0-preview3" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
27
demo/Ursa.Demo/ViewLocator.cs
Normal file
27
demo/Ursa.Demo/ViewLocator.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo;
|
||||
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
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)!;
|
||||
}
|
||||
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
|
||||
public bool Match(object data)
|
||||
{
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
6
demo/Ursa.Demo/ViewModels/MainWindowViewModel.cs
Normal file
6
demo/Ursa.Demo/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
public string Greeting => "Welcome to Avalonia!";
|
||||
}
|
||||
7
demo/Ursa.Demo/ViewModels/ViewModelBase.cs
Normal file
7
demo/Ursa.Demo/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class ViewModelBase : ObservableObject
|
||||
{
|
||||
}
|
||||
26
demo/Ursa.Demo/Views/MainWindow.axaml
Normal file
26
demo/Ursa.Demo/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<Window
|
||||
x:Class="Ursa.Demo.Views.MainWindow"
|
||||
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"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
Title="Ursa.Demo"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<StackPanel Spacing="20">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Greeting}" />
|
||||
<Button Content="Hello World" />
|
||||
</StackPanel>
|
||||
|
||||
</Window>
|
||||
11
demo/Ursa.Demo/Views/MainWindow.axaml.cs
Normal file
11
demo/Ursa.Demo/Views/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Ursa.Demo.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
18
demo/Ursa.Demo/app.manifest
Normal file
18
demo/Ursa.Demo/app.manifest
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embeded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="AvaloniaTest.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
5
src/Ursa.Themes.Semi/Class1.cs
Normal file
5
src/Ursa.Themes.Semi/Class1.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Ursa.Themes.Semi;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
18
src/Ursa.Themes.Semi/Ursa.Themes.Semi.csproj
Normal file
18
src/Ursa.Themes.Semi/Ursa.Themes.Semi.csproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ursa\Ursa.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
5
src/Ursa/Class1.cs
Normal file
5
src/Ursa/Class1.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Ursa;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
14
src/Ursa/Ursa.csproj
Normal file
14
src/Ursa/Ursa.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user