committed by
GitHub
206 changed files with 6696 additions and 3062 deletions
@ -0,0 +1,148 @@ |
|||
{ |
|||
"$schema": "http://json-schema.org/draft-04/schema#", |
|||
"title": "Build Schema", |
|||
"$ref": "#/definitions/build", |
|||
"definitions": { |
|||
"build": { |
|||
"type": "object", |
|||
"properties": { |
|||
"Configuration": { |
|||
"type": "string", |
|||
"description": "configuration" |
|||
}, |
|||
"Continue": { |
|||
"type": "boolean", |
|||
"description": "Indicates to continue a previously failed build attempt" |
|||
}, |
|||
"ForceNugetVersion": { |
|||
"type": "string", |
|||
"description": "force-nuget-version" |
|||
}, |
|||
"Help": { |
|||
"type": "boolean", |
|||
"description": "Shows the help text for this build assembly" |
|||
}, |
|||
"Host": { |
|||
"type": "string", |
|||
"description": "Host for execution. Default is 'automatic'", |
|||
"enum": [ |
|||
"AppVeyor", |
|||
"AzurePipelines", |
|||
"Bamboo", |
|||
"Bitbucket", |
|||
"Bitrise", |
|||
"GitHubActions", |
|||
"GitLab", |
|||
"Jenkins", |
|||
"Rider", |
|||
"SpaceAutomation", |
|||
"TeamCity", |
|||
"Terminal", |
|||
"TravisCI", |
|||
"VisualStudio", |
|||
"VSCode" |
|||
] |
|||
}, |
|||
"NoLogo": { |
|||
"type": "boolean", |
|||
"description": "Disables displaying the NUKE logo" |
|||
}, |
|||
"Partition": { |
|||
"type": "string", |
|||
"description": "Partition to use on CI" |
|||
}, |
|||
"Plan": { |
|||
"type": "boolean", |
|||
"description": "Shows the execution plan (HTML)" |
|||
}, |
|||
"Profile": { |
|||
"type": "array", |
|||
"description": "Defines the profiles to load", |
|||
"items": { |
|||
"type": "string" |
|||
} |
|||
}, |
|||
"Root": { |
|||
"type": "string", |
|||
"description": "Root directory during build execution" |
|||
}, |
|||
"Skip": { |
|||
"type": "array", |
|||
"description": "List of targets to be skipped. Empty list skips all dependencies", |
|||
"items": { |
|||
"type": "string", |
|||
"enum": [ |
|||
"CiAzureLinux", |
|||
"CiAzureOSX", |
|||
"CiAzureWindows", |
|||
"Clean", |
|||
"Compile", |
|||
"CompileHtmlPreviewer", |
|||
"CompileNative", |
|||
"CreateIntermediateNugetPackages", |
|||
"CreateNugetPackages", |
|||
"GenerateCppHeaders", |
|||
"Package", |
|||
"RunCoreLibsTests", |
|||
"RunDesignerTests", |
|||
"RunHtmlPreviewerTests", |
|||
"RunLeakTests", |
|||
"RunRenderTests", |
|||
"RunTests", |
|||
"ZipFiles" |
|||
] |
|||
} |
|||
}, |
|||
"SkipPreviewer": { |
|||
"type": "boolean", |
|||
"description": "skip-previewer" |
|||
}, |
|||
"SkipTests": { |
|||
"type": "boolean", |
|||
"description": "skip-tests" |
|||
}, |
|||
"Solution": { |
|||
"type": "string", |
|||
"description": "Path to a solution file that is automatically loaded. Default is Avalonia.sln" |
|||
}, |
|||
"Target": { |
|||
"type": "array", |
|||
"description": "List of targets to be invoked. Default is '{default_target}'", |
|||
"items": { |
|||
"type": "string", |
|||
"enum": [ |
|||
"CiAzureLinux", |
|||
"CiAzureOSX", |
|||
"CiAzureWindows", |
|||
"Clean", |
|||
"Compile", |
|||
"CompileHtmlPreviewer", |
|||
"CompileNative", |
|||
"CreateIntermediateNugetPackages", |
|||
"CreateNugetPackages", |
|||
"GenerateCppHeaders", |
|||
"Package", |
|||
"RunCoreLibsTests", |
|||
"RunDesignerTests", |
|||
"RunHtmlPreviewerTests", |
|||
"RunLeakTests", |
|||
"RunRenderTests", |
|||
"RunTests", |
|||
"ZipFiles" |
|||
] |
|||
} |
|||
}, |
|||
"Verbosity": { |
|||
"type": "string", |
|||
"description": "Logging verbosity during build execution. Default is 'Normal'", |
|||
"enum": [ |
|||
"Minimal", |
|||
"Normal", |
|||
"Quiet", |
|||
"Verbose" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
"$schema": "./build.schema.json", |
|||
"Solution": "" |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
:; set -eo pipefail |
|||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) |
|||
:; ${SCRIPT_DIR}/build.sh "$@" |
|||
:; exit $? |
|||
|
|||
@ECHO OFF |
|||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* |
|||
@ -0,0 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<EnableNETAnalyzers>true</EnableNETAnalyzers> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -1,14 +0,0 @@ |
|||
using System.IO; |
|||
using MicroCom.CodeGenerator; |
|||
using Nuke.Common; |
|||
|
|||
partial class Build : NukeBuild |
|||
{ |
|||
Target GenerateCppHeaders => _ => _.Executes(() => |
|||
{ |
|||
var file = MicroComCodeGenerator.Parse( |
|||
File.ReadAllText(RootDirectory / "src" / "Avalonia.Native" / "avn.idl")); |
|||
File.WriteAllText(RootDirectory / "native" / "Avalonia.Native" / "inc" / "avalonia-native.h", |
|||
file.GenerateCppHeader()); |
|||
}); |
|||
} |
|||
@ -1,41 +1,48 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> |
|||
<RootNamespace></RootNamespace> |
|||
<IsPackable>False</IsPackable> |
|||
<NoWarn>CS0649;CS0169</NoWarn> |
|||
<NoWarn>CS0649;CS0169;SYSLIB0011</NoWarn> |
|||
<NukeTelemetryVersion>1</NukeTelemetryVersion> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<Import Project="..\build\JetBrains.dotMemoryUnit.props" /> |
|||
<ItemGroup> |
|||
<PackageReference Include="Nuke.Common" Version="5.0.0" /> |
|||
<PackageReference Include="xunit.runner.console" Version="2.3.1" /> |
|||
<PackageReference Include="Nuke.Common" Version="6.2.1" /> |
|||
<PackageReference Include="vswhere" Version="2.6.7" Condition=" '$(OS)' == 'Windows_NT' " /> |
|||
<PackageReference Include="ILRepack.NETStandard" Version="2.0.4" /> |
|||
<PackageReference Include="MicroCom.CodeGenerator" Version="0.10.4" /> |
|||
<!-- Keep in sync with Avalonia.Build.Tasks --> |
|||
<PackageReference Include="Mono.Cecil" Version="0.11.2" /> |
|||
<PackageReference Include="Mono.Cecil" Version="0.11.4" /> |
|||
<PackageReference Include="SourceLink" Version="1.1.0" GeneratePathProperty="true" /> |
|||
<PackageReference Include="Microsoft.Build.Framework" Version="17.3.1" PrivateAssets="All" /> |
|||
<PackageReference Include="xunit.runner.console" Version="2.4.2"> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
</PackageReference> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" /> |
|||
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" /> |
|||
<None Remove="*.csproj.DotSettings;*.ref.*.txt" /> |
|||
|
|||
<!-- Common build related files --> |
|||
<None Include="..\build.ps1" /> |
|||
<None Include="..\build.sh" /> |
|||
<None Include="..\.nuke" /> |
|||
<None Include="..\global.json" Condition="Exists('..\global.json')" /> |
|||
<None Include="..\nuget.config" Condition="Exists('..\nuget.config')" /> |
|||
<None Include="..\Jenkinsfile" Condition="Exists('..\Jenkinsfile')" /> |
|||
<None Include="..\appveyor.yml" Condition="Exists('..\appveyor.yml')" /> |
|||
<None Include="..\.travis.yml" Condition="Exists('..\.travis.yml')" /> |
|||
<None Include="..\GitVersion.yml" Condition="Exists('..\GitVersion.yml')" /> |
|||
<Compile Remove="Numerge/**/*.*" /> |
|||
<Compile Include="Numerge/Numerge/**/*.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="$(NuGetPackageRoot)sourcelink/1.1.0/tools/pdbstr.exe"></EmbeddedResource> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="il-repack\ILRepack\Application.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Folder Include="Numerge\Numerge.Console\" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
|||
@ -0,0 +1,17 @@ |
|||
using Avalonia; |
|||
using Avalonia.Web.Blazor; |
|||
|
|||
namespace ControlCatalog.Blazor.Web; |
|||
|
|||
public partial class App |
|||
{ |
|||
protected override void OnParametersSet() |
|||
{ |
|||
AppBuilder.Configure<ControlCatalog.App>() |
|||
.UseBlazor() |
|||
// .With(new SkiaOptions { CustomGpuFactory = null }) // uncomment to disable GPU/GL rendering
|
|||
.SetupWithSingleViewLifetime(); |
|||
|
|||
base.OnParametersSet(); |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> |
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier> |
|||
<Nullable>enable</Nullable> |
|||
<EmccTotalMemory>16777216</EmccTotalMemory> |
|||
<BlazorEnableTimeZoneSupport>false</BlazorEnableTimeZoneSupport> |
|||
<BlazorWebAssemblyPreserveCollationData>false</BlazorWebAssemblyPreserveCollationData> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-rc.1.22427.2" /> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-rc.1.22427.2" PrivateAssets="all" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj" /> |
|||
<ProjectReference Include="..\..\src\Web\Avalonia.Web.Blazor\Avalonia.Web.Blazor.csproj" /> |
|||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
|||
<Import Project="..\..\build\BuildTargets.targets" /> |
|||
|
|||
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.props" /> |
|||
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.targets" /> |
|||
|
|||
</Project> |
|||
|
|||
@ -0,0 +1,29 @@ |
|||
using System; |
|||
using System.Net.Http; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using ControlCatalog.Blazor.Web; |
|||
|
|||
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>("#app"); |
|||
|
|||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); |
|||
|
|||
return builder; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
@ -1,20 +0,0 @@ |
|||
using Avalonia; |
|||
using Avalonia.Web.Blazor; |
|||
|
|||
namespace ControlCatalog.Web; |
|||
|
|||
public partial class App |
|||
{ |
|||
protected override void OnParametersSet() |
|||
{ |
|||
WebAppBuilder.Configure<ControlCatalog.App>() |
|||
.AfterSetup(_ => |
|||
{ |
|||
ControlCatalog.Pages.EmbedSample.Implementation = new EmbedSampleWeb(); |
|||
}) |
|||
.With(new SkiaOptions { CustomGpuFactory = null }) // uncomment to disable GPU/GL rendering
|
|||
.SetupWithSingleViewLifetime(); |
|||
|
|||
base.OnParametersSet(); |
|||
} |
|||
} |
|||
@ -1,34 +1,42 @@ |
|||
using System; |
|||
|
|||
using Avalonia; |
|||
using System.Runtime.InteropServices.JavaScript; |
|||
using Avalonia.Platform; |
|||
using Avalonia.Web.Blazor; |
|||
using Avalonia.Web; |
|||
|
|||
using ControlCatalog.Pages; |
|||
|
|||
using Microsoft.JSInterop; |
|||
|
|||
namespace ControlCatalog.Web; |
|||
|
|||
public class EmbedSampleWeb : INativeDemoControl |
|||
{ |
|||
public IPlatformHandle CreateControl(bool isSecond, IPlatformHandle parent, Func<IPlatformHandle> createDefault) |
|||
{ |
|||
var runtime = AvaloniaLocator.Current.GetRequiredService<IJSInProcessRuntime>(); |
|||
|
|||
if (isSecond) |
|||
{ |
|||
var iframe = runtime.Invoke<IJSInProcessObjectReference>("document.createElement", "iframe"); |
|||
iframe.InvokeVoid("setAttribute", "src", "https://www.youtube.com/embed/kZCIporjJ70"); |
|||
var iframe = EmbedInterop.CreateElement("iframe"); |
|||
iframe.SetProperty("src", "https://www.youtube.com/embed/kZCIporjJ70"); |
|||
|
|||
return new JSObjectControlHandle(iframe); |
|||
} |
|||
else |
|||
{ |
|||
// window.createAppButton source is defined in "app.js" file.
|
|||
var button = runtime.Invoke<IJSInProcessObjectReference>("window.createAppButton"); |
|||
var defaultHandle = (JSObjectControlHandle)createDefault(); |
|||
|
|||
_ = JSHost.ImportAsync("embed.js", "./embed.js").ContinueWith(_ => |
|||
{ |
|||
EmbedInterop.AddAppButton(defaultHandle.Object); |
|||
}); |
|||
|
|||
return new JSObjectControlHandle(button); |
|||
return defaultHandle; |
|||
} |
|||
} |
|||
} |
|||
|
|||
internal static partial class EmbedInterop |
|||
{ |
|||
[JSImport("globalThis.document.createElement")] |
|||
public static partial JSObject CreateElement(string tagName); |
|||
|
|||
[JSImport("addAppButton", "embed.js")] |
|||
public static partial void AddAppButton(JSObject parentObject); |
|||
} |
|||
|
|||
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,6 @@ |
|||
<linker> |
|||
<assembly fullname="ControlCatalog" preserve="All" /> |
|||
<assembly fullname="ControlCatalog.Web" preserve="All" /> |
|||
<assembly fullname="Avalonia.Themes.Fluent" preserve="All" /> |
|||
<assembly fullname="Avalonia.Themes.Simple" preserve="All" /> |
|||
</linker> |
|||
@ -0,0 +1,49 @@ |
|||
#out { |
|||
height: 100vh; |
|||
width: 100vw |
|||
} |
|||
|
|||
#avalonia-splash { |
|||
position: relative; |
|||
height: 100%; |
|||
width: 100%; |
|||
color: whitesmoke; |
|||
background: #171C2C; |
|||
font-family: 'Nunito', sans-serif; |
|||
background-position: center; |
|||
background-size: cover; |
|||
background-repeat: no-repeat; |
|||
} |
|||
|
|||
#avalonia-splash a{ |
|||
color: whitesmoke; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
.center { |
|||
display: flex; |
|||
justify-content: center; |
|||
height: 250px; |
|||
} |
|||
|
|||
.splash-close { |
|||
animation: slide 0.5s linear 1s forwards; |
|||
} |
|||
|
|||
@keyframes slide { |
|||
0% { |
|||
top: 0%; |
|||
} |
|||
|
|||
50% { |
|||
opacity: 80%; |
|||
} |
|||
|
|||
100% { |
|||
top: 100%; |
|||
overflow: hidden; |
|||
opacity: 0; |
|||
display: none; |
|||
visibility: collapse; |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
export function addAppButton(parent) { |
|||
var button = globalThis.document.createElement('button'); |
|||
button.innerText = 'Hello world'; |
|||
var clickCount = 0; |
|||
button.onclick = () => { |
|||
clickCount++; |
|||
button.innerText = 'Click count ' + clickCount; |
|||
}; |
|||
parent.appendChild(button); |
|||
return button; |
|||
} |
|||
|
After Width: | Height: | Size: 172 KiB |
@ -0,0 +1,31 @@ |
|||
<!DOCTYPE html> |
|||
<!-- Licensed to the .NET Foundation under one or more agreements. --> |
|||
<!-- The .NET Foundation licenses this file to you under the MIT license. --> |
|||
<html> |
|||
|
|||
<head> |
|||
<title>AvaloniaUI - ControlCatalog</title> |
|||
<meta charset="UTF-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<link rel="modulepreload" href="./main.js" /> |
|||
<link rel="modulepreload" href="./dotnet.js" /> |
|||
<link rel="modulepreload" href="./avalonia.js" /> |
|||
<link rel="stylesheet" href="./app.css" /> |
|||
</head> |
|||
|
|||
<body style="margin: 0px"> |
|||
<div id="out"> |
|||
<div id="avalonia-splash"> |
|||
<div class="center"> |
|||
<h2>Powered by</h2> |
|||
<a class="navbar-brand" href="https://www.avaloniaui.net/" target="_blank"> |
|||
<img src="Logo.svg" alt="Avalonia Logo" width="30" height="24" /> |
|||
Avalonia |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script type='module' src="./main.js"></script> |
|||
</body> |
|||
|
|||
</html> |
|||
@ -0,0 +1,19 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
|
|||
import { dotnet } from './dotnet.js' |
|||
import { registerAvaloniaModule } from './avalonia.js'; |
|||
|
|||
const is_browser = typeof window != "undefined"; |
|||
if (!is_browser) throw new Error(`Expected to be running in a browser`); |
|||
|
|||
const dotnetRuntime = await dotnet |
|||
.withDiagnosticTracing(false) |
|||
.withApplicationArgumentsFromQuery() |
|||
.create(); |
|||
|
|||
await registerAvaloniaModule(dotnetRuntime); |
|||
|
|||
const config = dotnetRuntime.getConfig(); |
|||
|
|||
await dotnetRuntime.runMainAndExit(config.mainAssemblyName, ["dotnet", "is", "great!"]); |
|||
@ -0,0 +1,11 @@ |
|||
{ |
|||
"wasmHostProperties": { |
|||
"perHostConfig": [ |
|||
{ |
|||
"name": "browser", |
|||
"html-path": "index.html", |
|||
"Host": "browser" |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -1,105 +0,0 @@ |
|||
using Android.OS; |
|||
using AndroidX.AppCompat.App; |
|||
using Android.Content.Res; |
|||
using AndroidX.Lifecycle; |
|||
using Avalonia.Controls.ApplicationLifetimes; |
|||
using Avalonia.Controls; |
|||
using Android.Runtime; |
|||
using Android.App; |
|||
using Android.Content; |
|||
using System; |
|||
|
|||
namespace Avalonia.Android |
|||
{ |
|||
public abstract class AvaloniaActivity : AppCompatActivity |
|||
{ |
|||
internal class SingleViewLifetime : ISingleViewApplicationLifetime |
|||
{ |
|||
public AvaloniaView View { get; internal set; } |
|||
|
|||
public Control MainView |
|||
{ |
|||
get => (Control)View.Content; |
|||
set => View.Content = value; |
|||
} |
|||
} |
|||
|
|||
internal Action<int, Result, Intent> ActivityResult; |
|||
internal AvaloniaView View; |
|||
internal AvaloniaViewModel _viewModel; |
|||
|
|||
protected abstract AppBuilder CreateAppBuilder(); |
|||
|
|||
protected override void OnCreate(Bundle savedInstanceState) |
|||
{ |
|||
var builder = CreateAppBuilder(); |
|||
|
|||
|
|||
var lifetime = new SingleViewLifetime(); |
|||
|
|||
builder.AfterSetup(x => |
|||
{ |
|||
_viewModel = new ViewModelProvider(this).Get(Java.Lang.Class.FromType(typeof(AvaloniaViewModel))) as AvaloniaViewModel; |
|||
|
|||
View = new AvaloniaView(this); |
|||
if (_viewModel.Content != null) |
|||
{ |
|||
View.Content = _viewModel.Content; |
|||
} |
|||
|
|||
SetContentView(View); |
|||
lifetime.View = View; |
|||
|
|||
View.Prepare(); |
|||
}); |
|||
|
|||
builder.SetupWithLifetime(lifetime); |
|||
|
|||
base.OnCreate(savedInstanceState); |
|||
} |
|||
public object Content |
|||
{ |
|||
get |
|||
{ |
|||
return _viewModel.Content; |
|||
} |
|||
set |
|||
{ |
|||
_viewModel.Content = value; |
|||
if (View != null) |
|||
View.Content = value; |
|||
} |
|||
} |
|||
|
|||
public override void OnConfigurationChanged(Configuration newConfig) |
|||
{ |
|||
base.OnConfigurationChanged(newConfig); |
|||
} |
|||
|
|||
protected override void OnDestroy() |
|||
{ |
|||
View.Content = null; |
|||
|
|||
base.OnDestroy(); |
|||
} |
|||
|
|||
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) |
|||
{ |
|||
base.OnActivityResult(requestCode, resultCode, data); |
|||
|
|||
ActivityResult?.Invoke(requestCode, resultCode, data); |
|||
} |
|||
} |
|||
|
|||
public abstract class AvaloniaActivity<TApp> : AvaloniaActivity where TApp : Application, new() |
|||
{ |
|||
protected virtual AppBuilder CustomizeAppBuilder(AppBuilder builder) => builder.UseAndroid(); |
|||
|
|||
protected override AppBuilder CreateAppBuilder() |
|||
{ |
|||
var builder = AppBuilder.Configure<TApp>(); |
|||
|
|||
return CustomizeAppBuilder(builder); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,72 @@ |
|||
using System; |
|||
using Android.App; |
|||
using Android.Content; |
|||
using Android.Content.Res; |
|||
using Android.OS; |
|||
using Android.Runtime; |
|||
using AndroidX.AppCompat.App; |
|||
using AndroidX.Lifecycle; |
|||
|
|||
namespace Avalonia.Android |
|||
{ |
|||
public abstract class AvaloniaMainActivity : AppCompatActivity |
|||
{ |
|||
internal static object ViewContent; |
|||
|
|||
internal Action<int, Result, Intent> ActivityResult; |
|||
internal AvaloniaView View; |
|||
|
|||
protected override void OnCreate(Bundle savedInstanceState) |
|||
{ |
|||
View = new AvaloniaView(this); |
|||
if (ViewContent != null) |
|||
{ |
|||
View.Content = ViewContent; |
|||
} |
|||
|
|||
View.Prepare(); |
|||
|
|||
if (Avalonia.Application.Current.ApplicationLifetime is SingleViewLifetime lifetime) |
|||
{ |
|||
lifetime.View = View; |
|||
} |
|||
|
|||
base.OnCreate(savedInstanceState); |
|||
|
|||
SetContentView(View); |
|||
} |
|||
|
|||
public object Content |
|||
{ |
|||
get |
|||
{ |
|||
return ViewContent; |
|||
} |
|||
set |
|||
{ |
|||
ViewContent = value; |
|||
if (View != null) |
|||
View.Content = value; |
|||
} |
|||
} |
|||
|
|||
public override void OnConfigurationChanged(Configuration newConfig) |
|||
{ |
|||
base.OnConfigurationChanged(newConfig); |
|||
} |
|||
|
|||
protected override void OnDestroy() |
|||
{ |
|||
View.Content = null; |
|||
|
|||
base.OnDestroy(); |
|||
} |
|||
|
|||
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) |
|||
{ |
|||
base.OnActivityResult(requestCode, resultCode, data); |
|||
|
|||
ActivityResult?.Invoke(requestCode, resultCode, data); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using Android.OS; |
|||
using AndroidX.AppCompat.App; |
|||
using AndroidX.Lifecycle; |
|||
|
|||
namespace Avalonia.Android |
|||
{ |
|||
public abstract class AvaloniaSplashActivity : AppCompatActivity |
|||
{ |
|||
protected abstract AppBuilder CreateAppBuilder(); |
|||
|
|||
protected override void OnCreate(Bundle? savedInstanceState) |
|||
{ |
|||
base.OnCreate(savedInstanceState); |
|||
|
|||
var builder = CreateAppBuilder(); |
|||
|
|||
var lifetime = new SingleViewLifetime(); |
|||
|
|||
builder.SetupWithLifetime(lifetime); |
|||
} |
|||
} |
|||
|
|||
public abstract class AvaloniaSplashActivity<TApp> : AvaloniaSplashActivity where TApp : Application, new() |
|||
{ |
|||
protected virtual AppBuilder CustomizeAppBuilder(AppBuilder builder) => builder.UseAndroid(); |
|||
|
|||
protected override AppBuilder CreateAppBuilder() |
|||
{ |
|||
var builder = AppBuilder.Configure<TApp>(); |
|||
|
|||
return CustomizeAppBuilder(builder); |
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Avalonia.Android |
|||
{ |
|||
internal class AvaloniaViewModel : AndroidX.Lifecycle.ViewModel |
|||
{ |
|||
public object Content { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.Controls.ApplicationLifetimes; |
|||
|
|||
namespace Avalonia.Android |
|||
{ |
|||
internal class SingleViewLifetime : ISingleViewApplicationLifetime |
|||
{ |
|||
private AvaloniaView _view; |
|||
|
|||
public AvaloniaView View |
|||
{ |
|||
get => _view; internal set |
|||
{ |
|||
if (_view != null) |
|||
{ |
|||
_view.Content = null; |
|||
_view.Dispose(); |
|||
} |
|||
_view = value; |
|||
_view.Content = MainView; |
|||
} |
|||
} |
|||
|
|||
public Control MainView { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,359 @@ |
|||
using Avalonia.Media; |
|||
using Avalonia.Utilities; |
|||
|
|||
namespace Avalonia.Controls |
|||
{ |
|||
/// <summary>
|
|||
/// Implements a reduced version of the 2014 Material Design color palette.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This palette is based on the one outlined here:
|
|||
///
|
|||
/// https://material.io/design/color/the-color-system.html#tools-for-picking-colors
|
|||
///
|
|||
/// In order to make the palette uniform and rectangular the following
|
|||
/// alterations were made:
|
|||
///
|
|||
/// 1. The A100-A700 shades of each color are excluded.
|
|||
/// These shades do not exist for all colors (brown/gray).
|
|||
/// 2. Black/White are stand-alone and are also excluded.
|
|||
///
|
|||
/// </remarks>
|
|||
public class MaterialColorPalette : IColorPalette |
|||
{ |
|||
// See: https://material.io/design/color/the-color-system.html#tools-for-picking-colors
|
|||
// This is a reduced palette for uniformity
|
|||
private static Color[,]? _colorChart = null; |
|||
private static int _colorChartColorCount = 0; |
|||
private static int _colorChartShadeCount = 0; |
|||
private static object _colorChartMutex = new object(); |
|||
|
|||
/// <summary>
|
|||
/// Initializes all color chart colors.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This is pulled out separately to lazy load for performance.
|
|||
/// If no material color palette is ever used, no colors will be created.
|
|||
/// </remarks>
|
|||
private void InitColorChart() |
|||
{ |
|||
lock (_colorChartMutex) |
|||
{ |
|||
_colorChart = new Color[,] |
|||
{ |
|||
// Red
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFF, 0xEB, 0xEE), |
|||
Color.FromArgb(0xFF, 0xFF, 0xCD, 0xD2), |
|||
Color.FromArgb(0xFF, 0xEF, 0x9A, 0x9A), |
|||
Color.FromArgb(0xFF, 0xE5, 0x73, 0x73), |
|||
Color.FromArgb(0xFF, 0xEF, 0x53, 0x50), |
|||
Color.FromArgb(0xFF, 0xF4, 0x43, 0x36), |
|||
Color.FromArgb(0xFF, 0xE5, 0x39, 0x35), |
|||
Color.FromArgb(0xFF, 0xD3, 0x2F, 0x2F), |
|||
Color.FromArgb(0xFF, 0xC6, 0x28, 0x28), |
|||
Color.FromArgb(0xFF, 0xB7, 0x1C, 0x1C), |
|||
}, |
|||
|
|||
// Pink
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFC, 0xE4, 0xEC), |
|||
Color.FromArgb(0xFF, 0xF8, 0xBB, 0xD0), |
|||
Color.FromArgb(0xFF, 0xF4, 0x8F, 0xB1), |
|||
Color.FromArgb(0xFF, 0xF0, 0x62, 0x92), |
|||
Color.FromArgb(0xFF, 0xEC, 0x40, 0x7A), |
|||
Color.FromArgb(0xFF, 0xE9, 0x1E, 0x63), |
|||
Color.FromArgb(0xFF, 0xD8, 0x1B, 0x60), |
|||
Color.FromArgb(0xFF, 0xC2, 0x18, 0x5B), |
|||
Color.FromArgb(0xFF, 0xAD, 0x14, 0x57), |
|||
Color.FromArgb(0xFF, 0x88, 0x0E, 0x4F), |
|||
}, |
|||
|
|||
// Purple
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xF3, 0xE5, 0xF5), |
|||
Color.FromArgb(0xFF, 0xE1, 0xBE, 0xE7), |
|||
Color.FromArgb(0xFF, 0xCE, 0x93, 0xD8), |
|||
Color.FromArgb(0xFF, 0xBA, 0x68, 0xC8), |
|||
Color.FromArgb(0xFF, 0xAB, 0x47, 0xBC), |
|||
Color.FromArgb(0xFF, 0x9C, 0x27, 0xB0), |
|||
Color.FromArgb(0xFF, 0x8E, 0x24, 0xAA), |
|||
Color.FromArgb(0xFF, 0x7B, 0x1F, 0xA2), |
|||
Color.FromArgb(0xFF, 0x6A, 0x1B, 0x9A), |
|||
Color.FromArgb(0xFF, 0x4A, 0x14, 0x8C), |
|||
}, |
|||
|
|||
// Deep Purple
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xED, 0xE7, 0xF6), |
|||
Color.FromArgb(0xFF, 0xD1, 0xC4, 0xE9), |
|||
Color.FromArgb(0xFF, 0xB3, 0x9D, 0xDB), |
|||
Color.FromArgb(0xFF, 0x95, 0x75, 0xCD), |
|||
Color.FromArgb(0xFF, 0x7E, 0x57, 0xC2), |
|||
Color.FromArgb(0xFF, 0x67, 0x3A, 0xB7), |
|||
Color.FromArgb(0xFF, 0x5E, 0x35, 0xB1), |
|||
Color.FromArgb(0xFF, 0x51, 0x2D, 0xA8), |
|||
Color.FromArgb(0xFF, 0x45, 0x27, 0xA0), |
|||
Color.FromArgb(0xFF, 0x31, 0x1B, 0x92), |
|||
}, |
|||
|
|||
// Indigo
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xE8, 0xEA, 0xF6), |
|||
Color.FromArgb(0xFF, 0xC5, 0xCA, 0xE9), |
|||
Color.FromArgb(0xFF, 0x9F, 0xA8, 0xDA), |
|||
Color.FromArgb(0xFF, 0x79, 0x86, 0xCB), |
|||
Color.FromArgb(0xFF, 0x5C, 0x6B, 0xC0), |
|||
Color.FromArgb(0xFF, 0x3F, 0x51, 0xB5), |
|||
Color.FromArgb(0xFF, 0x39, 0x49, 0xAB), |
|||
Color.FromArgb(0xFF, 0x30, 0x3F, 0x9F), |
|||
Color.FromArgb(0xFF, 0x28, 0x35, 0x93), |
|||
Color.FromArgb(0xFF, 0x1A, 0x23, 0x7E), |
|||
}, |
|||
|
|||
// Blue
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xE3, 0xF2, 0xFD), |
|||
Color.FromArgb(0xFF, 0xBB, 0xDE, 0xFB), |
|||
Color.FromArgb(0xFF, 0x90, 0xCA, 0xF9), |
|||
Color.FromArgb(0xFF, 0x64, 0xB5, 0xF6), |
|||
Color.FromArgb(0xFF, 0x42, 0xA5, 0xF5), |
|||
Color.FromArgb(0xFF, 0x21, 0x96, 0xF3), |
|||
Color.FromArgb(0xFF, 0x1E, 0x88, 0xE5), |
|||
Color.FromArgb(0xFF, 0x19, 0x76, 0xD2), |
|||
Color.FromArgb(0xFF, 0x15, 0x65, 0xC0), |
|||
Color.FromArgb(0xFF, 0x0D, 0x47, 0xA1), |
|||
}, |
|||
|
|||
// Light Blue
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xE1, 0xF5, 0xFE), |
|||
Color.FromArgb(0xFF, 0xB3, 0xE5, 0xFC), |
|||
Color.FromArgb(0xFF, 0x81, 0xD4, 0xFA), |
|||
Color.FromArgb(0xFF, 0x4F, 0xC3, 0xF7), |
|||
Color.FromArgb(0xFF, 0x29, 0xB6, 0xF6), |
|||
Color.FromArgb(0xFF, 0x03, 0xA9, 0xF4), |
|||
Color.FromArgb(0xFF, 0x03, 0x9B, 0xE5), |
|||
Color.FromArgb(0xFF, 0x02, 0x88, 0xD1), |
|||
Color.FromArgb(0xFF, 0x02, 0x77, 0xBD), |
|||
Color.FromArgb(0xFF, 0x01, 0x57, 0x9B), |
|||
}, |
|||
|
|||
// Cyan
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xE0, 0xF7, 0xFA), |
|||
Color.FromArgb(0xFF, 0xB2, 0xEB, 0xF2), |
|||
Color.FromArgb(0xFF, 0x80, 0xDE, 0xEA), |
|||
Color.FromArgb(0xFF, 0x4D, 0xD0, 0xE1), |
|||
Color.FromArgb(0xFF, 0x26, 0xC6, 0xDA), |
|||
Color.FromArgb(0xFF, 0x00, 0xBC, 0xD4), |
|||
Color.FromArgb(0xFF, 0x00, 0xAC, 0xC1), |
|||
Color.FromArgb(0xFF, 0x00, 0x97, 0xA7), |
|||
Color.FromArgb(0xFF, 0x00, 0x83, 0x8F), |
|||
Color.FromArgb(0xFF, 0x00, 0x60, 0x64), |
|||
}, |
|||
|
|||
// Teal
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xE0, 0xF2, 0xF1), |
|||
Color.FromArgb(0xFF, 0xB2, 0xDF, 0xDB), |
|||
Color.FromArgb(0xFF, 0x80, 0xCB, 0xC4), |
|||
Color.FromArgb(0xFF, 0x4D, 0xB6, 0xAC), |
|||
Color.FromArgb(0xFF, 0x26, 0xA6, 0x9A), |
|||
Color.FromArgb(0xFF, 0x00, 0x96, 0x88), |
|||
Color.FromArgb(0xFF, 0x00, 0x89, 0x7B), |
|||
Color.FromArgb(0xFF, 0x00, 0x79, 0x6B), |
|||
Color.FromArgb(0xFF, 0x00, 0x69, 0x5C), |
|||
Color.FromArgb(0xFF, 0x00, 0x4D, 0x40), |
|||
}, |
|||
|
|||
// Green
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xE8, 0xF5, 0xE9), |
|||
Color.FromArgb(0xFF, 0xC8, 0xE6, 0xC9), |
|||
Color.FromArgb(0xFF, 0xA5, 0xD6, 0xA7), |
|||
Color.FromArgb(0xFF, 0x81, 0xC7, 0x84), |
|||
Color.FromArgb(0xFF, 0x66, 0xBB, 0x6A), |
|||
Color.FromArgb(0xFF, 0x4C, 0xAF, 0x50), |
|||
Color.FromArgb(0xFF, 0x43, 0xA0, 0x47), |
|||
Color.FromArgb(0xFF, 0x38, 0x8E, 0x3C), |
|||
Color.FromArgb(0xFF, 0x2E, 0x7D, 0x32), |
|||
Color.FromArgb(0xFF, 0x1B, 0x5E, 0x20), |
|||
}, |
|||
|
|||
// Light Green
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xF1, 0xF8, 0xE9), |
|||
Color.FromArgb(0xFF, 0xDC, 0xED, 0xC8), |
|||
Color.FromArgb(0xFF, 0xC5, 0xE1, 0xA5), |
|||
Color.FromArgb(0xFF, 0xAE, 0xD5, 0x81), |
|||
Color.FromArgb(0xFF, 0x9C, 0xCC, 0x65), |
|||
Color.FromArgb(0xFF, 0x8B, 0xC3, 0x4A), |
|||
Color.FromArgb(0xFF, 0x7C, 0xB3, 0x42), |
|||
Color.FromArgb(0xFF, 0x68, 0x9F, 0x38), |
|||
Color.FromArgb(0xFF, 0x55, 0x8B, 0x2F), |
|||
Color.FromArgb(0xFF, 0x33, 0x69, 0x1E), |
|||
}, |
|||
|
|||
// Lime
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xF9, 0xFB, 0xE7), |
|||
Color.FromArgb(0xFF, 0xF0, 0xF4, 0xC3), |
|||
Color.FromArgb(0xFF, 0xE6, 0xEE, 0x9C), |
|||
Color.FromArgb(0xFF, 0xDC, 0xE7, 0x75), |
|||
Color.FromArgb(0xFF, 0xD4, 0xE1, 0x57), |
|||
Color.FromArgb(0xFF, 0xCD, 0xDC, 0x39), |
|||
Color.FromArgb(0xFF, 0xC0, 0xCA, 0x33), |
|||
Color.FromArgb(0xFF, 0xAF, 0xB4, 0x2B), |
|||
Color.FromArgb(0xFF, 0x9E, 0x9D, 0x24), |
|||
Color.FromArgb(0xFF, 0x82, 0x77, 0x17), |
|||
}, |
|||
|
|||
// Yellow
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFF, 0xFD, 0xE7), |
|||
Color.FromArgb(0xFF, 0xFF, 0xF9, 0xC4), |
|||
Color.FromArgb(0xFF, 0xFF, 0xF5, 0x9D), |
|||
Color.FromArgb(0xFF, 0xFF, 0xF1, 0x76), |
|||
Color.FromArgb(0xFF, 0xFF, 0xEE, 0x58), |
|||
Color.FromArgb(0xFF, 0xFF, 0xEB, 0x3B), |
|||
Color.FromArgb(0xFF, 0xFD, 0xD8, 0x35), |
|||
Color.FromArgb(0xFF, 0xFB, 0xC0, 0x2D), |
|||
Color.FromArgb(0xFF, 0xF9, 0xA8, 0x25), |
|||
Color.FromArgb(0xFF, 0xF5, 0x7F, 0x17), |
|||
}, |
|||
|
|||
// Amber
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFF, 0xF8, 0xE1), |
|||
Color.FromArgb(0xFF, 0xFF, 0xEC, 0xB3), |
|||
Color.FromArgb(0xFF, 0xFF, 0xE0, 0x82), |
|||
Color.FromArgb(0xFF, 0xFF, 0xD5, 0x4F), |
|||
Color.FromArgb(0xFF, 0xFF, 0xCA, 0x28), |
|||
Color.FromArgb(0xFF, 0xFF, 0xC1, 0x07), |
|||
Color.FromArgb(0xFF, 0xFF, 0xB3, 0x00), |
|||
Color.FromArgb(0xFF, 0xFF, 0xA0, 0x00), |
|||
Color.FromArgb(0xFF, 0xFF, 0x8F, 0x00), |
|||
Color.FromArgb(0xFF, 0xFF, 0x6F, 0x00), |
|||
}, |
|||
|
|||
// Orange
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFF, 0xF3, 0xE0), |
|||
Color.FromArgb(0xFF, 0xFF, 0xE0, 0xB2), |
|||
Color.FromArgb(0xFF, 0xFF, 0xCC, 0x80), |
|||
Color.FromArgb(0xFF, 0xFF, 0xB7, 0x4D), |
|||
Color.FromArgb(0xFF, 0xFF, 0xA7, 0x26), |
|||
Color.FromArgb(0xFF, 0xFF, 0x98, 0x00), |
|||
Color.FromArgb(0xFF, 0xFB, 0x8C, 0x00), |
|||
Color.FromArgb(0xFF, 0xF5, 0x7C, 0x00), |
|||
Color.FromArgb(0xFF, 0xEF, 0x6C, 0x00), |
|||
Color.FromArgb(0xFF, 0xE6, 0x51, 0x00), |
|||
}, |
|||
|
|||
// Deep Orange
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFB, 0xE9, 0xE7), |
|||
Color.FromArgb(0xFF, 0xFF, 0xCC, 0xBC), |
|||
Color.FromArgb(0xFF, 0xFF, 0xAB, 0x91), |
|||
Color.FromArgb(0xFF, 0xFF, 0x8A, 0x65), |
|||
Color.FromArgb(0xFF, 0xFF, 0x70, 0x43), |
|||
Color.FromArgb(0xFF, 0xFF, 0x57, 0x22), |
|||
Color.FromArgb(0xFF, 0xF4, 0x51, 0x1E), |
|||
Color.FromArgb(0xFF, 0xE6, 0x4A, 0x19), |
|||
Color.FromArgb(0xFF, 0xD8, 0x43, 0x15), |
|||
Color.FromArgb(0xFF, 0xBF, 0x36, 0x0C), |
|||
}, |
|||
|
|||
// Brown
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xEF, 0xEB, 0xE9), |
|||
Color.FromArgb(0xFF, 0xD7, 0xCC, 0xC8), |
|||
Color.FromArgb(0xFF, 0xBC, 0xAA, 0xA4), |
|||
Color.FromArgb(0xFF, 0xA1, 0x88, 0x7F), |
|||
Color.FromArgb(0xFF, 0x8D, 0x6E, 0x63), |
|||
Color.FromArgb(0xFF, 0x79, 0x55, 0x48), |
|||
Color.FromArgb(0xFF, 0x6D, 0x4C, 0x41), |
|||
Color.FromArgb(0xFF, 0x5D, 0x40, 0x37), |
|||
Color.FromArgb(0xFF, 0x4E, 0x34, 0x2E), |
|||
Color.FromArgb(0xFF, 0x3E, 0x27, 0x23), |
|||
}, |
|||
|
|||
// Gray
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xFA, 0xFA, 0xFA), |
|||
Color.FromArgb(0xFF, 0xF5, 0xF5, 0xF5), |
|||
Color.FromArgb(0xFF, 0xEE, 0xEE, 0xEE), |
|||
Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0), |
|||
Color.FromArgb(0xFF, 0xBD, 0xBD, 0xBD), |
|||
Color.FromArgb(0xFF, 0x9E, 0x9E, 0x9E), |
|||
Color.FromArgb(0xFF, 0x75, 0x75, 0x75), |
|||
Color.FromArgb(0xFF, 0x61, 0x61, 0x61), |
|||
Color.FromArgb(0xFF, 0x42, 0x42, 0x42), |
|||
Color.FromArgb(0xFF, 0x21, 0x21, 0x21), |
|||
}, |
|||
|
|||
// Blue Gray
|
|||
{ |
|||
Color.FromArgb(0xFF, 0xEC, 0xEF, 0xF1), |
|||
Color.FromArgb(0xFF, 0xCF, 0xD8, 0xDC), |
|||
Color.FromArgb(0xFF, 0xB0, 0xBE, 0xC5), |
|||
Color.FromArgb(0xFF, 0x90, 0xA4, 0xAE), |
|||
Color.FromArgb(0xFF, 0x78, 0x90, 0x9C), |
|||
Color.FromArgb(0xFF, 0x60, 0x7D, 0x8B), |
|||
Color.FromArgb(0xFF, 0x54, 0x6E, 0x7A), |
|||
Color.FromArgb(0xFF, 0x45, 0x5A, 0x64), |
|||
Color.FromArgb(0xFF, 0x37, 0x47, 0x4F), |
|||
Color.FromArgb(0xFF, 0x26, 0x32, 0x38), |
|||
}, |
|||
}; |
|||
|
|||
_colorChartColorCount = _colorChart.GetLength(0); |
|||
_colorChartShadeCount = _colorChart.GetLength(1); |
|||
} |
|||
|
|||
return; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public int ColorCount |
|||
{ |
|||
get |
|||
{ |
|||
if (_colorChart == null) |
|||
{ |
|||
InitColorChart(); |
|||
} |
|||
|
|||
return _colorChartColorCount; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public int ShadeCount |
|||
{ |
|||
get |
|||
{ |
|||
if (_colorChart == null) |
|||
{ |
|||
InitColorChart(); |
|||
} |
|||
|
|||
return _colorChartShadeCount; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public Color GetColor(int colorIndex, int shadeIndex) |
|||
{ |
|||
if (_colorChart == null) |
|||
{ |
|||
InitColorChart(); |
|||
} |
|||
|
|||
return _colorChart![ |
|||
MathUtilities.Clamp(colorIndex, 0, _colorChartColorCount - 1), |
|||
MathUtilities.Clamp(shadeIndex, 0, _colorChartShadeCount - 1)]; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using Avalonia.Interactivity; |
|||
|
|||
namespace Avalonia.Controls |
|||
{ |
|||
/// <summary>
|
|||
/// Provides data specific to a TextChanged event.
|
|||
/// </summary>
|
|||
public class TextChangedEventArgs : RoutedEventArgs |
|||
{ |
|||
public TextChangedEventArgs(RoutedEvent? routedEvent) |
|||
: base (routedEvent) |
|||
{ |
|||
} |
|||
|
|||
public TextChangedEventArgs(RoutedEvent? routedEvent, IInteractive? source) |
|||
: base(routedEvent, source) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using Avalonia.Interactivity; |
|||
|
|||
namespace Avalonia.Controls |
|||
{ |
|||
/// <summary>
|
|||
/// Provides data specific to a TextChanging event.
|
|||
/// </summary>
|
|||
public class TextChangingEventArgs : RoutedEventArgs |
|||
{ |
|||
public TextChangingEventArgs(RoutedEvent? routedEvent) |
|||
: base (routedEvent) |
|||
{ |
|||
} |
|||
|
|||
public TextChangingEventArgs(RoutedEvent? routedEvent, IInteractive? source) |
|||
: base(routedEvent, source) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue