Skip to content

Commit

Permalink
Merge commit 'd1cf0d1ef926cdd5a03e5b4695ac43a8e5c85aab'
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Aug 26, 2024
2 parents 7b0b093 + d1cf0d1 commit 29b7db1
Show file tree
Hide file tree
Showing 16 changed files with 730 additions and 0 deletions.
454 changes: 454 additions & 0 deletions AvaloniaIDemo/NearlekeayiRemnelakair/.gitignore

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions AvaloniaIDemo/NearlekeayiRemnelakair/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.1.0</AvaloniaVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<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 net8.0-windows TFM, one for MacOS with net8.0-macos and one with net8.0 TFM for Linux.-->
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NearlekeayiRemnelakair\NearlekeayiRemnelakair.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

using Avalonia;
using Avalonia.ReactiveUI;

namespace NearlekeayiRemnelakair.Desktop;

class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace()
.UseReactiveUI();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embeded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="AvaloniaTest.Desktop"/>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->

<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>
30 changes: 30 additions & 0 deletions AvaloniaIDemo/NearlekeayiRemnelakair/NearlekeayiRemnelakair.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35013.160
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NearlekeayiRemnelakair", "NearlekeayiRemnelakair\NearlekeayiRemnelakair.csproj", "{D9929D6C-B874-4952-BC38-AC239C9CFB8F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NearlekeayiRemnelakair.Desktop", "NearlekeayiRemnelakair.Desktop\NearlekeayiRemnelakair.Desktop.csproj", "{7A8C8F4C-B919-4172-87AE-BEAF46F8F388}"
EndProject
Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9F188193-CF5C-4E6D-AF7E-19043D88E0A9}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A8C8F4C-B919-4172-87AE-BEAF46F8F388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A8C8F4C-B919-4172-87AE-BEAF46F8F388}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A8C8F4C-B919-4172-87AE-BEAF46F8F388}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A8C8F4C-B919-4172-87AE-BEAF46F8F388}.Release|Any CPU.Build.0 = Release|Any CPU
{D9929D6C-B874-4952-BC38-AC239C9CFB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9929D6C-B874-4952-BC38-AC239C9CFB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9929D6C-B874-4952-BC38-AC239C9CFB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9929D6C-B874-4952-BC38-AC239C9CFB8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="NearlekeayiRemnelakair.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->

<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;

using NearlekeayiRemnelakair.ViewModels;
using NearlekeayiRemnelakair.Views;

namespace NearlekeayiRemnelakair;

public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}

public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
DataContext = new MainViewModel()
};
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
{
singleViewPlatform.MainView = new MainView
{
DataContext = new MainViewModel()
};
}

base.OnFrameworkInitializationCompleted();
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Skia" Version="11.1.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace NearlekeayiRemnelakair.ViewModels;

public class MainViewModel : ViewModelBase
{
public string Greeting => "Welcome to Avalonia!";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using ReactiveUI;

namespace NearlekeayiRemnelakair.ViewModels;

public class ViewModelBase : ReactiveObject
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:NearlekeayiRemnelakair.ViewModels"
xmlns:views="clr-namespace:NearlekeayiRemnelakair.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="NearlekeayiRemnelakair.Views.MainView"
x:DataType="vm:MainViewModel">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<vm:MainViewModel />
</Design.DataContext>

<Grid>
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<views:Foo/>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.Rendering.SceneGraph;
using Avalonia.Skia;

namespace NearlekeayiRemnelakair.Views;

public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
}
}

class Foo : Control
{
public override void Render(DrawingContext context)
{
context.Custom(new C());
base.Render(context);
}
}

class C : ICustomDrawOperation
{
public void Dispose()
{

}

public bool Equals(ICustomDrawOperation? other)
{
return ReferenceEquals(this, other);
}

public bool HitTest(Point p)
{
return false;
}

public void Render(ImmediateDrawingContext context)
{
var leaseFeature = context.TryGetFeature<ISkiaSharpApiLeaseFeature>();
if (leaseFeature != null)
{
var skiaSharpApiLease = leaseFeature.Lease();
var skSurface = skiaSharpApiLease.SkSurface;
var canvas = skiaSharpApiLease.SkCanvas;
}
}

public Rect Bounds { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:NearlekeayiRemnelakair.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:NearlekeayiRemnelakair.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="NearlekeayiRemnelakair.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="NearlekeayiRemnelakair">
<views:MainView />
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Avalonia.Controls;

namespace NearlekeayiRemnelakair.Views;

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

0 comments on commit 29b7db1

Please sign in to comment.