59 changed files with 362 additions and 461 deletions
@ -0,0 +1,7 @@ |
|||
- build/ |
|||
|
|||
**/lib/**/*.dll |
|||
**/lib/**/*.xml |
|||
**/build/**/*.dll |
|||
**/build/**/*.xml |
|||
*.nupkg |
|||
@ -0,0 +1,24 @@ |
|||
<?xml version="1.0"?> |
|||
<package > |
|||
<metadata> |
|||
<id>Perspex</id> |
|||
<version>0.0.1-alpha</version> |
|||
<authors>stevenk</authors> |
|||
<owners>stevenk</owners> |
|||
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl> |
|||
<projectUrl>https://github.com/grokys/Perspex/</projectUrl> |
|||
<requireLicenseAcceptance>false</requireLicenseAcceptance> |
|||
<description>The Perspex UI framework</description> |
|||
<releaseNotes>Initial alpha release.</releaseNotes> |
|||
<copyright>Copyright 2015</copyright> |
|||
<tags>Perspex</tags> |
|||
<dependencies> |
|||
<dependency id="Glass" version="1.4.4.0" /> |
|||
<dependency id="OmniXaml" version="1.4.4.0" /> |
|||
<dependency id="reactiveui" version="6.5.0" /> |
|||
<dependency id="reactiveui-core" version="6.5.0" /> |
|||
<dependency id="Serilog" version="1.5.9" /> |
|||
<dependency id="Splat" version="1.6.2" /> |
|||
</dependencies> |
|||
</metadata> |
|||
</package> |
|||
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup Condition="'$(MSBuildThisFileDirectory)' != '' And HasTrailingSlash('$(MSBuildThisFileDirectory)')"> |
|||
<PlatformLibs Include="$(MSBuildThisFileDirectory)**\*.dll" /> |
|||
<Content Include="@(PlatformLibs)"> |
|||
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link> |
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|||
</Content> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,39 @@ |
|||
SET lib="Perspex\lib\portable-windows8+net45" |
|||
SET build="Perspex\build\net45" |
|||
|
|||
mkdir %lib% |
|||
mkdir %build% |
|||
|
|||
copy ..\src\Perspex.Animation\bin\Release\Perspex.Animation.dll %lib% |
|||
copy ..\src\Perspex.Animation\bin\Release\Perspex.Animation.xml %lib% |
|||
copy ..\src\Perspex.Application\bin\Release\Perspex.Application.dll %lib% |
|||
copy ..\src\Perspex.Application\bin\Release\Perspex.Application.xml %lib% |
|||
copy ..\src\Perspex.Base\bin\Release\Perspex.Base.dll %lib% |
|||
copy ..\src\Perspex.Base\bin\Release\Perspex.Base.xml %lib% |
|||
copy ..\src\Perspex.Controls\bin\Release\Perspex.Controls.dll %lib% |
|||
copy ..\src\Perspex.Controls\bin\Release\Perspex.Controls.xml %lib% |
|||
copy ..\src\Perspex.Diagnostics\bin\Release\\Perspex.Diagnostics.dll %lib% |
|||
copy ..\src\Perspex.Diagnostics\bin\Release\\Perspex.Diagnostics.xml %lib% |
|||
copy ..\src\Perspex.Input\bin\Release\Perspex.Input.dll %lib% |
|||
copy ..\src\Perspex.Input\bin\Release\Perspex.Input.xml %lib% |
|||
copy ..\src\Perspex.Interactivity\bin\Release\Perspex.Interactivity.dll %lib% |
|||
copy ..\src\Perspex.Interactivity\bin\Release\Perspex.Interactivity.xml %lib% |
|||
copy ..\src\Perspex.Layout\bin\Release\Perspex.Layout.dll %lib% |
|||
copy ..\src\Perspex.Layout\bin\Release\Perspex.Layout.xml %lib% |
|||
copy ..\src\Perspex.SceneGraph\bin\Release\Perspex.SceneGraph.dll %lib% |
|||
copy ..\src\Perspex.SceneGraph\bin\Release\Perspex.SceneGraph.xml %lib% |
|||
copy ..\src\Perspex.Styling\bin\Release\Perspex.Styling.dll %lib% |
|||
copy ..\src\Perspex.Styling\bin\Release\Perspex.Styling.xml %lib% |
|||
copy ..\src\Perspex.Themes.Default\bin\Release\Perspex.Themes.Default.dll %lib% |
|||
copy ..\src\Perspex.Themes.Default\bin\Release\Perspex.Themes.Default.xml %lib% |
|||
copy ..\src\Markup\Perspex.Markup.Xaml\bin\Release\Perspex.Markup.Xaml.dll %lib% |
|||
copy ..\src\Markup\Perspex.Markup.Xaml\bin\Release\Perspex.Markup.Xaml.xml %lib% |
|||
copy ..\src\NGenerics\bin\Release\NGenerics.dll %lib% |
|||
|
|||
copy ..\src\Windows\Perspex.Direct2D1\bin\Release\Perspex.Direct2D1.dll %build% |
|||
copy ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.dll %build% |
|||
copy ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.Direct2D1.dll %build% |
|||
copy ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.DXGI.dll %build% |
|||
copy ..\src\Windows\Perspex.Win32\bin\Release\Perspex.Win32.dll %build% |
|||
|
|||
nuget.exe pack Perspex\Perspex.nuspec |
|||
@ -1,15 +1,27 @@ |
|||
namespace XamlTestApplication.Views |
|||
{ |
|||
using OmniXaml.AppServices.Mvvm; |
|||
using System; |
|||
using System.Globalization; |
|||
using System.IO; |
|||
using System.Reflection; |
|||
using System.Resources; |
|||
using OmniXaml; |
|||
using Perspex.Controls; |
|||
using Perspex.Diagnostics; |
|||
using Perspex.Xaml.Desktop; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
[ViewToken("Main", typeof(MainWindow))] |
|||
public class MainWindow : PerspexWindow |
|||
public class MainWindow : Window |
|||
{ |
|||
public MainWindow() |
|||
{ |
|||
this.InitializeComponent(); |
|||
|
|||
DevTools.Attach(this); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Context |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using System; |
|||
using OmniXaml; |
|||
@ -1,19 +1,23 @@ |
|||
namespace Perspex.Xaml.Desktop |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using Context; |
|||
using HighLevel; |
|||
using OmniXaml; |
|||
using OmniXaml.ObjectAssembler; |
|||
using OmniXaml.Parsers.ProtoParser; |
|||
using OmniXaml.Parsers.XamlNodes; |
|||
using Perspex.Markup.Xaml.Context; |
|||
|
|||
public class PerspexParserFactory : IXamlParserFactory |
|||
{ |
|||
private readonly IWiringContext wiringContext; |
|||
|
|||
public PerspexParserFactory() |
|||
: this(new TypeFactory()) |
|||
{ |
|||
} |
|||
|
|||
public PerspexParserFactory(ITypeFactory typeFactory) |
|||
{ |
|||
wiringContext = PerspexWiringContextFactory.GetContext(typeFactory); |
|||
wiringContext = new PerspexWiringContext(typeFactory); |
|||
} |
|||
|
|||
public IXamlParser CreateForReadingFree() |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Context |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using System; |
|||
using DataBinding; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Context |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Context |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using DataBinding; |
|||
using OmniXaml; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Context |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Context |
|||
namespace Perspex.Markup.Xaml.Context |
|||
{ |
|||
using System; |
|||
using DataBinding; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Converters |
|||
namespace Perspex.Markup.Xaml.Converters |
|||
{ |
|||
using System; |
|||
using System.Globalization; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Converters |
|||
namespace Perspex.Markup.Xaml.Converters |
|||
{ |
|||
using System; |
|||
using System.Globalization; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Converters |
|||
namespace Perspex.Markup.Xaml.Converters |
|||
{ |
|||
using System; |
|||
using System.Globalization; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Converters |
|||
namespace Perspex.Markup.Xaml.Converters |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding.ChangeTracking |
|||
namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding.ChangeTracking |
|||
namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking |
|||
{ |
|||
using System; |
|||
using System.Reflection; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding.ChangeTracking |
|||
namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking |
|||
{ |
|||
public class PropertyPath |
|||
{ |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding.ChangeTracking |
|||
namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking |
|||
{ |
|||
using System; |
|||
using System.Reflection; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
using System; |
|||
using System.Diagnostics; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
using System.Collections.Generic; |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
using System; |
|||
using System.ComponentModel; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
public class TargetBindingEndpoint |
|||
{ |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
using System; |
|||
using System.Diagnostics; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.DataBinding |
|||
namespace Perspex.Markup.Xaml.DataBinding |
|||
{ |
|||
using ChangeTracking; |
|||
using Controls; |
|||
@ -0,0 +1,14 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="GlobalSuppressions.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( |
|||
"StyleCop.CSharp.MaintainabilityRules", |
|||
"SA1401:Fields must be private", |
|||
Justification = "PerspexProperty fields should not be private.")] |
|||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( |
|||
"StyleCop.CSharp.DocumentationRules", |
|||
"SA1609:Property documentation must have value", |
|||
Justification = "This rule is fscking pointless")] |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.MarkupExtensions |
|||
namespace Perspex.Markup.Xaml.MarkupExtensions |
|||
{ |
|||
using System.Linq; |
|||
using Controls; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.MarkupExtensions |
|||
namespace Perspex.Markup.Xaml.MarkupExtensions |
|||
{ |
|||
using System; |
|||
using Glass; |
|||
@ -0,0 +1,109 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="PerspexXamlLoader.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
namespace Perspex.Markup.Xaml |
|||
{ |
|||
using System; |
|||
using System.Reflection; |
|||
using OmniXaml; |
|||
using Perspex.Markup.Xaml.Context; |
|||
using Platform; |
|||
using Splat; |
|||
|
|||
/// <summary>
|
|||
/// Loads XAML for a perspex application.
|
|||
/// </summary>
|
|||
public class PerspexXamlLoader : XamlLoader |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PerspexXamlLoader"/> class.
|
|||
/// </summary>
|
|||
public PerspexXamlLoader() |
|||
: this(new PerspexParserFactory()) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PerspexXamlLoader"/> class.
|
|||
/// </summary>
|
|||
/// <param name="xamlParserFactory">The parser factory to use.</param>
|
|||
public PerspexXamlLoader(IXamlParserFactory xamlParserFactory) |
|||
: base(xamlParserFactory) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Loads the XAML into a Perspex component.
|
|||
/// </summary>
|
|||
/// <param name="obj">The object to load the XAML into.</param>
|
|||
public static void Load(object obj) |
|||
{ |
|||
var loader = new PerspexXamlLoader(); |
|||
loader.Load(obj.GetType(), obj); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Loads the XAML for a type.
|
|||
/// </summary>
|
|||
/// <param name="type">The type.</param>
|
|||
/// <param name="rootInstance">
|
|||
/// The optional instance into which the XAML should be loaded.
|
|||
/// </param>
|
|||
/// <returns>The loaded object.</returns>
|
|||
public object Load(Type type, object rootInstance = null) |
|||
{ |
|||
return this.Load(GetUriFor(type), rootInstance); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Loads XAML from a URI.
|
|||
/// </summary>
|
|||
/// <param name="uri">The URI of the XAML file.</param>
|
|||
/// <param name="rootInstance">
|
|||
/// The optional instance into which the XAML should be loaded.
|
|||
/// </param>
|
|||
/// <returns>The loaded object.</returns>
|
|||
public object Load(Uri uri, object rootInstance = null) |
|||
{ |
|||
var assetLocator = Locator.Current.GetService<IAssetLoader>(); |
|||
|
|||
if (assetLocator == null) |
|||
{ |
|||
throw new InvalidOperationException( |
|||
"Could not create IAssetLoader : maybe Application.RegisterServices() wasn't called?"); |
|||
} |
|||
|
|||
using (var stream = assetLocator.Open(uri)) |
|||
{ |
|||
return this.Load(stream, rootInstance); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the URI for a type.
|
|||
/// </summary>
|
|||
/// <param name="type">The type.</param>
|
|||
/// <returns>The URI.</returns>
|
|||
private static Uri GetUriFor(Type type) |
|||
{ |
|||
if (type.Namespace != null) |
|||
{ |
|||
var toRemove = type.GetTypeInfo().Assembly.GetName().Name; |
|||
var substracted = toRemove.Length < type.Namespace.Length ? type.Namespace.Remove(0, toRemove.Length + 1) : ""; |
|||
var replace = substracted.Replace('.', '/'); |
|||
|
|||
if (replace != string.Empty) |
|||
{ |
|||
replace = replace + "/"; |
|||
} |
|||
|
|||
return new Uri(replace + type.Name + ".xaml", UriKind.Relative); |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Templates |
|||
namespace Perspex.Markup.Xaml.Templates |
|||
{ |
|||
public class Template |
|||
{ |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Templates |
|||
namespace Perspex.Markup.Xaml.Templates |
|||
{ |
|||
using System.Collections.Generic; |
|||
using Context; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Templates |
|||
namespace Perspex.Markup.Xaml.Templates |
|||
{ |
|||
using System.Collections.Generic; |
|||
using OmniXaml; |
|||
@ -1,4 +1,4 @@ |
|||
namespace Perspex.Xaml.Templates |
|||
namespace Perspex.Markup.Xaml.Templates |
|||
{ |
|||
using System; |
|||
using Controls.Templates; |
|||
@ -1,78 +0,0 @@ |
|||
namespace Perspex.Xaml.Desktop |
|||
{ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Resources; |
|||
using OmniXaml.AppServices; |
|||
|
|||
public class InflatableResourceTranslator : IInflatableTranslator |
|||
{ |
|||
public Stream GetStream(Type type) |
|||
{ |
|||
var uri = GetUriFor(type); |
|||
var assembly = Assembly.GetEntryAssembly(); |
|||
var resourceName = assembly.GetName().Name + ".g"; |
|||
var manager = new ResourceManager(resourceName, assembly); |
|||
|
|||
using (ResourceSet resourceSet = manager.GetResourceSet(CultureInfo.CurrentCulture, true, true)) |
|||
{ |
|||
Stream s = (Stream)resourceSet.GetObject(uri.ToString(), true); |
|||
|
|||
if (s == null) |
|||
{ |
|||
throw new IOException( |
|||
"The requested resource could not be found: " + |
|||
uri.OriginalString); |
|||
} |
|||
|
|||
return s; |
|||
} |
|||
} |
|||
|
|||
private static Uri GetUriFor(Type type) |
|||
{ |
|||
if (type.Namespace != null) |
|||
{ |
|||
var toRemove = type.Assembly.GetName().Name; |
|||
var substracted = toRemove.Length < type.Namespace.Length ? type.Namespace.Remove(0, toRemove.Length + 1) : ""; |
|||
var replace = substracted.Replace('.', Path.PathSeparator); |
|||
if (replace != string.Empty) |
|||
{ |
|||
replace = replace + "/"; |
|||
} |
|||
return new Uri(replace + type.Name + ".xaml", UriKind.Relative); |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public Type GetTypeFor(Uri uri) |
|||
{ |
|||
var withExt = uri.OriginalString; |
|||
var lastSlash = withExt.LastIndexOf("/", StringComparison.Ordinal); |
|||
var innerNs = withExt.Substring(0, lastSlash); |
|||
var fileName = withExt.Substring(lastSlash + 1, withExt.Length - lastSlash - 1); |
|||
|
|||
var className = fileName.Substring(0, fileName.LastIndexOf('.')); |
|||
|
|||
|
|||
var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList(); |
|||
var type = from assembly in assemblies |
|||
let t = assembly.GetType(GetName(assembly, innerNs, className)) |
|||
where t != null |
|||
select t; |
|||
|
|||
return type.First(); |
|||
} |
|||
|
|||
private static string GetName(Assembly assembly, string innerNs, string className) |
|||
{ |
|||
var ns = assembly.GetName().Name + "." + innerNs; |
|||
var fullLocator = ns + "." + className; |
|||
return fullLocator; |
|||
} |
|||
} |
|||
} |
|||
@ -1,187 +0,0 @@ |
|||
<?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> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{EB468C39-AAC4-4963-A7B2-0A405EA63EDD}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>Perspex.Xaml.Desktop</RootNamespace> |
|||
<AssemblyName>Perspex.Xaml.Desktop</AssemblyName> |
|||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<TargetFrameworkProfile /> |
|||
<NuGetPackageImportStamp> |
|||
</NuGetPackageImportStamp> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="Glass, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Glass.1.4.4.0\lib\portable-net451+win81+wpa81\Glass.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="OmniXaml, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\OmniXaml.1.4.4.0\lib\portable-net451+win81+wpa81\OmniXaml.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="OmniXaml.AppServices, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\OmniXaml.AppServices.1.4.4.0\lib\portable-net451+win81+wpa81\OmniXaml.AppServices.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="OmniXaml.AppServices.Mvvm, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\OmniXaml.AppServices.Mvvm.1.4.4.0\lib\portable-net451+win81+wpa81\OmniXaml.AppServices.Mvvm.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="OmniXaml.AppServices.NetCore, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\OmniXaml.AppServices.NetCore.1.4.4.0\lib\net46\OmniXaml.AppServices.NetCore.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="ReactiveUI, Version=6.5.0.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\reactiveui-core.6.5.0\lib\Net45\ReactiveUI.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="Serilog, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Serilog.1.5.9\lib\net45\Serilog.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="Serilog.FullNetFx, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Serilog.1.5.9\lib\net45\Serilog.FullNetFx.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="SharpDX, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL"> |
|||
<SpecificVersion>False</SpecificVersion> |
|||
<HintPath>$(SharpDXPackageBinDir)\SharpDX.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="SharpDX.Direct2D1, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL"> |
|||
<SpecificVersion>False</SpecificVersion> |
|||
<HintPath>$(SharpDXPackageBinDir)\SharpDX.Direct2D1.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="SharpDX.DXGI, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL"> |
|||
<SpecificVersion>False</SpecificVersion> |
|||
<HintPath>$(SharpDXPackageBinDir)\SharpDX.DXGI.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="Sprache, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Sprache.SuperJMN.2.0.0.46\lib\portable-net451+win81+wpa81\Sprache.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Drawing" /> |
|||
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="System.Reactive.Windows.Threading, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\packages\Rx-XAML.2.2.5\lib\net45\System.Reactive.Windows.Threading.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="System.Windows.Forms" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Net.Http" /> |
|||
<Reference Include="System.Xml" /> |
|||
<Reference Include="WindowsBase" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="..\..\Shared\SharedAssemblyInfo.cs"> |
|||
<Link>Properties\SharedAssemblyInfo.cs</Link> |
|||
</Compile> |
|||
<Compile Include="PerspexInflatableTypeFactory.cs" /> |
|||
<Compile Include="PerspexParserFactory.cs" /> |
|||
<Compile Include="PerspexWindow.cs" /> |
|||
<Compile Include="PerspexXamlLoader.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="InflatableResourceTranslator.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\Perspex.Animation\Perspex.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Perspex.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.Base\Perspex.Base.csproj"> |
|||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|||
<Name>Perspex.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.Controls\Perspex.Controls.csproj"> |
|||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|||
<Name>Perspex.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.Input\Perspex.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Perspex.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.Interactivity\Perspex.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Perspex.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.Layout\Perspex.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Perspex.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.SceneGraph\Perspex.SceneGraph.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Perspex.SceneGraph</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\Perspex.Styling\Perspex.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Perspex.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\Perspex.Xaml\Perspex.Xaml.csproj"> |
|||
<Project>{3E53A01A-B331-47F3-B828-4A5717E77A24}</Project> |
|||
<Name>Perspex.Xaml</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="packages.config" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<Import Project="..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets" Condition="Exists('..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" /> |
|||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
|||
<PropertyGroup> |
|||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
|||
</PropertyGroup> |
|||
<Error Condition="!Exists('..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets'))" /> |
|||
</Target> |
|||
<!-- 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> |
|||
@ -1,17 +0,0 @@ |
|||
namespace Perspex.Xaml.Desktop |
|||
{ |
|||
using System; |
|||
using System.Collections.ObjectModel; |
|||
using Controls; |
|||
using OmniXaml; |
|||
using OmniXaml.AppServices; |
|||
using OmniXaml.AppServices.NetCore; |
|||
|
|||
public class PerspexInflatableTypeFactory : InflatableTypeFactory |
|||
{ |
|||
public PerspexInflatableTypeFactory() : base(new TypeFactory(), new InflatableResourceTranslator(), typeFactory => new PerspexXamlLoader(typeFactory)) |
|||
{ |
|||
Inflatables = new Collection<Type> { typeof(Window), typeof(UserControl) }; |
|||
} |
|||
} |
|||
} |
|||
@ -1,13 +0,0 @@ |
|||
namespace Perspex.Xaml.Desktop |
|||
{ |
|||
using Controls; |
|||
using OmniXaml.AppServices.Mvvm; |
|||
|
|||
public class PerspexWindow : Window, IView |
|||
{ |
|||
public void SetViewModel(object viewModel) |
|||
{ |
|||
this.DataContext = viewModel; |
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
namespace Perspex.Xaml.Desktop |
|||
{ |
|||
using OmniXaml; |
|||
|
|||
public class PerspexXamlLoader : XamlLoader |
|||
{ |
|||
public PerspexXamlLoader(ITypeFactory typeFactory) : base(new PerspexParserFactory(typeFactory)) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="AssemblyInfo.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
using System.Reflection; |
|||
|
|||
[assembly: AssemblyTitle("Perspex.Xaml.Desktop")] |
|||
@ -1,23 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="Glass" version="1.4.4.0" targetFramework="net46" /> |
|||
<package id="OmniXaml" version="1.4.4.0" targetFramework="net46" /> |
|||
<package id="OmniXaml.AppServices" version="1.4.4.0" targetFramework="net46" /> |
|||
<package id="OmniXaml.AppServices.Mvvm" version="1.4.4.0" targetFramework="net46" /> |
|||
<package id="OmniXaml.AppServices.NetCore" version="1.4.4.0" targetFramework="net46" /> |
|||
<package id="reactiveui" version="6.5.0" targetFramework="net46" /> |
|||
<package id="reactiveui-core" version="6.5.0" targetFramework="net46" /> |
|||
<package id="Rx-Core" version="2.2.5" targetFramework="net46" /> |
|||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net46" /> |
|||
<package id="Rx-Linq" version="2.2.5" targetFramework="net46" /> |
|||
<package id="Rx-Main" version="2.2.5" targetFramework="net46" /> |
|||
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net46" /> |
|||
<package id="Rx-XAML" version="2.2.5" targetFramework="net46" /> |
|||
<package id="Serilog" version="1.5.9" targetFramework="net46" /> |
|||
<package id="SharpDX" version="2.6.3" targetFramework="net46" /> |
|||
<package id="SharpDX.Direct2D1" version="2.6.3" targetFramework="net46" /> |
|||
<package id="SharpDX.DXGI" version="2.6.3" targetFramework="net46" /> |
|||
<package id="Splat" version="1.6.2" targetFramework="net46" /> |
|||
<package id="Sprache" version="2.0.0.46" targetFramework="net46" /> |
|||
<package id="Sprache.SuperJMN" version="2.0.0.46" targetFramework="net46" /> |
|||
</packages> |
|||
@ -1,10 +0,0 @@ |
|||
namespace Perspex.Xaml.HighLevel |
|||
{ |
|||
using System; |
|||
using System.IO; |
|||
|
|||
public interface IResourceProvider |
|||
{ |
|||
Stream GetStream(Uri uri); |
|||
} |
|||
} |
|||
@ -1,20 +0,0 @@ |
|||
namespace Perspex.Xaml.HighLevel |
|||
{ |
|||
using Context; |
|||
using OmniXaml; |
|||
|
|||
public static class PerspexWiringContextFactory |
|||
{ |
|||
private static IWiringContext context; |
|||
|
|||
public static IWiringContext GetContext(ITypeFactory factory) |
|||
{ |
|||
if (context == null) |
|||
{ |
|||
context = new PerspexWiringContext(factory); |
|||
} |
|||
|
|||
return context; |
|||
} |
|||
} |
|||
} |
|||
@ -1,21 +0,0 @@ |
|||
namespace Perspex.Xaml.HighLevel |
|||
{ |
|||
using OmniXaml; |
|||
using Context; |
|||
using OmniXaml.ObjectAssembler; |
|||
|
|||
public class PerspexObjectAssemblerFactory : IObjectAssemblerFactory |
|||
{ |
|||
private readonly WiringContext context; |
|||
|
|||
public PerspexObjectAssemblerFactory(WiringContext context) |
|||
{ |
|||
this.context = context; |
|||
} |
|||
|
|||
public IObjectAssembler CreateAssembler(ObjectAssemblerSettings settings) |
|||
{ |
|||
return new PerspexObjectAssembler(context, settings); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="IAssetLoader.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
namespace Perspex.Platform |
|||
{ |
|||
using System; |
|||
using System.IO; |
|||
|
|||
/// <summary>
|
|||
/// Loads assets compiled into the application binary.
|
|||
/// </summary>
|
|||
public interface IAssetLoader |
|||
{ |
|||
/// <summary>
|
|||
/// Opens the resource with the requested URI.
|
|||
/// </summary>
|
|||
/// <param name="uri">The URI.</param>
|
|||
/// <returns>A stream containing the resource contents.</returns>
|
|||
/// <exception cref="FileNotFoundException">
|
|||
/// The resource was not found.
|
|||
/// </exception>
|
|||
Stream Open(Uri uri); |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="AssetLoader.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
namespace Perspex.Win32 |
|||
{ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.IO; |
|||
using System.Reflection; |
|||
using System.Resources; |
|||
using Perspex.Platform; |
|||
|
|||
/// <summary>
|
|||
/// Loads assets compiled into the application binary.
|
|||
/// </summary>
|
|||
public class AssetLoader : IAssetLoader |
|||
{ |
|||
/// <summary>
|
|||
/// Opens the resource with the requested URI.
|
|||
/// </summary>
|
|||
/// <param name="uri">The URI.</param>
|
|||
/// <returns>A stream containing the resource contents.</returns>
|
|||
/// <exception cref="FileNotFoundException">
|
|||
/// The resource was not found.
|
|||
/// </exception>
|
|||
public Stream Open(Uri uri) |
|||
{ |
|||
var assembly = Assembly.GetEntryAssembly(); |
|||
var resourceName = assembly.GetName().Name + ".g"; |
|||
var manager = new ResourceManager(resourceName, assembly); |
|||
|
|||
using (var resourceSet = manager.GetResourceSet(CultureInfo.CurrentCulture, true, true)) |
|||
{ |
|||
var stream = (Stream)resourceSet.GetObject(uri.ToString(), true); |
|||
|
|||
if (stream == null) |
|||
{ |
|||
throw new FileNotFoundException($"The requested asset could not be found: {uri}"); |
|||
} |
|||
|
|||
return stream; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue