13 changed files with 5 additions and 379 deletions
@ -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,185 +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="PerspexParserFactory.cs" /> |
|||
<Compile Include="PerspexWindow.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,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,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); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue