forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52e12a2
commit 160613b
Showing
46 changed files
with
673 additions
and
558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Uno.UI.Runtime.Skia; | ||
|
||
namespace SkiaSharpExample | ||
{ | ||
class MainClass | ||
{ | ||
static SamplesApp.App? _app; | ||
|
||
[STAThread] | ||
public static void Main(string[] args) | ||
{ | ||
SamplesApp.App.ConfigureLogging(); // Enable tracing of the host | ||
|
||
var host = SkiaHostBuilder.Create() | ||
.App(() => _app = new SamplesApp.App()) | ||
.AfterInit(() => | ||
{ | ||
if (_app is not null && OperatingSystem.IsWindows()) | ||
{ | ||
_app.MainWindowActivated += delegate | ||
{ | ||
var windowContent = System.Windows.Application.Current.Windows[0].Content; | ||
Assert.IsInstanceOfType(windowContent, typeof(System.Windows.UIElement)); | ||
var windowContentAsUIElement = (System.Windows.UIElement)windowContent; | ||
Assert.IsTrue(windowContentAsUIElement.IsFocused); | ||
}; | ||
} | ||
}) | ||
.UseX11() | ||
.UseLinuxFrameBuffer() | ||
.UseWindows(b => b | ||
.WpfApplication(() => | ||
{ | ||
// optional app creation | ||
return new System.Windows.Application(); | ||
})) | ||
.UseMacOS() | ||
.Build(); | ||
|
||
host.Run(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/SamplesApp/SamplesApp.Skia.Generic/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"profiles": { | ||
"SamplesApp.Skia.Generic": { | ||
"commandName": "Project", | ||
"nativeDebugging": false, | ||
"environmentVariables": { | ||
//"COREHOST_TRACE": "1", | ||
//"COREHOST_TRACE_VERBOSITY": "4" | ||
// "DOTNET_ADDITIONAL_DEPS": "C:\\Program Files\\dotnet\\shared\\Microsoft.WindowsDesktop.App\\8.0.2\\Microsoft.WindowsDesktop.App.deps.json" | ||
} | ||
}, | ||
"WSL": { | ||
"commandName": "WSL2", | ||
"distributionName": "" | ||
} | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
src/SamplesApp/SamplesApp.Skia.Generic/SamplesApp.Skia.Generic.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>$(NetSkiaPreviousAndCurrent)</TargetFrameworks> | ||
<RollForward>Major</RollForward> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<Import Project="../../targetframework-override.props" /> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
|
||
<!-- Required in CI to avoid dependency issues --> | ||
<PreBuildUnoUITasks>true</PreBuildUnoUITasks> | ||
|
||
<!-- | ||
Enable implicit dotnet runtime forward rolling, as the specifed target framework | ||
project may run with only a later version of the .NET runtime installed. | ||
--> | ||
<RollForward>Major</RollForward> | ||
|
||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- Required to use WPF types in the head--> | ||
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WPF" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Manifest Include="$(ApplicationManifest)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="AssemblyInfo"> | ||
<AssemblyAttribute Include="System.Runtime.InteropServices.ComVisibleAttribute"> | ||
<_Parameter1>false</_Parameter1> | ||
</AssemblyAttribute> | ||
<AssemblyAttribute Include="System.Windows.ThemeInfo"> | ||
<_Parameter1>System.Windows.ResourceDictionaryLocation.None</_Parameter1> | ||
<_Parameter1_IsLiteral>true</_Parameter1_IsLiteral> | ||
<_Parameter2>System.Windows.ResourceDictionaryLocation.SourceAssembly</_Parameter2> | ||
<_Parameter2_IsLiteral>true</_Parameter2_IsLiteral> | ||
</AssemblyAttribute> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="SkiaSharp" /> | ||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\SourceGenerators\System.Xaml\Uno.Xaml.csproj" /> | ||
<ProjectReference Include="..\..\Uno.Foundation\Uno.Foundation.Skia.csproj" /> | ||
<ProjectReference Include="..\..\Uno.UI.Runtime.Skia.Linux.FrameBuffer\Uno.UI.Runtime.Skia.Linux.FrameBuffer.csproj" /> | ||
<ProjectReference Include="..\..\Uno.UI.Runtime.Skia.MacOS\Uno.UI.Runtime.Skia.MacOS.csproj" /> | ||
<ProjectReference Include="..\..\Uno.UI.Runtime.Skia.Wpf\Uno.UI.Runtime.Skia.Wpf.csproj" /> | ||
<ProjectReference Include="..\..\Uno.UI.Runtime.Skia.X11\Uno.UI.Runtime.Skia.X11.csproj" /> | ||
<ProjectReference Include="..\..\Uno.UI\Uno.UI.Skia.csproj" /> | ||
<ProjectReference Include="..\..\Uno.UWP\Uno.Skia.csproj" /> | ||
<ProjectReference Include="..\SamplesApp.Skia\SamplesApp.Skia.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="Program.cs" /> | ||
</ItemGroup> | ||
|
||
<Import Project="..\..\..\build\nuget\*.Skia.Gtk.props" /> | ||
<Import Project="..\..\..\build\nuget\*.Skia.Gtk.targets" /> | ||
|
||
<PropertyGroup> | ||
<UnoUIMSBuildTasksPath>$(MSBuildThisFileDirectory)..\..\SourceGenerators\Uno.UI.Tasks\bin\$(Configuration)_Shadow</UnoUIMSBuildTasksPath> | ||
</PropertyGroup> | ||
|
||
<Import Project="..\..\SourceGenerators\Uno.UI.Tasks\Content\Uno.UI.Tasks.targets" Condition="'$(SkipUnoResourceGeneration)' == '' " /> | ||
<Import Project="..\..\..\build\nuget\uno.winui.runtime-replace.targets" /> | ||
|
||
<Target Name="_ValidatePublishedItems" AfterTargets="Publish"> | ||
<ItemGroup> | ||
<_validationPath Include="Uno.Fonts.Fluent/Fonts/uno-fluentui-assets.ttf" /> | ||
<_validationPath Include="Uno.UI.RuntimeTests/Assets/Fonts/uno-fluentui-assets-runtimetest01.ttf" /> | ||
</ItemGroup> | ||
|
||
<Error Condition="!exists('$(PublishDir)%(_validationPath.Identity)')" Text="Failed to find published filed: %(_validationPath.Identity)" /> | ||
</Target> | ||
|
||
<Target Name="TestBefore" BeforeTargets="_CheckForTransitiveWindowsDesktopDependencies"> | ||
<ItemGroup> | ||
<TransitiveFrameworkReference Remove="Microsoft.WindowsDesktop.App.WPF" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="TestBefore2" BeforeTargets="GenerateBuildRuntimeConfigurationFiles"> | ||
<ItemGroup> | ||
<_RuntimeFrameworkToRemove Include="@(RuntimeFramework)" Condition="'%(Identity)'=='Microsoft.WindowsDesktop.App'" /> | ||
<RuntimeFramework Remove="@(_RuntimeFrameworkToRemove)" /> | ||
</ItemGroup> | ||
</Target> | ||
</Project> |
File renamed without changes.
Oops, something went wrong.