Browse Source
# Conflicts: # src/Headless/Avalonia.Headless/HeadlessPlatformStubs.cs # src/Headless/Avalonia.Headless/HeadlessPlatformThreadingInterface.cs # src/Headless/Avalonia.Headless/HeadlessWindowImpl.cspull/10473/head
791 changed files with 24366 additions and 11182 deletions
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -1,5 +1,5 @@ |
|||||
<Project> |
<Project> |
||||
<PropertyGroup Condition="$(NETCoreSdkVersion.StartsWith('7.0'))"> |
<PropertyGroup Condition="$([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '7.0'))"> |
||||
<DefineConstants>$(DefineConstants);NET7SDK</DefineConstants> |
<DefineConstants>$(DefineConstants);NET7SDK</DefineConstants> |
||||
</PropertyGroup> |
</PropertyGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -0,0 +1,46 @@ |
|||||
|
//
|
||||
|
// AvnTextInputMethod.h
|
||||
|
// Avalonia.Native.OSX
|
||||
|
//
|
||||
|
// Created by Benedikt Stebner on 22.11.22.
|
||||
|
// Copyright © 2022 Avalonia. All rights reserved.
|
||||
|
//
|
||||
|
|
||||
|
#ifndef AvnTextInputMethod_h |
||||
|
#define AvnTextInputMethod_h |
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
#include "com.h" |
||||
|
#include "comimpl.h" |
||||
|
#include "avalonia-native.h" |
||||
|
#import "AvnTextInputMethodDelegate.h" |
||||
|
|
||||
|
class AvnTextInputMethod: public virtual ComObject, public virtual IAvnTextInputMethod{ |
||||
|
private: |
||||
|
id<AvnTextInputMethodDelegate> _inputMethodDelegate; |
||||
|
public: |
||||
|
FORWARD_IUNKNOWN() |
||||
|
|
||||
|
BEGIN_INTERFACE_MAP() |
||||
|
INTERFACE_MAP_ENTRY(IAvnTextInputMethod, IID_IAvnTextInputMethod) |
||||
|
END_INTERFACE_MAP() |
||||
|
|
||||
|
virtual ~AvnTextInputMethod(); |
||||
|
|
||||
|
AvnTextInputMethod(id<AvnTextInputMethodDelegate> inputMethodDelegate); |
||||
|
|
||||
|
bool IsActive (); |
||||
|
|
||||
|
HRESULT SetClient (IAvnTextInputMethodClient* client) override; |
||||
|
|
||||
|
virtual void Reset () override; |
||||
|
|
||||
|
virtual void SetCursorRect (AvnRect rect) override; |
||||
|
|
||||
|
virtual void SetSurroundingText (char* text, int anchorOffset, int cursorOffset) override; |
||||
|
|
||||
|
public: |
||||
|
ComPtr<IAvnTextInputMethodClient> Client; |
||||
|
}; |
||||
|
#endif /* AvnTextInputMethod_h */ |
||||
@ -0,0 +1,41 @@ |
|||||
|
// |
||||
|
// AvnTextInputMethod.mm |
||||
|
// Avalonia.Native.OSX |
||||
|
// |
||||
|
// Created by Benedikt Stebner on 23.11.22. |
||||
|
// Copyright © 2022 Avalonia. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
#include "AvnTextInputMethod.h" |
||||
|
|
||||
|
AvnTextInputMethod::~AvnTextInputMethod() { |
||||
|
Client = nullptr; |
||||
|
} |
||||
|
|
||||
|
AvnTextInputMethod::AvnTextInputMethod(id<AvnTextInputMethodDelegate> inputMethodDelegate) { |
||||
|
_inputMethodDelegate = inputMethodDelegate; |
||||
|
} |
||||
|
|
||||
|
bool AvnTextInputMethod::IsActive() { |
||||
|
return Client != nullptr; |
||||
|
} |
||||
|
|
||||
|
HRESULT AvnTextInputMethod::SetClient(IAvnTextInputMethodClient *client) { |
||||
|
START_COM_CALL; |
||||
|
|
||||
|
Client = client; |
||||
|
|
||||
|
return S_OK; |
||||
|
} |
||||
|
|
||||
|
void AvnTextInputMethod::Reset() { |
||||
|
} |
||||
|
|
||||
|
void AvnTextInputMethod::SetSurroundingText(char* text, int anchorOffset, int cursorOffset) { |
||||
|
[_inputMethodDelegate setText:[NSString stringWithUTF8String:text]]; |
||||
|
[_inputMethodDelegate setSelection: anchorOffset : cursorOffset]; |
||||
|
} |
||||
|
|
||||
|
void AvnTextInputMethod::SetCursorRect(AvnRect rect) { |
||||
|
[_inputMethodDelegate setCursorRect: rect]; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
//
|
||||
|
// AvnTextInputMethodHost.h
|
||||
|
// Avalonia.Native.OSX
|
||||
|
//
|
||||
|
// Created by Benedikt Stebner on 24.11.22.
|
||||
|
// Copyright © 2022 Avalonia. All rights reserved.
|
||||
|
//
|
||||
|
|
||||
|
#ifndef AvnTextInputMethodHost_h |
||||
|
#define AvnTextInputMethodHost_h |
||||
|
|
||||
|
@protocol AvnTextInputMethodDelegate |
||||
|
@required |
||||
|
-(void) setText:(NSString* _Nonnull) text; |
||||
|
-(void) setCursorRect:(AvnRect) cursorRect; |
||||
|
-(void) setSelection: (int) start : (int) end; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
#endif /* AvnTextInputMethodHost_h */ |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.IO; |
||||
|
using Nuke.Common.Utilities; |
||||
|
|
||||
|
class Helpers |
||||
|
{ |
||||
|
public static IDisposable UseTempDir(out string dir) |
||||
|
{ |
||||
|
var path = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); |
||||
|
Directory.CreateDirectory(path); |
||||
|
dir = path; |
||||
|
return DelegateDisposable.CreateBracket(null, () => |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
Directory.Delete(path, true); |
||||
|
} |
||||
|
catch |
||||
|
{ |
||||
|
// ignore
|
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,171 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.IO.Compression; |
||||
|
using System.Linq; |
||||
|
using ILRepacking; |
||||
|
using Mono.Cecil; |
||||
|
using Mono.Cecil.Cil; |
||||
|
|
||||
|
public class RefAssemblyGenerator |
||||
|
{ |
||||
|
class Resolver : DefaultAssemblyResolver, IAssemblyResolver |
||||
|
{ |
||||
|
private readonly string _dir; |
||||
|
Dictionary<string, AssemblyDefinition> _cache = new(); |
||||
|
|
||||
|
public Resolver(string dir) |
||||
|
{ |
||||
|
_dir = dir; |
||||
|
} |
||||
|
|
||||
|
public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) |
||||
|
{ |
||||
|
if (_cache.TryGetValue(name.Name, out var asm)) |
||||
|
return asm; |
||||
|
var path = Path.Combine(_dir, name.Name + ".dll"); |
||||
|
if (File.Exists(path)) |
||||
|
return _cache[name.Name] = AssemblyDefinition.ReadAssembly(path, parameters); |
||||
|
return base.Resolve(name, parameters); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void PatchRefAssembly(string file) |
||||
|
{ |
||||
|
var reader = typeof(RefAssemblyGenerator).Assembly.GetManifestResourceStream("avalonia.snk"); |
||||
|
var snk = new byte[reader.Length]; |
||||
|
reader.Read(snk, 0, snk.Length); |
||||
|
|
||||
|
var def = AssemblyDefinition.ReadAssembly(file, new ReaderParameters |
||||
|
{ |
||||
|
ReadWrite = true, |
||||
|
InMemory = true, |
||||
|
ReadSymbols = true, |
||||
|
SymbolReaderProvider = new DefaultSymbolReaderProvider(false), |
||||
|
AssemblyResolver = new Resolver(Path.GetDirectoryName(file)) |
||||
|
}); |
||||
|
|
||||
|
var obsoleteAttribute = def.MainModule.ImportReference(new TypeReference("System", "ObsoleteAttribute", def.MainModule, |
||||
|
def.MainModule.TypeSystem.CoreLibrary)); |
||||
|
var obsoleteCtor = def.MainModule.ImportReference(new MethodReference(".ctor", |
||||
|
def.MainModule.TypeSystem.Void, obsoleteAttribute) |
||||
|
{ |
||||
|
Parameters = { new ParameterDefinition(def.MainModule.TypeSystem.String) } |
||||
|
}); |
||||
|
|
||||
|
foreach(var t in def.MainModule.Types) |
||||
|
ProcessType(t, obsoleteCtor); |
||||
|
def.Write(file, new WriterParameters() |
||||
|
{ |
||||
|
StrongNameKeyBlob = snk, |
||||
|
WriteSymbols = def.MainModule.HasSymbols, |
||||
|
SymbolWriterProvider = new EmbeddedPortablePdbWriterProvider(), |
||||
|
DeterministicMvid = def.MainModule.HasSymbols |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
static void ProcessType(TypeDefinition type, MethodReference obsoleteCtor) |
||||
|
{ |
||||
|
foreach (var nested in type.NestedTypes) |
||||
|
ProcessType(nested, obsoleteCtor); |
||||
|
if (type.IsInterface) |
||||
|
{ |
||||
|
var hideMethods = type.Name.EndsWith("Impl") |
||||
|
|| (type.HasCustomAttributes && type.CustomAttributes.Any(a => |
||||
|
a.AttributeType.FullName == "Avalonia.Metadata.PrivateApiAttribute")); |
||||
|
|
||||
|
var injectMethod = hideMethods |
||||
|
|| type.CustomAttributes.Any(a => |
||||
|
a.AttributeType.FullName == "Avalonia.Metadata.NotClientImplementableAttribute"); |
||||
|
|
||||
|
if (hideMethods) |
||||
|
{ |
||||
|
foreach (var m in type.Methods) |
||||
|
{ |
||||
|
var dflags = MethodAttributes.Public | MethodAttributes.Family | MethodAttributes.FamORAssem | |
||||
|
MethodAttributes.FamANDAssem | MethodAttributes.Assembly; |
||||
|
m.Attributes = ((m.Attributes | dflags) ^ dflags) | MethodAttributes.Assembly; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if(injectMethod) |
||||
|
{ |
||||
|
type.Methods.Add(new MethodDefinition("NotClientImplementable", |
||||
|
MethodAttributes.Assembly |
||||
|
| MethodAttributes.Abstract |
||||
|
| MethodAttributes.NewSlot |
||||
|
| MethodAttributes.HideBySig, type.Module.TypeSystem.Void)); |
||||
|
} |
||||
|
|
||||
|
var forceUnstable = type.CustomAttributes.Any(a => |
||||
|
a.AttributeType.FullName == "Avalonia.Metadata.UnstableAttribute"); |
||||
|
|
||||
|
foreach (var m in type.Methods) |
||||
|
MarkAsUnstable(m, obsoleteCtor, forceUnstable); |
||||
|
foreach (var m in type.Properties) |
||||
|
MarkAsUnstable(m, obsoleteCtor, forceUnstable); |
||||
|
foreach (var m in type.Events) |
||||
|
MarkAsUnstable(m, obsoleteCtor, forceUnstable); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static void MarkAsUnstable(IMemberDefinition def, MethodReference obsoleteCtor, bool force) |
||||
|
{ |
||||
|
if (!force && ( |
||||
|
def.HasCustomAttributes == false |
||||
|
|| def.CustomAttributes.All(a => a.AttributeType.FullName != "Avalonia.Metadata.UnstableAttribute"))) |
||||
|
return; |
||||
|
|
||||
|
if (def.CustomAttributes.Any(a => a.AttributeType.FullName == "System.ObsoleteAttribute")) |
||||
|
return; |
||||
|
|
||||
|
def.CustomAttributes.Add(new CustomAttribute(obsoleteCtor) |
||||
|
{ |
||||
|
ConstructorArguments = |
||||
|
{ |
||||
|
new CustomAttributeArgument(obsoleteCtor.Module.TypeSystem.String, |
||||
|
"This is a part of unstable API and can be changed in minor releases. You have been warned") |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public static void GenerateRefAsmsInPackage(string packagePath) |
||||
|
{ |
||||
|
using (var archive = new ZipArchive(File.Open(packagePath, FileMode.Open, FileAccess.ReadWrite), |
||||
|
ZipArchiveMode.Update)) |
||||
|
{ |
||||
|
foreach (var entry in archive.Entries.ToList()) |
||||
|
{ |
||||
|
if (entry.FullName.StartsWith("ref/")) |
||||
|
entry.Delete(); |
||||
|
} |
||||
|
|
||||
|
foreach (var entry in archive.Entries.ToList()) |
||||
|
{ |
||||
|
if (entry.FullName.StartsWith("lib/") && entry.Name.EndsWith(".xml")) |
||||
|
{ |
||||
|
var newEntry = archive.CreateEntry("ref/" + entry.FullName.Substring(4), |
||||
|
CompressionLevel.Optimal); |
||||
|
using (var src = entry.Open()) |
||||
|
using (var dst = newEntry.Open()) |
||||
|
src.CopyTo(dst); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var libs = archive.Entries.Where(e => e.FullName.StartsWith("lib/") && e.FullName.EndsWith(".dll")) |
||||
|
.Select((e => new { s = e.FullName.Split('/'), e = e })) |
||||
|
.Select(e => new { Tfm = e.s[1], Name = e.s[2], Entry = e.e }) |
||||
|
.GroupBy(x => x.Tfm); |
||||
|
foreach(var tfm in libs) |
||||
|
using (Helpers.UseTempDir(out var temp)) |
||||
|
{ |
||||
|
foreach (var l in tfm) |
||||
|
l.Entry.ExtractToFile(Path.Combine(temp, l.Name)); |
||||
|
foreach (var l in tfm) |
||||
|
PatchRefAssembly(Path.Combine(temp, l.Name)); |
||||
|
foreach (var l in tfm) |
||||
|
archive.CreateEntryFromFile(Path.Combine(temp, l.Name), $"ref/{l.Tfm}/{l.Name}"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<resources> |
||||
|
<color name="splash_background">#212121</color> |
||||
|
</resources> |
||||
@ -1,19 +1,12 @@ |
|||||
using Avalonia; |
using Avalonia.Controls; |
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
namespace ControlCatalog.Pages |
||||
{ |
{ |
||||
public class RelativePanelPage : UserControl |
public partial class RelativePanelPage : UserControl |
||||
{ |
{ |
||||
public RelativePanelPage() |
public RelativePanelPage() |
||||
{ |
{ |
||||
this.InitializeComponent(); |
InitializeComponent(); |
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,222 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
||||
d:DesignHeight="800" |
|
||||
d:DesignWidth="400" |
|
||||
x:Class="ControlCatalog.Pages.ScrollSnapPage" |
|
||||
xmlns:pages="using:ControlCatalog.Pages" |
|
||||
x:DataType="pages:ScrollSnapPageViewModel"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock TextWrapping="Wrap" |
|
||||
Classes="h2">Scrollviewer can snap supported content both vertically and horizontally. Snapping occurs from scrolling with touch or pen.</TextBlock> |
|
||||
|
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"> |
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Spacing="4"> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="4"> |
|
||||
<TextBlock Text="Snap Point Type" /> |
|
||||
<ComboBox Items="{Binding AvailableSnapPointsType}" |
|
||||
SelectedItem="{Binding SnapPointsType}" /> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="4"> |
|
||||
<TextBlock Text="Snap Point Alignment" /> |
|
||||
<ComboBox Items="{Binding AvailableSnapPointsAlignment}" |
|
||||
SelectedItem="{Binding SnapPointsAlignment}" /> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<ToggleSwitch IsChecked="{Binding AreSnapPointsRegular}" |
|
||||
OffContent="No" |
|
||||
OnContent="Yes" |
|
||||
Content="Are Snap Points regular?" /> |
|
||||
</StackPanel> |
|
||||
<TextBlock TextWrapping="Wrap" |
|
||||
Grid.Row="1" |
|
||||
Margin="0,10" |
|
||||
Classes="h2">Vertical Snapping</TextBlock> |
|
||||
|
|
||||
<Border |
|
||||
BorderBrush="Green" |
|
||||
BorderThickness="1" |
|
||||
Padding="0" |
|
||||
Grid.Row="2" |
|
||||
Margin="10, 5"> |
|
||||
<ScrollViewer x:Name="VerticalSnapsScrollViewer" |
|
||||
VerticalSnapPointsType="{Binding SnapPointsType}" |
|
||||
VerticalSnapPointsAlignment="{Binding SnapPointsAlignment}" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
Height="350" |
|
||||
HorizontalScrollBarVisibility="Disabled"> |
|
||||
<StackPanel AreVerticalSnapPointsRegular="{Binding AreSnapPointsRegular}" |
|
||||
Orientation="Vertical" |
|
||||
HorizontalAlignment="Stretch"> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 1"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 2"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 20" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 3"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 4"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 5"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 6"/> |
|
||||
</Border> |
|
||||
<Border Padding="5,8" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 7"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 8"/> |
|
||||
</Border> |
|
||||
<Border Padding="5,4" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 9"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 20"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 11"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
Text="Child 12"/> |
|
||||
</Border> |
|
||||
</StackPanel> |
|
||||
</ScrollViewer> |
|
||||
</Border> |
|
||||
<TextBlock TextWrapping="Wrap" |
|
||||
Grid.Row="3" |
|
||||
Margin="0,10" |
|
||||
Classes="h2">Horizontal Snapping</TextBlock> |
|
||||
<Border |
|
||||
BorderBrush="Green" |
|
||||
BorderThickness="1" |
|
||||
Padding="0" |
|
||||
Grid.Row="4" |
|
||||
Margin="10, 10"> |
|
||||
<ScrollViewer x:Name="HorizontalSnapsScrollViewer" |
|
||||
HorizontalSnapPointsType="{Binding SnapPointsType}" |
|
||||
HorizontalSnapPointsAlignment="{Binding SnapPointsAlignment}" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
Height="350" |
|
||||
HorizontalScrollBarVisibility="Auto" |
|
||||
VerticalScrollBarVisibility="Disabled"> |
|
||||
<StackPanel AreHorizontalSnapPointsRegular="{Binding AreSnapPointsRegular}" |
|
||||
Orientation="Horizontal" |
|
||||
HorizontalAlignment="Stretch"> |
|
||||
<Border Padding="5, 30" |
|
||||
Width="300" |
|
||||
BorderBrush="Red" |
|
||||
HorizontalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
VerticalAlignment="Center" |
|
||||
Text="Child 1"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
Width="300" |
|
||||
BorderBrush="Red" |
|
||||
VerticalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
VerticalAlignment="Center" |
|
||||
Text="Child 2"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 20" |
|
||||
Width="300" |
|
||||
BorderBrush="Red" |
|
||||
VerticalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
VerticalAlignment="Center" |
|
||||
Text="Child 3"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
Width="300" |
|
||||
BorderBrush="Red" |
|
||||
VerticalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
VerticalAlignment="Center" |
|
||||
Text="Child 4"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
Width="300" |
|
||||
BorderBrush="Red" |
|
||||
VerticalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
VerticalAlignment="Center" |
|
||||
Text="Child 5"/> |
|
||||
</Border> |
|
||||
<Border Padding="5, 30" |
|
||||
Width="300" |
|
||||
BorderBrush="Red" |
|
||||
VerticalAlignment="Stretch" |
|
||||
BorderThickness="1"> |
|
||||
<TextBlock FontWeight="Bold" |
|
||||
VerticalAlignment="Center" |
|
||||
Text="Child 6"/> |
|
||||
</Border> |
|
||||
|
|
||||
</StackPanel> |
|
||||
</ScrollViewer> |
|
||||
</Border> |
|
||||
</Grid> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,68 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Controls.Primitives; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using MiniMvvm; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ScrollSnapPageViewModel : ViewModelBase |
|
||||
{ |
|
||||
private SnapPointsType _snapPointsType; |
|
||||
private SnapPointsAlignment _snapPointsAlignment; |
|
||||
private bool _areSnapPointsRegular; |
|
||||
|
|
||||
public ScrollSnapPageViewModel() |
|
||||
{ |
|
||||
|
|
||||
AvailableSnapPointsType = new List<SnapPointsType>() |
|
||||
{ |
|
||||
SnapPointsType.None, |
|
||||
SnapPointsType.Mandatory, |
|
||||
SnapPointsType.MandatorySingle |
|
||||
}; |
|
||||
|
|
||||
AvailableSnapPointsAlignment = new List<SnapPointsAlignment>() |
|
||||
{ |
|
||||
SnapPointsAlignment.Near, |
|
||||
SnapPointsAlignment.Center, |
|
||||
SnapPointsAlignment.Far, |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
public bool AreSnapPointsRegular |
|
||||
{ |
|
||||
get => _areSnapPointsRegular; |
|
||||
set => this.RaiseAndSetIfChanged(ref _areSnapPointsRegular, value); |
|
||||
} |
|
||||
|
|
||||
public SnapPointsType SnapPointsType |
|
||||
{ |
|
||||
get => _snapPointsType; |
|
||||
set => this.RaiseAndSetIfChanged(ref _snapPointsType, value); |
|
||||
} |
|
||||
|
|
||||
public SnapPointsAlignment SnapPointsAlignment |
|
||||
{ |
|
||||
get => _snapPointsAlignment; |
|
||||
set => this.RaiseAndSetIfChanged(ref _snapPointsAlignment, value); |
|
||||
} |
|
||||
public List<SnapPointsType> AvailableSnapPointsType { get; } |
|
||||
public List<SnapPointsAlignment> AvailableSnapPointsAlignment { get; } |
|
||||
} |
|
||||
|
|
||||
public class ScrollSnapPage : UserControl |
|
||||
{ |
|
||||
public ScrollSnapPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
|
|
||||
DataContext = new ScrollSnapPageViewModel(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,7 @@ |
|||||
|
<Application xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
x:Class="Generators.Sandbox.App"> |
||||
|
<Application.Styles> |
||||
|
<FluentTheme /> |
||||
|
</Application.Styles> |
||||
|
</Application> |
||||
@ -0,0 +1,20 @@ |
|||||
|
using Avalonia; |
||||
|
using Avalonia.Markup.Xaml; |
||||
|
using Generators.Sandbox.ViewModels; |
||||
|
|
||||
|
namespace Generators.Sandbox; |
||||
|
|
||||
|
public class App : Application |
||||
|
{ |
||||
|
public override void Initialize() => AvaloniaXamlLoader.Load(this); |
||||
|
|
||||
|
public override void OnFrameworkInitializationCompleted() |
||||
|
{ |
||||
|
var view = new Views.SignUpView |
||||
|
{ |
||||
|
ViewModel = new SignUpViewModel() |
||||
|
}; |
||||
|
view.Show(); |
||||
|
base.OnFrameworkInitializationCompleted(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using Avalonia.Controls; |
||||
|
using Avalonia.Styling; |
||||
|
|
||||
|
namespace Generators.Sandbox.Controls; |
||||
|
|
||||
|
public class CustomTextBox : TextBox, IStyleable |
||||
|
{ |
||||
|
Type IStyleable.StyleKey => typeof(TextBox); |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
<UserControl xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:controls="using:Generators.Sandbox.Controls" |
||||
|
x:Class="Generators.Sandbox.Controls.SignUpView"> |
||||
|
<StackPanel> |
||||
|
<controls:CustomTextBox Margin="0 10 0 0" |
||||
|
x:Name="UserNameTextBox" |
||||
|
Watermark="Please, enter user name..." |
||||
|
UseFloatingWatermark="True" /> |
||||
|
<TextBlock x:Name="UserNameValidation" |
||||
|
Foreground="Red" |
||||
|
FontSize="12" /> |
||||
|
<TextBox Margin="0 10 0 0" |
||||
|
x:Name="PasswordTextBox" |
||||
|
Watermark="Please, enter your password..." |
||||
|
UseFloatingWatermark="True" |
||||
|
PasswordChar="*" /> |
||||
|
<TextBlock x:Name="PasswordValidation" |
||||
|
Foreground="Red" |
||||
|
FontSize="12" /> |
||||
|
<TextBox Margin="0 10 0 0" |
||||
|
x:Name="ConfirmPasswordTextBox" |
||||
|
Watermark="Please, confirm the password..." |
||||
|
UseFloatingWatermark="True" |
||||
|
PasswordChar="*" /> |
||||
|
<TextBlock x:Name="ConfirmPasswordValidation" |
||||
|
TextWrapping="Wrap" |
||||
|
Foreground="Red" |
||||
|
FontSize="12" /> |
||||
|
<TextBlock> |
||||
|
<TextBlock.Inlines> |
||||
|
<InlineCollection> |
||||
|
<Run x:Name="SignUpButtonDescription" /> |
||||
|
</InlineCollection> |
||||
|
</TextBlock.Inlines> |
||||
|
</TextBlock> |
||||
|
<Button Margin="0 10 0 5" |
||||
|
Content="Sign up" |
||||
|
x:Name="SignUpButton" /> |
||||
|
<TextBlock x:Name="CompoundValidation" |
||||
|
TextWrapping="Wrap" |
||||
|
Foreground="Red" |
||||
|
FontSize="12" /> |
||||
|
</StackPanel> |
||||
|
</UserControl> |
||||
@ -0,0 +1,54 @@ |
|||||
|
using System; |
||||
|
using System.Reactive.Disposables; |
||||
|
using Avalonia.ReactiveUI; |
||||
|
using Generators.Sandbox.ViewModels; |
||||
|
using ReactiveUI; |
||||
|
using ReactiveUI.Validation.Extensions; |
||||
|
using ReactiveUI.Validation.Formatters; |
||||
|
|
||||
|
namespace Generators.Sandbox.Controls; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// This is a sample view class with typed x:Name references generated using
|
||||
|
/// .NET 5 source generators. The class has to be partial because x:Name
|
||||
|
/// references are living in a separate partial class file. See also:
|
||||
|
/// https://devblogs.microsoft.com/dotnet/new-c-source-generator-samples/
|
||||
|
/// </summary>
|
||||
|
public partial class SignUpView : ReactiveUserControl<SignUpViewModel> |
||||
|
{ |
||||
|
public SignUpView() |
||||
|
{ |
||||
|
// The InitializeComponent method is also generated automatically
|
||||
|
// and lives in the autogenerated part of the partial class.
|
||||
|
InitializeComponent(); |
||||
|
this.WhenActivated(disposables => |
||||
|
{ |
||||
|
this.Bind(ViewModel, x => x.UserName, x => x.UserNameTextBox.Text) |
||||
|
.DisposeWith(disposables); |
||||
|
this.Bind(ViewModel, x => x.Password, x => x.PasswordTextBox.Text) |
||||
|
.DisposeWith(disposables); |
||||
|
this.Bind(ViewModel, x => x.ConfirmPassword, x => x.ConfirmPasswordTextBox.Text) |
||||
|
.DisposeWith(disposables); |
||||
|
this.BindCommand(ViewModel, x => x.SignUp, x => x.SignUpButton) |
||||
|
.DisposeWith(disposables); |
||||
|
|
||||
|
this.BindValidation(ViewModel, x => x.UserName, x => x.UserNameValidation.Text) |
||||
|
.DisposeWith(disposables); |
||||
|
this.BindValidation(ViewModel, x => x.Password, x => x.PasswordValidation.Text) |
||||
|
.DisposeWith(disposables); |
||||
|
this.BindValidation(ViewModel, x => x.ConfirmPassword, x => x.ConfirmPasswordValidation.Text) |
||||
|
.DisposeWith(disposables); |
||||
|
|
||||
|
var newLineFormatter = new SingleLineFormatter(Environment.NewLine); |
||||
|
this.BindValidation(ViewModel, x => x.CompoundValidation.Text, newLineFormatter) |
||||
|
.DisposeWith(disposables); |
||||
|
|
||||
|
// The references to text boxes below are also auto generated.
|
||||
|
// Use Ctrl+Click in order to view the generated sources.
|
||||
|
UserNameTextBox.Text = "Joseph!"; |
||||
|
PasswordTextBox.Text = "1234"; |
||||
|
ConfirmPasswordTextBox.Text = "1234"; |
||||
|
SignUpButtonDescription.Text = "Press the button below to sign up."; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
<PropertyGroup> |
||||
|
<OutputType>Exe</OutputType> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<IncludeAvaloniaGenerators>true</IncludeAvaloniaGenerators> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<AvaloniaResource Include="**\*.xaml"/> |
||||
|
<!-- Note this AdditionalFiles directive. --> |
||||
|
<AdditionalFiles Include="**\*.xaml"/> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="ReactiveUI.Validation" Version="3.0.22"/> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj"/> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Desktop\Avalonia.Desktop.csproj"/> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"/> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Themes.Fluent\Avalonia.Themes.Fluent.csproj"/> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Fonts.Inter\Avalonia.Fonts.Inter.csproj"/> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<Import Project="..\..\build\BuildTargets.targets"/> |
||||
|
<Import Project="..\..\build\SourceGenerators.props"/> |
||||
|
</Project> |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Avalonia; |
||||
|
using Avalonia.ReactiveUI; |
||||
|
|
||||
|
namespace Generators.Sandbox; |
||||
|
|
||||
|
internal static class Program |
||||
|
{ |
||||
|
public static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); |
||||
|
|
||||
|
private static AppBuilder BuildAvaloniaApp() |
||||
|
=> AppBuilder.Configure<App>() |
||||
|
.UseReactiveUI() |
||||
|
.UsePlatformDetect() |
||||
|
.LogToTrace(); |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
using System.Reactive; |
||||
|
using ReactiveUI; |
||||
|
using ReactiveUI.Validation.Extensions; |
||||
|
using ReactiveUI.Validation.Helpers; |
||||
|
|
||||
|
namespace Generators.Sandbox.ViewModels; |
||||
|
|
||||
|
public class SignUpViewModel : ReactiveValidationObject |
||||
|
{ |
||||
|
private string _userName = string.Empty; |
||||
|
private string _password = string.Empty; |
||||
|
private string _confirmPassword = string.Empty; |
||||
|
|
||||
|
public SignUpViewModel() |
||||
|
{ |
||||
|
this.ValidationRule( |
||||
|
vm => vm.UserName, |
||||
|
name => !string.IsNullOrWhiteSpace(name), |
||||
|
"UserName is required."); |
||||
|
|
||||
|
this.ValidationRule( |
||||
|
vm => vm.Password, |
||||
|
password => !string.IsNullOrWhiteSpace(password), |
||||
|
"Password is required."); |
||||
|
|
||||
|
this.ValidationRule( |
||||
|
vm => vm.Password, |
||||
|
password => password?.Length > 2, |
||||
|
password => $"Password should be longer, current length: {password.Length}"); |
||||
|
|
||||
|
this.ValidationRule( |
||||
|
vm => vm.ConfirmPassword, |
||||
|
confirmation => !string.IsNullOrWhiteSpace(confirmation), |
||||
|
"Confirm password field is required."); |
||||
|
|
||||
|
var passwordsObservable = |
||||
|
this.WhenAnyValue( |
||||
|
x => x.Password, |
||||
|
x => x.ConfirmPassword, |
||||
|
(password, confirmation) => |
||||
|
password == confirmation); |
||||
|
|
||||
|
this.ValidationRule( |
||||
|
vm => vm.ConfirmPassword, |
||||
|
passwordsObservable, |
||||
|
"Passwords must match."); |
||||
|
|
||||
|
SignUp = ReactiveCommand.Create(() => {}, this.IsValid()); |
||||
|
} |
||||
|
|
||||
|
public ReactiveCommand<Unit, Unit> SignUp { get; } |
||||
|
|
||||
|
public string UserName |
||||
|
{ |
||||
|
get => _userName; |
||||
|
set => this.RaiseAndSetIfChanged(ref _userName, value); |
||||
|
} |
||||
|
|
||||
|
public string Password |
||||
|
{ |
||||
|
get => _password; |
||||
|
set => this.RaiseAndSetIfChanged(ref _password, value); |
||||
|
} |
||||
|
|
||||
|
public string ConfirmPassword |
||||
|
{ |
||||
|
get => _confirmPassword; |
||||
|
set => this.RaiseAndSetIfChanged(ref _confirmPassword, value); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
<Window xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:controls="using:Generators.Sandbox.Controls" |
||||
|
x:Class="Generators.Sandbox.Views.SignUpView"> |
||||
|
<StackPanel Margin="10"> |
||||
|
<TextBlock Text="Sign Up" /> |
||||
|
<controls:SignUpView x:Name="SignUpControl" /> |
||||
|
</StackPanel> |
||||
|
</Window> |
||||
@ -0,0 +1,28 @@ |
|||||
|
using System.Reactive.Disposables; |
||||
|
using Avalonia.ReactiveUI; |
||||
|
using Generators.Sandbox.ViewModels; |
||||
|
using ReactiveUI; |
||||
|
|
||||
|
namespace Generators.Sandbox.Views; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// This is a sample view class with typed x:Name references generated using
|
||||
|
/// .NET 5 source generators. The class has to be partial because x:Name
|
||||
|
/// references are living in a separate partial class file. See also:
|
||||
|
/// https://devblogs.microsoft.com/dotnet/new-c-source-generator-samples/
|
||||
|
/// </summary>
|
||||
|
public partial class SignUpView : ReactiveWindow<SignUpViewModel> |
||||
|
{ |
||||
|
public SignUpView() |
||||
|
{ |
||||
|
// The InitializeComponent method is also generated automatically
|
||||
|
// and lives in the autogenerated part of the partial class.
|
||||
|
InitializeComponent(); |
||||
|
this.WhenActivated(disposables => |
||||
|
{ |
||||
|
this.WhenAnyValue(view => view.ViewModel) |
||||
|
.BindTo(this, view => view.SignUpControl.ViewModel) |
||||
|
.DisposeWith(disposables); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,11 @@ |
|||||
|
using Android.App; |
||||
|
using Android.Content.PM; |
||||
|
using Avalonia.Android; |
||||
|
|
||||
|
namespace SafeAreaDemo.Android |
||||
|
{ |
||||
|
[Activity(Label = "SafeAreaDemo.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] |
||||
|
public class MainActivity : AvaloniaMainActivity |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,5 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto"> |
||||
|
<uses-permission android:name="android.permission.INTERNET" /> |
||||
|
<application android:label="SafeAreaDemo" android:icon="@drawable/Icon" /> |
||||
|
</manifest> |
||||
@ -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,24 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
<PropertyGroup> |
||||
|
<OutputType>Exe</OutputType> |
||||
|
<TargetFramework>net7.0-android</TargetFramework> |
||||
|
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion> |
||||
|
<Nullable>enable</Nullable> |
||||
|
<ApplicationId>com.avalonia.safeareademo</ApplicationId> |
||||
|
<ApplicationVersion>1</ApplicationVersion> |
||||
|
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> |
||||
|
<AndroidPackageFormat>apk</AndroidPackageFormat> |
||||
|
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<AndroidResource Include="Icon.png"> |
||||
|
<Link>Resources\drawable\Icon.png</Link> |
||||
|
</AndroidResource> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\SafeAreaDemo\SafeAreaDemo.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Android\Avalonia.Android\Avalonia.Android.csproj" /> |
||||
|
</ItemGroup> |
||||
|
</Project> |
||||
@ -0,0 +1,30 @@ |
|||||
|
using Android.App; |
||||
|
using Android.Content; |
||||
|
using Android.OS; |
||||
|
using Avalonia; |
||||
|
using Avalonia.Android; |
||||
|
using Application = Android.App.Application; |
||||
|
|
||||
|
namespace SafeAreaDemo.Android |
||||
|
{ |
||||
|
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] |
||||
|
public class SplashActivity : AvaloniaSplashActivity<App> |
||||
|
{ |
||||
|
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) |
||||
|
{ |
||||
|
return base.CustomizeAppBuilder(builder); |
||||
|
} |
||||
|
|
||||
|
protected override void OnCreate(Bundle? savedInstanceState) |
||||
|
{ |
||||
|
base.OnCreate(savedInstanceState); |
||||
|
} |
||||
|
|
||||
|
protected override void OnResume() |
||||
|
{ |
||||
|
base.OnResume(); |
||||
|
|
||||
|
StartActivity(new Intent(Application.Context, typeof(MainActivity))); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using Avalonia; |
||||
|
using System; |
||||
|
|
||||
|
namespace SafeAreaDemo.Desktop |
||||
|
{ |
||||
|
internal class Program |
||||
|
{ |
||||
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
|
// yet and stuff might break.
|
||||
|
[STAThread] |
||||
|
public static void Main(string[] args) => BuildAvaloniaApp() |
||||
|
.StartWithClassicDesktopLifetime(args); |
||||
|
|
||||
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
|
public static AppBuilder BuildAvaloniaApp() |
||||
|
=> AppBuilder.Configure<App>() |
||||
|
.UsePlatformDetect() |
||||
|
.LogToTrace(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
<PropertyGroup> |
||||
|
<OutputType>WinExe</OutputType> |
||||
|
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects. |
||||
|
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.--> |
||||
|
<TargetFramework>net7.0</TargetFramework> |
||||
|
<Nullable>enable</Nullable> |
||||
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<ApplicationManifest>app.manifest</ApplicationManifest> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Headless.Vnc\Avalonia.Headless.Vnc.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" /> |
||||
|
<ProjectReference Include="..\SafeAreaDemo\SafeAreaDemo.csproj" /> |
||||
|
</ItemGroup> |
||||
|
<Import Project="..\..\build\SampleApp.props" /> |
||||
|
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
||||
|
</Project> |
||||
@ -0,0 +1,18 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> |
||||
|
<!-- This manifest is used on Windows only. |
||||
|
Don't remove it as it might cause problems with window transparency and embeded controls. |
||||
|
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests --> |
||||
|
<assemblyIdentity version="1.0.0.0" name="SafeAreaDemo.Desktop"/> |
||||
|
|
||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> |
||||
|
<application> |
||||
|
<!-- A list of the Windows versions that this application has been tested on |
||||
|
and is designed to work with. Uncomment the appropriate elements |
||||
|
and Windows will automatically select the most compatible environment. --> |
||||
|
|
||||
|
<!-- Windows 10 --> |
||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> |
||||
|
</application> |
||||
|
</compatibility> |
||||
|
</assembly> |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue