1
0
Steven Kirk 9 жил өмнө
parent
commit
58305ca59f

+ 3 - 0
.gitmodules

@@ -8,3 +8,6 @@
 [submodule "src/Markup/Perspex.Markup.Xaml/OmniXAML"]
 	path = src/Markup/Perspex.Markup.Xaml/OmniXAML
 	url = https://github.com/Perspex/OmniXAML.git
+[submodule "src/Markup/Perspex.Markup.Xaml/glass"]
+	path = src/Markup/Perspex.Markup.Xaml/glass
+	url = https://github.com/SuperJMN/glass

+ 0 - 3
Perspex.sln

@@ -60,9 +60,6 @@ EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Markup.Xaml", "src\Markup\Perspex.Markup.Xaml\Perspex.Markup.Xaml.csproj", "{3E53A01A-B331-47F3-B828-4A5717E77A24}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{9B9E3891-2366-4253-A952-D08BCEB71098}"
-	ProjectSection(SolutionItems) = preProject
-		samples\ControlCatalog\ControlCatalog.csproj = samples\ControlCatalog\ControlCatalog.csproj
-	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication", "samples\TestApplication\TestApplication.csproj", "{E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}"
 	ProjectSection(ProjectDependencies) = postProject

+ 20 - 1
src/Markup/Perspex.Markup.Xaml/Context/PerspexObjectAssembler.cs

@@ -7,6 +7,8 @@ using OmniXaml.ObjectAssembler;
 using OmniXaml.ObjectAssembler.Commands;
 using OmniXaml.TypeConversion;
 using Perspex.Markup.Xaml.Templates;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
 
 namespace Perspex.Markup.Xaml.Context
 {
@@ -27,7 +29,8 @@ namespace Perspex.Markup.Xaml.Context
             mapping.Map<TreeDataTemplate>(x => x.Content, new TemplateLoader());
             mapping.Map<ItemsPanelTemplate>(x => x.Content, new TemplateLoader());
 
-            var valueContext = new ValueContext(typeSource, topDownValueContext);
+            var parsingDictionary = GetDictionary(settings);
+            var valueContext = new ValueContext(typeSource, topDownValueContext, parsingDictionary);
             assembler = new ObjectAssembler(typeSource, valueContext, settings);
             objectAssembler = new TemplateHostingObjectAssembler(assembler, mapping);
         }
@@ -55,5 +58,21 @@ namespace Perspex.Markup.Xaml.Context
         {
             objectAssembler.OverrideInstance(instance);
         }
+
+        private static IReadOnlyDictionary<string, object> GetDictionary(Settings settings)
+        {
+            IReadOnlyDictionary<string, object> dict;
+
+            if (settings != null)
+            {
+                dict = settings.ParsingContext;
+            }
+            else
+            {
+                dict = new ReadOnlyDictionary<string, object>(new Dictionary<string, object>());
+            }
+
+            return dict;
+        }
     }
 }

+ 1 - 1
src/Markup/Perspex.Markup.Xaml/MarkupExtensions/StaticExtension.cs

@@ -24,7 +24,7 @@ namespace Perspex.Markup.Xaml.MarkupExtensions
 
         public override object ProvideValue(MarkupExtensionContext markupExtensionContext)
         {
-            var typeRepository = markupExtensionContext.TypeRepository;
+            var typeRepository = markupExtensionContext.ValueContext.TypeRepository;
             var typeAndMember = GetTypeAndMember(Identifier);
             var prefixAndType = GetPrefixAndType(typeAndMember.Item1);
             var xamlType = typeRepository.GetByPrefix(prefixAndType.Item1, prefixAndType.Item2);

+ 1 - 1
src/Markup/Perspex.Markup.Xaml/MarkupExtensions/TypeExtension.cs

@@ -43,7 +43,7 @@ namespace Perspex.Markup.Xaml.MarkupExtensions
                 return Type;
             }
 
-            return ResolveFromString(TypeName, markupExtensionContext.TypeRepository);
+            return ResolveFromString(TypeName, markupExtensionContext.ValueContext.TypeRepository);
         }
     }
 }

+ 1 - 1
src/Markup/Perspex.Markup.Xaml/OmniXAML

@@ -1 +1 @@
-Subproject commit 75e0dc32fe9a6d97f5b59d2b7d689db2475f444f
+Subproject commit b122549406107170bbe6e67c0d6a1a4252beef77

+ 18 - 10
src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj

@@ -81,22 +81,22 @@
     <Compile Include="Data\SourceBindingEndpoint.cs" />
     <Compile Include="Data\StyleResourceBinding.cs" />
     <Compile Include="Data\TargetBindingEndpoint.cs" />
+    <Compile Include="glass\Glass.Core\AutoKeyDictionary.cs" />
+    <Compile Include="glass\Glass.Core\DependencySorter.cs" />
+    <Compile Include="glass\Glass.Core\EnumExtensions.cs" />
+    <Compile Include="glass\Glass.Core\Extensions.cs" />
+    <Compile Include="glass\Glass.Core\Guard.cs" />
+    <Compile Include="glass\Glass.Core\IAdd.cs" />
+    <Compile Include="glass\Glass.Core\IDependency.cs" />
+    <Compile Include="glass\Glass.Core\ReflectionExtensions.cs" />
+    <Compile Include="glass\Glass.Core\StackingLinkedList.cs" />
+    <Compile Include="glass\Glass.Core\StackingLinkedListMixin.cs" />
     <Compile Include="MarkupExtensions\StyleResourceExtension.cs" />
     <Compile Include="MarkupExtensions\BindingExtension.cs" />
     <Compile Include="MarkupExtensions\RelativeSourceExtension.cs" />
     <Compile Include="MarkupExtensions\StaticExtension.cs" />
     <Compile Include="MarkupExtensions\TemplateBindingExtension.cs" />
     <Compile Include="MarkupExtensions\TypeExtension.cs" />
-    <Compile Include="OmniXAML\Source\Glass\AutoKeyDictionary.cs" />
-    <Compile Include="OmniXAML\Source\Glass\DependencySorter.cs" />
-    <Compile Include="OmniXAML\Source\Glass\EnumExtensions.cs" />
-    <Compile Include="OmniXAML\Source\Glass\Extensions.cs" />
-    <Compile Include="OmniXAML\Source\Glass\Guard.cs" />
-    <Compile Include="OmniXAML\Source\Glass\IAdd.cs" />
-    <Compile Include="OmniXAML\Source\Glass\IDependency.cs" />
-    <Compile Include="OmniXAML\Source\Glass\ReflectionExtensions.cs" />
-    <Compile Include="OmniXAML\Source\Glass\StackingLinkedList.cs" />
-    <Compile Include="OmniXAML\Source\Glass\StackingLinkedListMixin.cs" />
     <Compile Include="OmniXAML\Source\OmniXaml\Attributes\ContentPropertyAttribute.cs" />
     <Compile Include="OmniXAML\Source\OmniXaml\Attributes\DependsOnAttribute.cs" />
     <Compile Include="OmniXAML\Source\OmniXaml\Attributes\XmlnsDefinitionAttribute.cs" />
@@ -275,6 +275,7 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />
+    <None Include="glass\Glass.Core\Glass.Core.nuspec" />
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
@@ -316,6 +317,10 @@
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
+    <Reference Include="Glass, Version=1.6.0.113, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Glass.1.6.0.113\lib\portable45-net45+win8\Glass.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="Sprache, Version=2.0.0.50, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Sprache.2.0.0.50\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid+Xamarin.iOS10+MonoTouch\Sprache.dll</HintPath>
       <Private>True</Private>
@@ -333,6 +338,9 @@
       <HintPath>..\..\..\packages\Rx-PlatformServices.2.2.5\lib\portable-windows8+net45+wp8\System.Reactive.PlatformServices.dll</HintPath>
     </Reference>
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="glass\Glass.Core\Glass.Core.csproj" />
+  </ItemGroup>
   <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.

+ 1 - 0
src/Markup/Perspex.Markup.Xaml/glass

@@ -0,0 +1 @@
+Subproject commit 9e17adbd3ac0b342e7922ee2d5a11e5d50b7e687

+ 1 - 0
src/Markup/Perspex.Markup.Xaml/packages.config

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="Glass" version="1.6.0.113" targetFramework="portable45-net45+win8" />
   <package id="Rx-Core" version="2.2.5" targetFramework="portable46-net451+win81" />
   <package id="Rx-Interfaces" version="2.2.5" targetFramework="portable46-net451+win81" />
   <package id="Rx-Linq" version="2.2.5" targetFramework="portable46-net451+win81" />