17 changed files with 3240 additions and 90 deletions
@ -0,0 +1,94 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
|
<PropertyGroup> |
||||
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> |
||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
|
<ProjectGuid>{40759A76-D0F2-464E-8000-6FF0F5C4BD7C}</ProjectGuid> |
||||
|
<OutputType>Library</OutputType> |
||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
|
<RootNamespace>Avalonia.Win32</RootNamespace> |
||||
|
<AssemblyName>Avalonia.Win32</AssemblyName> |
||||
|
<DefaultLanguage>en-US</DefaultLanguage> |
||||
|
<FileAlignment>512</FileAlignment> |
||||
|
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
|
<TargetFrameworkProfile> |
||||
|
</TargetFrameworkProfile> |
||||
|
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
|
<DebugSymbols>true</DebugSymbols> |
||||
|
<DebugType>full</DebugType> |
||||
|
<Optimize>false</Optimize> |
||||
|
<OutputPath>bin\Debug\</OutputPath> |
||||
|
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
|
<DebugType>pdbonly</DebugType> |
||||
|
<Optimize>true</Optimize> |
||||
|
<OutputPath>bin\Release\</OutputPath> |
||||
|
<DefineConstants>TRACE;NETSTANDARD</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<!-- A reference to the entire .NET Framework is automatically included --> |
||||
|
<Folder Include="Properties\" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\Avalonia.Animation\Avalonia.Animation.csproj"> |
||||
|
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
||||
|
<Name>Avalonia.Animation</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Base\Avalonia.Base.csproj"> |
||||
|
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
||||
|
<Name>Avalonia.Base</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Controls\Avalonia.Controls.csproj"> |
||||
|
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
||||
|
<Name>Avalonia.Controls</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Input\Avalonia.Input.csproj"> |
||||
|
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
||||
|
<Name>Avalonia.Input</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
||||
|
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
||||
|
<Name>Avalonia.Interactivity</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Layout\Avalonia.Layout.csproj"> |
||||
|
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
||||
|
<Name>Avalonia.Layout</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Styling\Avalonia.Styling.csproj"> |
||||
|
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
||||
|
<Name>Avalonia.Styling</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\..\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
||||
|
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
||||
|
<Name>Avalonia.Visuals</Name> |
||||
|
</ProjectReference> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<Compile Include="IconImpl.cs" /> |
||||
|
<Compile Include="NativeWin32Platform.cs" /> |
||||
|
<Compile Include="Win32Exception.cs" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<None Include="project.json" /> |
||||
|
</ItemGroup> |
||||
|
<Import Project="..\Avalonia.Win32\Avalonia.Win32.Shared.projitems" Label="Shared" /> |
||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> |
||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
|
Other similar extension points exist, see Microsoft.Common.targets. |
||||
|
<Target Name="BeforeBuild"> |
||||
|
</Target> |
||||
|
<Target Name="AfterBuild"> |
||||
|
</Target> |
||||
|
--> |
||||
|
</Project> |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Avalonia.Platform; |
||||
|
|
||||
|
namespace Avalonia.Win32 |
||||
|
{ |
||||
|
public class IconImpl : IWindowIconImpl |
||||
|
{ |
||||
|
public IntPtr HIcon { get; set; } |
||||
|
public void Save(Stream outputStream) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Avalonia.Platform; |
||||
|
|
||||
|
namespace Avalonia.Win32 |
||||
|
{ |
||||
|
partial class Win32Platform |
||||
|
{ |
||||
|
//TODO: An actual implementation
|
||||
|
public IWindowIconImpl LoadIcon(string fileName) => new IconImpl(); |
||||
|
|
||||
|
public IWindowIconImpl LoadIcon(Stream stream) => new IconImpl(); |
||||
|
|
||||
|
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap) => new IconImpl(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Avalonia.Win32.NetStandard |
||||
|
{ |
||||
|
class AvaloniaWin32Exception : Exception |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"supports": {}, |
||||
|
"dependencies": { |
||||
|
"Microsoft.NETCore.Portable.Compatibility": "1.0.1", |
||||
|
"NETStandard.Library": "1.6.0", |
||||
|
"System.Reactive.Core": "3.1.1" |
||||
|
}, |
||||
|
"frameworks": { |
||||
|
"netstandard1.1": {} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,31 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<PropertyGroup> |
||||
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> |
||||
|
<HasSharedItems>true</HasSharedItems> |
||||
|
<SharedGUID>9defc6b7-845b-4d8f-afc0-d32bf0032b8c</SharedGUID> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Label="Configuration"> |
||||
|
<Import_RootNamespace>Avalonia.Win32.Shared</Import_RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)ClipboardImpl.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)CursorFactory.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)FramebufferManager.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)Input\KeyInterop.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)Input\WindowsKeyboardDevice.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)Input\WindowsMouseDevice.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)Interop\UnmanagedMethods.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)PlatformConstants.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)PopupImpl.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)Properties\AssemblyInfo.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)RenderLoop.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)SystemDialogImpl.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)Win32Platform.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)WindowFramebuffer.cs" /> |
||||
|
<Compile Include="$(MSBuildThisFileDirectory)WindowImpl.cs" /> |
||||
|
<Compile Include="..\..\Shared\SharedAssemblyInfo.cs"> |
||||
|
<Link>Properties\SharedAssemblyInfo.cs</Link> |
||||
|
</Compile> |
||||
|
</ItemGroup> |
||||
|
</Project> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<PropertyGroup Label="Globals"> |
||||
|
<ProjectGuid>9defc6b7-845b-4d8f-afc0-d32bf0032b8c</ProjectGuid> |
||||
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> |
||||
|
</PropertyGroup> |
||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" /> |
||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" /> |
||||
|
<PropertyGroup /> |
||||
|
<Import Project="Avalonia.Win32.Shared.projitems" Label="Shared" /> |
||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" /> |
||||
|
</Project> |
||||
@ -0,0 +1,47 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Avalonia.Platform; |
||||
|
|
||||
|
namespace Avalonia.Win32 |
||||
|
{ |
||||
|
partial class Win32Platform |
||||
|
{ |
||||
|
public IWindowIconImpl LoadIcon(string fileName) |
||||
|
{ |
||||
|
using (var stream = File.OpenRead(fileName)) |
||||
|
{ |
||||
|
return CreateImpl(stream); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public IWindowIconImpl LoadIcon(Stream stream) |
||||
|
{ |
||||
|
return CreateImpl(stream); |
||||
|
} |
||||
|
|
||||
|
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap) |
||||
|
{ |
||||
|
using (var memoryStream = new MemoryStream()) |
||||
|
{ |
||||
|
bitmap.Save(memoryStream); |
||||
|
return new IconImpl(new System.Drawing.Bitmap(memoryStream)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static IconImpl CreateImpl(Stream stream) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
return new IconImpl(new System.Drawing.Icon(stream)); |
||||
|
} |
||||
|
catch (ArgumentException) |
||||
|
{ |
||||
|
return new IconImpl(new System.Drawing.Bitmap(stream)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue