diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..8afdcb6 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,454 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..bcf2da3 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,5 @@ + + + 0.10.999-cibuild0019213-beta + + \ No newline at end of file diff --git a/src/HelloWorld.Android/HelloWorld.Android.csproj b/src/HelloWorld.Android/HelloWorld.Android.csproj new file mode 100644 index 0000000..fa4fc1f --- /dev/null +++ b/src/HelloWorld.Android/HelloWorld.Android.csproj @@ -0,0 +1,41 @@ + + + Exe + net6.0-android + 21 + enable + com.CompanyName.HelloWorld + 1 + 1.0 + apk + true + + + + + Resources\drawable\Icon.png + + + + + True + True + True + + + + False + False + + + + + + + + + + + + diff --git a/src/HelloWorld.Android/Icon.png b/src/HelloWorld.Android/Icon.png new file mode 100644 index 0000000..41a2a61 Binary files /dev/null and b/src/HelloWorld.Android/Icon.png differ diff --git a/src/HelloWorld.Android/MainActivity.cs b/src/HelloWorld.Android/MainActivity.cs new file mode 100644 index 0000000..e7e83f9 --- /dev/null +++ b/src/HelloWorld.Android/MainActivity.cs @@ -0,0 +1,16 @@ +using Android.App; +using Android.Content.PM; +using Avalonia.Android; +using Avalonia; + +namespace HelloWorld.Android +{ + [Activity(Label = "HelloWorld.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] + public class MainActivity : AvaloniaActivity + { + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) + { + return base.CustomizeAppBuilder(builder); + } + } +} diff --git a/src/HelloWorld.Android/Properties/AndroidManifest.xml b/src/HelloWorld.Android/Properties/AndroidManifest.xml new file mode 100644 index 0000000..98c8b16 --- /dev/null +++ b/src/HelloWorld.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/HelloWorld.Android/Resources/drawable/splash_screen.xml b/src/HelloWorld.Android/Resources/drawable/splash_screen.xml new file mode 100644 index 0000000..2e920b4 --- /dev/null +++ b/src/HelloWorld.Android/Resources/drawable/splash_screen.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/src/HelloWorld.Android/Resources/values/colors.xml b/src/HelloWorld.Android/Resources/values/colors.xml new file mode 100644 index 0000000..59279d5 --- /dev/null +++ b/src/HelloWorld.Android/Resources/values/colors.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + diff --git a/src/HelloWorld.Android/Resources/values/styles.xml b/src/HelloWorld.Android/Resources/values/styles.xml new file mode 100644 index 0000000..2759d29 --- /dev/null +++ b/src/HelloWorld.Android/Resources/values/styles.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/HelloWorld.Android/SplashActivity.cs b/src/HelloWorld.Android/SplashActivity.cs new file mode 100644 index 0000000..4f05f31 --- /dev/null +++ b/src/HelloWorld.Android/SplashActivity.cs @@ -0,0 +1,17 @@ +using Android.App; +using Android.Content; +using Application = Android.App.Application; + +namespace HelloWorld.Android +{ + [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] + public class SplashActivity : Activity + { + protected override void OnResume() + { + base.OnResume(); + + StartActivity(new Intent(Application.Context, typeof(MainActivity))); + } + } +} diff --git a/src/HelloWorld.Desktop/HelloWorld.Desktop.csproj b/src/HelloWorld.Desktop/HelloWorld.Desktop.csproj new file mode 100644 index 0000000..b5e8c30 --- /dev/null +++ b/src/HelloWorld.Desktop/HelloWorld.Desktop.csproj @@ -0,0 +1,25 @@ + + + WinExe + net6.0 + enable + + copyused + true + + + + + + + + + + + + + + + diff --git a/src/HelloWorld.Desktop/Program.cs b/src/HelloWorld.Desktop/Program.cs new file mode 100644 index 0000000..9d368ef --- /dev/null +++ b/src/HelloWorld.Desktop/Program.cs @@ -0,0 +1,21 @@ +using System; +using Avalonia; + +namespace HelloWorld.Desktop +{ + 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() + .UsePlatformDetect() + .LogToTrace(); + } +} diff --git a/src/HelloWorld.Web/App.razor b/src/HelloWorld.Web/App.razor new file mode 100644 index 0000000..b941644 --- /dev/null +++ b/src/HelloWorld.Web/App.razor @@ -0,0 +1,10 @@ + + + + + + +

Sorry, there's nothing at this address.

+
+
+
diff --git a/src/HelloWorld.Web/App.razor.cs b/src/HelloWorld.Web/App.razor.cs new file mode 100644 index 0000000..66612ab --- /dev/null +++ b/src/HelloWorld.Web/App.razor.cs @@ -0,0 +1,14 @@ +using Avalonia.Web.Blazor; + +namespace HelloWorld.Web; + +public partial class App +{ + protected override void OnParametersSet() + { + base.OnParametersSet(); + + WebAppBuilder.Configure() + .SetupWithSingleViewLifetime(); + } +} \ No newline at end of file diff --git a/src/HelloWorld.Web/HelloWorld.Web.csproj b/src/HelloWorld.Web/HelloWorld.Web.csproj new file mode 100644 index 0000000..f7b7d7e --- /dev/null +++ b/src/HelloWorld.Web/HelloWorld.Web.csproj @@ -0,0 +1,34 @@ + + + net6.0 + enable + + true + + + + + false + -O1 + false + + + + true + true + -O3 + -O3 + true + + + + + + + + + + + + + diff --git a/src/HelloWorld.Web/Pages/Index.razor b/src/HelloWorld.Web/Pages/Index.razor new file mode 100644 index 0000000..3fccef9 --- /dev/null +++ b/src/HelloWorld.Web/Pages/Index.razor @@ -0,0 +1,3 @@ +@page "/" + + diff --git a/src/HelloWorld.Web/Program.cs b/src/HelloWorld.Web/Program.cs new file mode 100644 index 0000000..6c76774 --- /dev/null +++ b/src/HelloWorld.Web/Program.cs @@ -0,0 +1,29 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using HelloWorld.Web; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using Microsoft.Extensions.DependencyInjection; + +public class Program +{ + public static async Task Main(string[] args) + { + await CreateHostBuilder(args).Build().RunAsync(); + } + + public static WebAssemblyHostBuilder CreateHostBuilder(string[] args) + { + var builder = WebAssemblyHostBuilder.CreateDefault(args); + + builder.RootComponents.Add("#app"); + + builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); + + return builder; + } +} + + + + diff --git a/src/HelloWorld.Web/Properties/launchSettings.json b/src/HelloWorld.Web/Properties/launchSettings.json new file mode 100644 index 0000000..ecf8d00 --- /dev/null +++ b/src/HelloWorld.Web/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:13961", + "sslPort": 44319 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "AvaloniaBlazorSample": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/HelloWorld.Web/Shared/MainLayout.razor b/src/HelloWorld.Web/Shared/MainLayout.razor new file mode 100644 index 0000000..63fb177 --- /dev/null +++ b/src/HelloWorld.Web/Shared/MainLayout.razor @@ -0,0 +1,7 @@ +@inherits LayoutComponentBase + +
+
+ @Body +
+
diff --git a/src/HelloWorld.Web/Shared/MainLayout.razor.css b/src/HelloWorld.Web/Shared/MainLayout.razor.css new file mode 100644 index 0000000..43c355a --- /dev/null +++ b/src/HelloWorld.Web/Shared/MainLayout.razor.css @@ -0,0 +1,70 @@ +.page { + position: relative; + display: flex; + flex-direction: column; +} + +.main { + flex: 1; +} + +.sidebar { + background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); +} + +.top-row { + background-color: #f7f7f7; + border-bottom: 1px solid #d6d5d5; + justify-content: flex-end; + height: 3.5rem; + display: flex; + align-items: center; +} + + .top-row ::deep a, .top-row .btn-link { + white-space: nowrap; + margin-left: 1.5rem; + } + + .top-row a:first-child { + overflow: hidden; + text-overflow: ellipsis; + } + +@media (max-width: 640.98px) { + .top-row:not(.auth) { + display: none; + } + + .top-row.auth { + justify-content: space-between; + } + + .top-row a, .top-row .btn-link { + margin-left: 0; + } +} + +@media (min-width: 641px) { + .page { + flex-direction: row; + } + + .sidebar { + width: 250px; + height: 100vh; + position: sticky; + top: 0; + } + + .top-row { + position: sticky; + top: 0; + z-index: 1; + } + + .main > div { + padding-left: 2rem !important; + padding-right: 1.5rem !important; + } +} diff --git a/src/HelloWorld.Web/_Imports.razor b/src/HelloWorld.Web/_Imports.razor new file mode 100644 index 0000000..581f269 --- /dev/null +++ b/src/HelloWorld.Web/_Imports.razor @@ -0,0 +1,11 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.AspNetCore.Components.WebAssembly.Http +@using Microsoft.JSInterop +@using Avalonia.Web.Blazor +@using HelloWorld.Web +@using HelloWorld.Web.Shared diff --git a/src/HelloWorld.Web/wwwroot/Logo.svg b/src/HelloWorld.Web/wwwroot/Logo.svg new file mode 100644 index 0000000..9685a23 --- /dev/null +++ b/src/HelloWorld.Web/wwwroot/Logo.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/HelloWorld.Web/wwwroot/css/app.css b/src/HelloWorld.Web/wwwroot/css/app.css new file mode 100644 index 0000000..3c2b889 --- /dev/null +++ b/src/HelloWorld.Web/wwwroot/css/app.css @@ -0,0 +1,79 @@ +html, body { + font-family: "Nunito", sans-serif; + margin: 0; + height: 100vh; + overflow: hidden; +} + +a { + text-decoration: none; + color: white; +} + +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; + } + +.canvas-container { + opacity:1; + position:fixed; + width:100%; + height:100%; + top:0px; + left:0px; + z-index:500; +} + +canvas +{ + opacity:1; + position:fixed; + width:100%; + height:100%; + top:0px; + left:0px; + z-index:500; +} + +#app, .page { + height: 100%; + background: #171C2C; + color: white; +} + +.navbar-brand { + font-size: 22px; +} + +.overlay{ + opacity:0.0; + position:fixed; + width:100vw; + height:100vh; + top:0px; + left:0px; + z-index:1000; +} + +#splash { + display: flex; + justify-content: center; + align-items: center; + text-align: center; + min-height: 100vh; +} \ No newline at end of file diff --git a/src/HelloWorld.Web/wwwroot/favicon.ico b/src/HelloWorld.Web/wwwroot/favicon.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/src/HelloWorld.Web/wwwroot/favicon.ico differ diff --git a/src/HelloWorld.Web/wwwroot/index.html b/src/HelloWorld.Web/wwwroot/index.html new file mode 100644 index 0000000..71dc0cf --- /dev/null +++ b/src/HelloWorld.Web/wwwroot/index.html @@ -0,0 +1,32 @@ + + + + + + + Avalonia Sample + + + + + +
+
+

Powered by

+ + Avalonia Logo + Avalonia + +
+
+ +
+ An unhandled error has occurred. + Reload + 🗙 +
+ + + + + diff --git a/src/HelloWorld.Web/wwwroot/js/app.js b/src/HelloWorld.Web/wwwroot/js/app.js new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/src/HelloWorld.Web/wwwroot/js/app.js @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/HelloWorld.sln b/src/HelloWorld.sln new file mode 100644 index 0000000..98e0533 --- /dev/null +++ b/src/HelloWorld.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Desktop", "HelloWorld.Desktop\HelloWorld.Desktop.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Web", "HelloWorld.Web\HelloWorld.Web.csproj", "{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Android", "HelloWorld.Android\HelloWorld.Android.csproj", "{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.Build.0 = Release|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.Build.0 = Release|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Release|Any CPU.Build.0 = Release|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.Build.0 = Release|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/HelloWorld/App.axaml b/src/HelloWorld/App.axaml new file mode 100644 index 0000000..e9e50ba --- /dev/null +++ b/src/HelloWorld/App.axaml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/src/HelloWorld/App.axaml.cs b/src/HelloWorld/App.axaml.cs new file mode 100644 index 0000000..f4737e8 --- /dev/null +++ b/src/HelloWorld/App.axaml.cs @@ -0,0 +1,36 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using HelloWorld.ViewModels; +using HelloWorld.Views; + +namespace HelloWorld +{ + public partial 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 MainViewModel() + }; + } + else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) + { + singleViewPlatform.MainView = new MainView + { + DataContext = new MainViewModel() + }; + } + + base.OnFrameworkInitializationCompleted(); + } + } +} \ No newline at end of file diff --git a/src/HelloWorld/Assets/avalonia-logo.ico b/src/HelloWorld/Assets/avalonia-logo.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/src/HelloWorld/Assets/avalonia-logo.ico differ diff --git a/src/HelloWorld/HelloWorld.csproj b/src/HelloWorld/HelloWorld.csproj new file mode 100644 index 0000000..a74636f --- /dev/null +++ b/src/HelloWorld/HelloWorld.csproj @@ -0,0 +1,17 @@ + + + netstandard2.0 + enable + latest + + + + + + + + + + + + diff --git a/src/HelloWorld/ViewLocator.cs b/src/HelloWorld/ViewLocator.cs new file mode 100644 index 0000000..fe977f9 --- /dev/null +++ b/src/HelloWorld/ViewLocator.cs @@ -0,0 +1,31 @@ +using System; +using Avalonia.Controls; +using Avalonia.Controls.Templates; +using HelloWorld.ViewModels; + +namespace HelloWorld +{ + public class ViewLocator : IDataTemplate + { + public IControl? Build(object? data) + { + if (data is null) + return null; + + 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 = name }; + } + + public bool Match(object? data) + { + return data is ViewModelBase; + } + } +} \ No newline at end of file diff --git a/src/HelloWorld/ViewModels/MainViewModel.cs b/src/HelloWorld/ViewModels/MainViewModel.cs new file mode 100644 index 0000000..1489b7e --- /dev/null +++ b/src/HelloWorld/ViewModels/MainViewModel.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloWorld.ViewModels +{ + public class MainViewModel : ViewModelBase + { + public string Greeting => "Welcome to Avalonia!"; + } +} diff --git a/src/HelloWorld/ViewModels/ViewModelBase.cs b/src/HelloWorld/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..a5a507a --- /dev/null +++ b/src/HelloWorld/ViewModels/ViewModelBase.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ReactiveUI; + +namespace HelloWorld.ViewModels +{ + public class ViewModelBase : ReactiveObject + { + } +} diff --git a/src/HelloWorld/Views/MainView.axaml b/src/HelloWorld/Views/MainView.axaml new file mode 100644 index 0000000..5e6620a --- /dev/null +++ b/src/HelloWorld/Views/MainView.axaml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/src/HelloWorld/Views/MainView.axaml.cs b/src/HelloWorld/Views/MainView.axaml.cs new file mode 100644 index 0000000..e289b92 --- /dev/null +++ b/src/HelloWorld/Views/MainView.axaml.cs @@ -0,0 +1,12 @@ +using Avalonia.Controls; + +namespace HelloWorld.Views +{ + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/HelloWorld/Views/MainWindow.axaml b/src/HelloWorld/Views/MainWindow.axaml new file mode 100644 index 0000000..4d29b5a --- /dev/null +++ b/src/HelloWorld/Views/MainWindow.axaml @@ -0,0 +1,12 @@ + + + diff --git a/src/HelloWorld/Views/MainWindow.axaml.cs b/src/HelloWorld/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..ce69f8d --- /dev/null +++ b/src/HelloWorld/Views/MainWindow.axaml.cs @@ -0,0 +1,12 @@ +using Avalonia.Controls; + +namespace HelloWorld.Views +{ + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/global.json b/src/global.json new file mode 100644 index 0000000..3026526 --- /dev/null +++ b/src/global.json @@ -0,0 +1,12 @@ +{ + "sdk": { + "version": "6.0.200", + "rollForward": "latestFeature" + }, + "msbuild-sdks": { + "Microsoft.Build.Traversal": "1.0.43", + "Xamarin.Legacy.Sdk": "0.1.2-alpha6", + "MSBuild.Sdk.Extras": "3.0.22", + "AggregatePackage.NuGet.Sdk" : "0.1.12" + } +} diff --git a/src/nuget.config b/src/nuget.config new file mode 100644 index 0000000..ad73f0a --- /dev/null +++ b/src/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + +