515 changed files with 18431 additions and 11120 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,19 +0,0 @@ |
|||
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; |
|||
} |
|||
} |
|||
@ -1,10 +1,11 @@ |
|||
window.createAppButton = function () { |
|||
var button = document.createElement('button'); |
|||
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" |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
<UserControl x:Class="ControlCatalog.Pages.AdornerLayerPage" |
|||
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" |
|||
d:DesignHeight="800" |
|||
d:DesignWidth="400" |
|||
mc:Ignorable="d"> |
|||
|
|||
<DockPanel> |
|||
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto" Margin="16" DockPanel.Dock="Top"> |
|||
<TextBlock Grid.Column="0" Grid.Row="0">Rotation</TextBlock> |
|||
<Slider Name="rotation" Maximum="360" Grid.Column="1" Grid.Row="0"/> |
|||
</Grid> |
|||
|
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top"> |
|||
<Button Name="AddAdorner" |
|||
Click="AddAdorner_OnClick" |
|||
Content="Add Adorner" |
|||
Margin="6" /> |
|||
<Button Name="RemoveAdorner" |
|||
Click="RemoveAdorner_OnClick" |
|||
Content="Remove Adorner" |
|||
Margin="6" /> |
|||
</StackPanel> |
|||
|
|||
<Grid ColumnDefinitions="24,Auto,24" |
|||
RowDefinitions="24,Auto,24" |
|||
HorizontalAlignment="Center" |
|||
VerticalAlignment="Center"> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="1" Grid.Row="0"/> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="0" Grid.Row="1"/> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="2" Grid.Row="1"/> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="1" Grid.Row="2"/> |
|||
|
|||
<LayoutTransformControl Name="layoutTransform" Grid.Column="1" Grid.Row="1"> |
|||
<LayoutTransformControl.LayoutTransform> |
|||
<RotateTransform Angle="{Binding #rotation.Value}"/> |
|||
</LayoutTransformControl.LayoutTransform> |
|||
|
|||
<Button Name="AdornerButton" |
|||
Content="Adorned Button" |
|||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" |
|||
VerticalContentAlignment="Center" VerticalAlignment="Stretch" |
|||
Width="200" Height="42"> |
|||
<AdornerLayer.Adorner> |
|||
<Canvas x:Name="AdornerCanvas" |
|||
HorizontalAlignment="Stretch" |
|||
VerticalAlignment="Stretch" |
|||
Background="Cyan" |
|||
IsHitTestVisible="False" |
|||
Opacity="0.3" |
|||
IsVisible="True"> |
|||
<Line StartPoint="-10000,0" EndPoint="10000,0" Stroke="Cyan" StrokeThickness="1" /> |
|||
<Line StartPoint="-10000,42" EndPoint="10000,42" Stroke="Cyan" StrokeThickness="1" /> |
|||
<Line StartPoint="0,-10000" EndPoint="0,10000" Stroke="Cyan" StrokeThickness="1" /> |
|||
<Line StartPoint="200,-10000" EndPoint="200,10000" Stroke="Cyan" StrokeThickness="1" /> |
|||
</Canvas> |
|||
</AdornerLayer.Adorner> |
|||
</Button> |
|||
|
|||
</LayoutTransformControl> |
|||
</Grid> |
|||
</DockPanel> |
|||
|
|||
</UserControl> |
|||
@ -0,0 +1,48 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.Controls.Primitives; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class AdornerLayerPage : UserControl |
|||
{ |
|||
private Control? _adorner; |
|||
|
|||
public AdornerLayerPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
|
|||
private void RemoveAdorner_OnClick(object? sender, RoutedEventArgs e) |
|||
{ |
|||
var adornerButton = this.FindControl<Button>("AdornerButton"); |
|||
if (adornerButton is { }) |
|||
{ |
|||
var adorner = AdornerLayer.GetAdorner(adornerButton); |
|||
if (adorner is { }) |
|||
{ |
|||
_adorner = adorner; |
|||
} |
|||
AdornerLayer.SetAdorner(adornerButton, null); |
|||
} |
|||
} |
|||
|
|||
private void AddAdorner_OnClick(object? sender, RoutedEventArgs e) |
|||
{ |
|||
var adornerButton = this.FindControl<Button>("AdornerButton"); |
|||
if (adornerButton is { }) |
|||
{ |
|||
if (_adorner is { }) |
|||
{ |
|||
AdornerLayer.SetAdorner(adornerButton, _adorner); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
using Avalonia.Controls; |
|||
|
|||
namespace IntegrationTestApp |
|||
{ |
|||
public static class MacOSIntegration |
|||
{ |
|||
[DllImport("/usr/lib/libobjc.dylib", EntryPoint = "sel_registerName")] |
|||
private static extern IntPtr GetHandle(string name); |
|||
|
|||
[DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")] |
|||
private static extern long Int64_objc_msgSend(IntPtr receiver, IntPtr selector); |
|||
|
|||
private static readonly IntPtr s_orderedIndexSelector; |
|||
|
|||
static MacOSIntegration() |
|||
{ |
|||
s_orderedIndexSelector = GetHandle("orderedIndex");; |
|||
} |
|||
|
|||
public static long GetOrderedIndex(Window window) |
|||
{ |
|||
return Int64_objc_msgSend(window.PlatformImpl!.Handle.Handle, s_orderedIndexSelector); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Android.App; |
|||
using Android.Content.PM; |
|||
using Avalonia; |
|||
using Avalonia.Android; |
|||
|
|||
namespace MobileSandbox.Android |
|||
{ |
|||
[Activity(Label = "MobileSandbox.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] |
|||
public class MainActivity : AvaloniaMainActivity |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0-android</TargetFramework> |
|||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion> |
|||
<OutputType>Exe</OutputType> |
|||
<Nullable>enable</Nullable> |
|||
<ApplicationId>com.Avalonia.MobileSandbox</ApplicationId> |
|||
<ApplicationVersion>1</ApplicationVersion> |
|||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> |
|||
<AndroidPackageFormat>apk</AndroidPackageFormat> |
|||
<MSBuildEnableWorkloadResolver>true</MSBuildEnableWorkloadResolver> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<AndroidResource Include="..\..\build\Assets\Icon.png"> |
|||
<Link>Resources\drawable\Icon.png</Link> |
|||
</AndroidResource> |
|||
</ItemGroup> |
|||
|
|||
<PropertyGroup Condition="'$(RunAOTCompilation)'=='' and '$(Configuration)'=='Release' and '$(TF_BUILD)'==''"> |
|||
<RunAOTCompilation>True</RunAOTCompilation> |
|||
</PropertyGroup> |
|||
|
|||
<!-- PropertyGroup Condition="'$(RunAOTCompilation)'=='True'"> |
|||
<EnableLLVM>True</EnableLLVM> |
|||
<AndroidAotAdditionalArguments>no-write-symbols,nodebug</AndroidAotAdditionalArguments> |
|||
<AndroidAotMode>Hybrid</AndroidAotMode> |
|||
<AndroidGenerateJniMarshalMethods>True</AndroidGenerateJniMarshalMethods> |
|||
</PropertyGroup --> |
|||
|
|||
<PropertyGroup Condition="'$(AndroidEnableProfiler)'=='True'"> |
|||
<IsEmulator Condition="'$(IsEmulator)' == ''">True</IsEmulator> |
|||
<DebugSymbols>True</DebugSymbols> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<AndroidEnvironment Condition="'$(IsEmulator)'=='True'" Include="environment.emulator.txt" /> |
|||
<AndroidEnvironment Condition="'$(IsEmulator)'!='True'" Include="environment.device.txt" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Android\Avalonia.Android\Avalonia.Android.csproj" /> |
|||
<ProjectReference Include="..\MobileSandbox\MobileSandbox.csproj" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto"> |
|||
<application android:label="MobileSandbox.Android" android:icon="@drawable/Icon"></application> |
|||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
|||
</manifest> |
|||
@ -0,0 +1,44 @@ |
|||
Images, layout descriptions, binary blobs and string dictionaries can be included |
|||
in your application as resource files. Various Android APIs are designed to |
|||
operate on the resource IDs instead of dealing with images, strings or binary blobs |
|||
directly. |
|||
|
|||
For example, a sample Android app that contains a user interface layout (main.axml), |
|||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) |
|||
would keep its resources in the "Resources" directory of the application: |
|||
|
|||
Resources/ |
|||
drawable/ |
|||
icon.png |
|||
|
|||
layout/ |
|||
main.axml |
|||
|
|||
values/ |
|||
strings.xml |
|||
|
|||
In order to get the build system to recognize Android resources, set the build action to |
|||
"AndroidResource". The native Android APIs do not operate directly with filenames, but |
|||
instead operate on resource IDs. When you compile an Android application that uses resources, |
|||
the build system will package the resources for distribution and generate a class called "R" |
|||
(this is an Android convention) that contains the tokens for each one of the resources |
|||
included. For example, for the above Resources layout, this is what the R class would expose: |
|||
|
|||
public class R { |
|||
public class drawable { |
|||
public const int icon = 0x123; |
|||
} |
|||
|
|||
public class layout { |
|||
public const int main = 0x456; |
|||
} |
|||
|
|||
public class strings { |
|||
public const int first_string = 0xabc; |
|||
public const int second_string = 0xbcd; |
|||
} |
|||
} |
|||
|
|||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main |
|||
to reference the layout/main.axml file, or R.strings.first_string to reference the first |
|||
string in the dictionary file values/strings.xml. |
|||
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
|
|||
<item> |
|||
<color android:color="@color/splash_background"/> |
|||
</item> |
|||
|
|||
<item android:drawable="@drawable/icon" |
|||
android:width="120dp" |
|||
android:height="120dp" |
|||
android:gravity="center" /> |
|||
|
|||
</layer-list> |
|||
@ -0,0 +1,4 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<resources> |
|||
<color name="splash_background">#FFFFFF</color> |
|||
</resources> |
|||
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<resources> |
|||
|
|||
<style name="MyTheme"> |
|||
</style> |
|||
|
|||
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar"> |
|||
<item name="android:windowActionBar">false</item> |
|||
<item name="android:windowNoTitle">true</item> |
|||
</style> |
|||
|
|||
<style name="MyTheme.Splash" parent ="MyTheme.NoActionBar"> |
|||
<item name="android:windowBackground">@drawable/splash_screen</item> |
|||
<item name="android:windowContentOverlay">@null</item> |
|||
</style> |
|||
|
|||
</resources> |
|||
@ -0,0 +1,17 @@ |
|||
using Android.App; |
|||
using Android.Content; |
|||
using Avalonia.Android; |
|||
|
|||
namespace MobileSandbox.Android |
|||
{ |
|||
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] |
|||
public class SplashActivity : AvaloniaSplashActivity<App> |
|||
{ |
|||
protected override void OnResume() |
|||
{ |
|||
base.OnResume(); |
|||
|
|||
StartActivity(new Intent(Application.Context, typeof(MainActivity))); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
DOTNET_DiagnosticPorts=127.0.0.1:9000,suspend |
|||
@ -0,0 +1 @@ |
|||
DOTNET_DiagnosticPorts=10.0.2.2:9001,suspend |
|||
@ -0,0 +1,47 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>WinExe</OutputType> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> |
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|||
</PropertyGroup> |
|||
|
|||
<PropertyGroup Condition="'$(RunNativeAotCompilation)' == 'true'"> |
|||
<IlcTrimMetadata>true</IlcTrimMetadata> |
|||
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json</RestoreAdditionalProjectSources> |
|||
<NativeAotCompilerVersion>7.0.0-*</NativeAotCompilerVersion> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Include="..\..\src\Avalonia.X11\NativeDialogs\Gtk.cs" Link="NativeControls\Gtk\Gtk.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Headless.Vnc\Avalonia.Headless.Vnc.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Dialogs\Avalonia.Dialogs.csproj" /> |
|||
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
|||
<ProjectReference Include="..\MobileSandbox\MobileSandbox.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" /> |
|||
<PackageReference Include="Avalonia.Angle.Windows.Natives" Version="2.1.0.2020091801" /> |
|||
<!-- For native controls test --> |
|||
<PackageReference Include="MonoMac.NetStandard" Version="0.0.4" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup Condition="'$(RunNativeAotCompilation)' == 'true'"> |
|||
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" /> |
|||
<!-- Cross-compilation for Windows x64-arm64 and Linux x64-arm64 --> |
|||
<PackageReference Condition="'$(RuntimeIdentifier)'=='win-arm64'" Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" /> |
|||
<PackageReference Condition="'$(RuntimeIdentifier)'=='linux-arm64'" Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<PropertyGroup> |
|||
<!-- For Microsoft.CodeAnalysis --> |
|||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> |
|||
<ApplicationManifest>app.manifest</ApplicationManifest> |
|||
</PropertyGroup> |
|||
|
|||
<Import Project="..\..\build\SampleApp.props" /> |
|||
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
|||
</Project> |
|||
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using Avalonia; |
|||
|
|||
namespace MobileSandbox.Desktop |
|||
{ |
|||
static class Program |
|||
{ |
|||
[STAThread] |
|||
static int Main(string[] args) => |
|||
BuildAvaloniaApp() |
|||
.StartWithClassicDesktopLifetime(args); |
|||
|
|||
/// <summary>
|
|||
/// This method is needed for IDE previewer infrastructure
|
|||
/// </summary>
|
|||
public static AppBuilder BuildAvaloniaApp() |
|||
=> AppBuilder.Configure<App>() |
|||
.UsePlatformDetect() |
|||
.LogToTrace(); |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> |
|||
<assemblyIdentity version="1.0.0.0" name="ControlCatalog.app"/> |
|||
|
|||
<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 Vista --> |
|||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> |
|||
|
|||
<!-- Windows 7 --> |
|||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> |
|||
|
|||
<!-- Windows 8 --> |
|||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />--> |
|||
|
|||
<!-- Windows 8.1 --> |
|||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />--> |
|||
|
|||
<!-- Windows 10 --> |
|||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> |
|||
|
|||
</application> |
|||
</compatibility> |
|||
</assembly> |
|||
@ -0,0 +1,22 @@ |
|||
using Foundation; |
|||
using UIKit; |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.iOS; |
|||
using Avalonia.Logging; |
|||
using Avalonia.Media; |
|||
|
|||
namespace MobileSandbox |
|||
{ |
|||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
|||
// User Interface of the application, as well as listening (and optionally responding) to
|
|||
// application events from iOS.
|
|||
[Register("AppDelegate")] |
|||
public partial class AppDelegate : AvaloniaAppDelegate<App> |
|||
{ |
|||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) |
|||
{ |
|||
return builder.LogToTrace(LogEventLevel.Debug, "IOSIME"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict/> |
|||
</plist> |
|||
@ -0,0 +1,47 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>CFBundleDisplayName</key> |
|||
<string>ControlCatalog.iOS</string> |
|||
<key>CFBundleIdentifier</key> |
|||
<string>Avalonia.ControlCatalog</string> |
|||
<key>CFBundleShortVersionString</key> |
|||
<string>1.0</string> |
|||
<key>CFBundleVersion</key> |
|||
<string>1.0</string> |
|||
<key>LSRequiresIPhoneOS</key> |
|||
<true/> |
|||
<key>MinimumOSVersion</key> |
|||
<string>13.0</string> |
|||
<key>UIDeviceFamily</key> |
|||
<array> |
|||
<integer>1</integer> |
|||
<integer>2</integer> |
|||
</array> |
|||
<key>UILaunchStoryboardName</key> |
|||
<string>LaunchScreen</string> |
|||
<key>UIRequiredDeviceCapabilities</key> |
|||
<array> |
|||
<string>armv7</string> |
|||
</array> |
|||
<key>UISupportedInterfaceOrientations</key> |
|||
<array> |
|||
<string>UIInterfaceOrientationPortrait</string> |
|||
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
|||
<string>UIInterfaceOrientationLandscapeLeft</string> |
|||
<string>UIInterfaceOrientationLandscapeRight</string> |
|||
</array> |
|||
<key>UISupportedInterfaceOrientations~ipad</key> |
|||
<array> |
|||
<string>UIInterfaceOrientationPortrait</string> |
|||
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
|||
<string>UIInterfaceOrientationLandscapeLeft</string> |
|||
<string>UIInterfaceOrientationLandscapeRight</string> |
|||
</array> |
|||
<key>UIStatusBarHidden</key> |
|||
<true/> |
|||
<key>UIViewControllerBasedStatusBarAppearance</key> |
|||
<false/> |
|||
</dict> |
|||
</plist> |
|||
@ -0,0 +1,15 @@ |
|||
using UIKit; |
|||
|
|||
namespace MobileSandbox.iOS |
|||
{ |
|||
public class Application |
|||
{ |
|||
// This is the main entry point of the application.
|
|||
static void Main(string[] args) |
|||
{ |
|||
// if you want to use a different Application Delegate class from "AppDelegate"
|
|||
// you can specify it here.
|
|||
UIApplication.Main(args, null, typeof(AppDelegate)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<ProvisioningType>manual</ProvisioningType> |
|||
<TargetFramework>net6.0-ios</TargetFramework> |
|||
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion> |
|||
<!-- temporal workaround for our GL interface backend --> |
|||
<UseInterpreter>True</UseInterpreter> |
|||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> |
|||
<!-- <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>--> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\iOS\Avalonia.iOS\Avalonia.iOS.csproj" /> |
|||
<ProjectReference Include="..\MobileSandbox\MobileSandbox.csproj" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,43 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES"> |
|||
<dependencies> |
|||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207" /> |
|||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1" /> |
|||
</dependencies> |
|||
<objects> |
|||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" /> |
|||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" /> |
|||
<view contentMode="scaleToFill" id="iN0-l3-epB"> |
|||
<rect key="frame" x="0.0" y="0.0" width="480" height="480" /> |
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" /> |
|||
<subviews> |
|||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2022 " textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" |
|||
minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye"> |
|||
<rect key="frame" x="20" y="439" width="441" height="21" /> |
|||
<fontDescription key="fontDescription" type="system" pointSize="17" /> |
|||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" /> |
|||
<nil key="highlightedColor" /> |
|||
</label> |
|||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ControlCatalog.iOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" |
|||
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX"> |
|||
<rect key="frame" x="20" y="140" width="441" height="43" /> |
|||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" /> |
|||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" /> |
|||
<nil key="highlightedColor" /> |
|||
</label> |
|||
</subviews> |
|||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" /> |
|||
<constraints> |
|||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC" /> |
|||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk" /> |
|||
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l" /> |
|||
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0" /> |
|||
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9" /> |
|||
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g" /> |
|||
</constraints> |
|||
<nil key="simulatedStatusBarMetrics" /> |
|||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics" /> |
|||
<point key="canvasLocation" x="548" y="455" /> |
|||
</view> |
|||
</objects> |
|||
</document> |
|||
@ -0,0 +1,9 @@ |
|||
<Application xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:CompileBindings="True" |
|||
Name="Mobile Sandbox" |
|||
x:Class="MobileSandbox.App"> |
|||
<Application.Styles> |
|||
<FluentTheme Mode="Dark" /> |
|||
</Application.Styles> |
|||
</Application> |
|||
@ -0,0 +1,28 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls.ApplicationLifetimes; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace MobileSandbox |
|||
{ |
|||
public class App : Application |
|||
{ |
|||
public override void Initialize() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
|
|||
public override void OnFrameworkInitializationCompleted() |
|||
{ |
|||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) |
|||
{ |
|||
desktopLifetime.MainWindow = new MainWindow(); |
|||
} |
|||
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime) |
|||
{ |
|||
singleViewLifetime.MainView = new MainView(); |
|||
} |
|||
|
|||
base.OnFrameworkInitializationCompleted(); |
|||
} |
|||
} |
|||
} |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 172 KiB |
@ -0,0 +1,11 @@ |
|||
<UserControl x:Class="MobileSandbox.MainView" |
|||
xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<StackPanel Margin="100 50" Spacing="50"> |
|||
<TextBlock Text="Login" Foreground="White" /> |
|||
<TextBox Watermark="Username" TextInputOptions.ContentType="Email" AcceptsReturn="True" TextInputOptions.ReturnKeyType="Search" /> |
|||
<TextBox Watermark="Password" PasswordChar="*" TextInputOptions.ContentType="Password" /> |
|||
<TextBox Watermark="Pin" PasswordChar="*" TextInputOptions.ContentType="Digits" /> |
|||
<Button Content="Login" Command="{Binding ButtonCommand}" /> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Windows.Input; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace MobileSandbox |
|||
{ |
|||
public class MainView : UserControl |
|||
{ |
|||
public MainView() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
|
|||
DataContext = this; |
|||
} |
|||
|
|||
public void ButtonCommand() |
|||
{ |
|||
Console.WriteLine("Button pressed"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
<Window xmlns="https://github.com/avaloniaui" |
|||
xmlns:local="clr-namespace:MobileSandbox" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Name="MainWindow" |
|||
CanResize="False" |
|||
Width="720" Height="1280" |
|||
Title="Mobile Sandbox" |
|||
Icon="/Assets/test_icon.ico" |
|||
WindowStartupLocation="CenterScreen" |
|||
x:Class="MobileSandbox.MainWindow"> |
|||
<local:MainView /> |
|||
</Window> |
|||
@ -0,0 +1,21 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace MobileSandbox |
|||
{ |
|||
public class MainWindow : Window |
|||
{ |
|||
public MainWindow() |
|||
{ |
|||
this.InitializeComponent(); |
|||
|
|||
//Renderer.DrawFps = true;
|
|||
//Renderer.DrawDirtyRects = Renderer.DrawFps = true;
|
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> |
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Compile Update="**\*.xaml.cs"> |
|||
<DependentUpon>%(Filename)</DependentUpon> |
|||
</Compile> |
|||
<AvaloniaResource Include="**\*.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</AvaloniaResource> |
|||
<AvaloniaResource Include="Assets\*" /> |
|||
<AvaloniaResource Include="Assets\Fonts\*" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Remove="Pages\NativeEmbedPage.xaml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Assets\Fonts\SourceSansPro-Bold.ttf" /> |
|||
<EmbeddedResource Include="Assets\Fonts\SourceSansPro-BoldItalic.ttf" /> |
|||
<EmbeddedResource Include="Assets\Fonts\SourceSansPro-Italic.ttf" /> |
|||
<EmbeddedResource Include="Assets\Fonts\SourceSansPro-Regular.ttf" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls.ColorPicker\Avalonia.Controls.ColorPicker.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls.DataGrid\Avalonia.Controls.DataGrid.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Fluent\Avalonia.Themes.Fluent.csproj" /> |
|||
<ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" /> |
|||
<ProjectReference Include="..\SampleControls\ControlSamples.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<AvaloniaResource Update="Pages\NativeEmbedPage.xaml"> |
|||
<Generator>MSBuild:Compile</Generator> |
|||
</AvaloniaResource> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Update="Pages\NativeEmbedPage.xaml.cs"> |
|||
<DependentUpon>%(Filename)</DependentUpon> |
|||
</Compile> |
|||
</ItemGroup> |
|||
|
|||
<Import Project="..\..\build\BuildTargets.targets" /> |
|||
</Project> |
|||
@ -0,0 +1,19 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="MobileSandbox.Views.CustomNotificationView"> |
|||
<Border Padding="12" MinHeight="20" Background="DodgerBlue"> |
|||
<Grid ColumnDefinitions="Auto,*"> |
|||
<Panel Margin="0,0,12,0" Width="25" Height="25" VerticalAlignment="Top"> |
|||
<TextBlock Text="" FontFamily="Segoe UI Symbol" FontSize="20" TextAlignment="Center" VerticalAlignment="Center"/> |
|||
</Panel> |
|||
<DockPanel Grid.Column="1"> |
|||
<TextBlock DockPanel.Dock="Top" Text="{Binding Title}" FontWeight="Medium" /> |
|||
<StackPanel Spacing="20" DockPanel.Dock="Bottom" Margin="0,8,0,0" Orientation="Horizontal"> |
|||
<Button Content="No" DockPanel.Dock="Right" NotificationCard.CloseOnClick="True" Command="{Binding NoCommand}" Margin="0,0,8,0" /> |
|||
<Button Content="Yes" DockPanel.Dock="Right" NotificationCard.CloseOnClick="True" Command="{Binding YesCommand}" /> |
|||
</StackPanel> |
|||
<TextBlock Text="{Binding Message}" TextWrapping="Wrap" Opacity=".8" Margin="0,8,0,0"/> |
|||
</DockPanel> |
|||
</Grid> |
|||
</Border> |
|||
</UserControl> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue