Some attributes are now ignored (like Ignorable).

This commit is contained in:
José Manuel Nieto Sánchez 2015-07-14 00:10:58 +02:00
Родитель 02dbb08aed
Коммит 09196d2e1d
18 изменённых файлов: 406 добавлений и 309 удалений

Просмотреть файл

@ -3,6 +3,7 @@ namespace OmniXaml.Wpf
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Builder;
using Typing;
@ -12,7 +13,7 @@ namespace OmniXaml.Wpf
public WpfCleanWiringContextBuilder()
{
var xamlNamespaceRegistry = CreateXamlNamespaceRegistry();
var xamlNamespaceRegistry = CreateXamlNamespaceRegistry();
TypeContext = new TypeContext(new WpfXamlTypeRepository(xamlNamespaceRegistry), xamlNamespaceRegistry, new TypeFactory());
ContentPropertyProvider = new WpfContentPropertyProvider();
TypeConverterProvider = new WpfTypeConverterProvider();
@ -22,16 +23,20 @@ namespace OmniXaml.Wpf
{
var xamlNamespaceRegistry = new XamlNamespaceRegistry();
var windowType = typeof (Window);
var textBlockType = typeof (System.Windows.Controls.TextBlock);
var toggleButtonType = typeof (ToggleButton);
var bindingType = typeof (BindingExtension);
var windowType = typeof(Window);
var textBlockType = typeof(System.Windows.Controls.TextBlock);
var toggleButtonType = typeof(ToggleButton);
var rotateTransformType = typeof(RotateTransform);
var bindingType = typeof(BindingExtension);
var rootNs = XamlNamespace.Map(WpfRootNs)
.With(
new[]
{
Route.Assembly(bindingType.Assembly).WithNamespaces(
new[] {bindingType.Namespace}),
Route.Assembly(rotateTransformType.Assembly).WithNamespaces(
new[] { rotateTransformType.Namespace}),
Route.Assembly(bindingType.Assembly).WithNamespaces(
new[] {bindingType.Namespace}),
Route.Assembly(windowType.Assembly).WithNamespaces(
@ -43,7 +48,7 @@ namespace OmniXaml.Wpf
})
});
foreach (var ns in new List<XamlNamespace> {rootNs})
foreach (var ns in new List<XamlNamespace> { rootNs })
{
xamlNamespaceRegistry.AddNamespace(ns);
}

Просмотреть файл

@ -75,6 +75,8 @@
<Compile Include="NewAssembler\SuperObjectAssembler.cs" />
<Compile Include="NewAssembler\Commands\ValueCommand.cs" />
<Compile Include="NewAssembler\ValuePipeline.cs" />
<Compile Include="Parsers\ProtoParser\SuperProtoParser\IXmlReader.cs" />
<Compile Include="Parsers\ProtoParser\SuperProtoParser\XmlCompatibilityReader.cs" />
<Compile Include="TypeConversion\BuiltInConverters\TypeTypeConverter.cs" />
<Compile Include="TypeConversion\IXamlTypeConverterContext.cs" />
<Compile Include="TypeConversion\XamlTypeConverterContext.cs" />

Просмотреть файл

@ -7,9 +7,9 @@ namespace OmniXaml.Parsers.ProtoParser.SuperProtoParser
internal class AttributeReader
{
private readonly XmlReader reader;
private readonly IXmlReader reader;
public AttributeReader(XmlReader reader)
public AttributeReader(IXmlReader reader)
{
this.reader = reader;
}

Просмотреть файл

@ -0,0 +1,18 @@
namespace OmniXaml.Parsers.ProtoParser.SuperProtoParser
{
using System.Xml;
internal interface IXmlReader
{
void Read();
XmlNodeType NodeType { get; }
bool IsEmptyElement { get; }
string Prefix { get; }
string LocalName { get; }
string Name { get; }
string Value { get; }
bool MoveToFirstAttribute();
bool MoveToNextAttribute();
void MoveToElement();
}
}

Просмотреть файл

@ -10,7 +10,7 @@
{
private readonly WiringContext wiringContext;
private readonly ProtoNodeBuilder nodeBuilder;
private XmlReader reader;
private IXmlReader reader;
public SuperProtoParser(WiringContext wiringContext)
{
@ -20,7 +20,7 @@
public IEnumerable<ProtoXamlNode> Parse(string xml)
{
reader = XmlReader.Create(new StringReader(xml));
reader = new XmlCompatibilityReader(new StringReader(xml));
reader.Read();
return ParseElement();

Просмотреть файл

@ -0,0 +1,64 @@
namespace OmniXaml.Parsers.ProtoParser.SuperProtoParser
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Xml;
internal class XmlCompatibilityReader : IXmlReader
{
private readonly XmlReader xmlReader;
public XmlCompatibilityReader(TextReader stringReader)
{
xmlReader = XmlReader.Create(stringReader);
}
public void Read()
{
xmlReader.Read();
}
public XmlNodeType NodeType => xmlReader.NodeType;
public bool IsEmptyElement => xmlReader.IsEmptyElement;
public string Prefix => xmlReader.Prefix;
public string LocalName => xmlReader.LocalName;
public string Name => xmlReader.Name;
public string Value => xmlReader.Value;
public bool MoveToFirstAttribute()
{
var hadNext = xmlReader.MoveToFirstAttribute();
if (ShouldIgnore)
{
return xmlReader.MoveToNextAttribute();
}
return hadNext;
}
public bool MoveToNextAttribute()
{
bool hadNext;
do
{
hadNext = xmlReader.MoveToNextAttribute();
} while (ShouldIgnore && hadNext);
return hadNext;
}
private bool ShouldIgnore => IsDesignerOnly || IsUnsupportedAttribute;
private bool IsUnsupportedAttribute => UnsupportedAttributes.Contains(Name);
public IEnumerable<string> UnsupportedAttributes { get; } = new Collection<string> { "x:Name", "x:Key", "x:Class" };
private bool IsDesignerOnly => xmlReader.Prefix == "d" || Name == "mc:Ignorable";
public void MoveToElement()
{
xmlReader.MoveToElement();
}
}
}

Просмотреть файл

@ -11,7 +11,7 @@
public class WpfLoaderViewModel : XamlVisualizerViewModel
{
private Snippet selectedSnippet;
public WpfLoaderViewModel()
{
IXamlSnippetProvider snippetsProvider = new XamlSnippetProvider(typeof(Dummy).Assembly, "Xaml.Tests.Resources.Wpf.resources");
@ -42,7 +42,8 @@
{
var localLoader = new WpfXamlLoader();
var window = (Window)localLoader.Load(Xaml);
var visualTree = localLoader.Load(Xaml);
var window = GetVisualizerWindow(visualTree);
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.DataContext = new TestViewModel();
window.Show();
@ -54,6 +55,18 @@
}
}
private Window GetVisualizerWindow(object visualTree)
{
var tree = visualTree as Window;
if (tree != null)
{
return tree;
}
var window = new Window { Content = visualTree };
return window;
}
private static void ShowProblemLoadingError(Exception e)
{
MessageBox.Show(

Просмотреть файл

@ -32,15 +32,15 @@
}
[TestMethod]
[Ignore]
public void BindingTest()
public void DataTemplate()
{
var visualTree = LoadXaml(Resources.DataTemplate);
}
[TestMethod]
[TestCategory("NeedsGraphics")]
public void ShowCaseTest()
public void ShowCase()
{
var visualTree = LoadXaml(Resources.ShowCase);
}
@ -51,5 +51,22 @@
{
var visualTree = LoadXaml(Resources.MicroShowCase);
}
[TestMethod]
public void Stage1()
{
var visualTree = LoadXaml(Resources.Stage1);
}
public void Stage2()
{
var visualTree = LoadXaml(Resources.Stage2);
}
public void Stage3()
{
var visualTree = LoadXaml(Resources.Stage3);
}
}
}

Просмотреть файл

@ -62,6 +62,17 @@
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual(Container.GetProperty(dummyClass), "Value");
}
}
[TestMethod]
public void Ignorable()
{
var actualInstance = Loader.Load(Dummy.Ignorable);
Assert.IsInstanceOfType(actualInstance, typeof(DummyClass), "The retrieved instance should be of type DummyClass");
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Property!", dummyClass.SampleProperty);
}
}
}

Просмотреть файл

@ -1,174 +1,154 @@
namespace OmniXaml.Tests.XamlXmlReaderTests
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Classes;
using Glass;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OmniXaml.Parsers.ProtoParser;
using OmniXaml.Parsers.ProtoParser.SuperProtoParser;
using OmniXaml.Parsers.XamlNodes;
using Xaml.Tests.Resources;
[TestClass]
public class NodeDumpTests : GivenAWiringContext
{
private readonly XamlNodeBuilder nodeBuilder;
public NodeDumpTests()
{
nodeBuilder = new XamlNodeBuilder(WiringContext.TypeContext);
}
[TestMethod]
public void ReadSingleInstance()
{
var contents = FlattenNodesFromXaml(Dummy.SingleInstance);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
[Description("With no namespace, it fails")]
public void ReadWithChild()
{
var contents = FlattenNodesFromXaml(Dummy.InstanceWithChild);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.StartMember<DummyClass>(d => d.Child),
nodeBuilder.StartObject(typeof(ChildClass)),
nodeBuilder.EndObject(),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
public void InstanceWithStringPropertyAndNsDeclaration()
{
var contents = FlattenNodesFromXaml(Dummy.StringProperty);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.StartMember<DummyClass>(d => d.SampleProperty),
nodeBuilder.Value("Property!"),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
public void ClassWithInnerCollection()
{
var contents = FlattenNodesFromXaml(Dummy.ClassWithInnerCollection);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.StartMember<DummyClass>(d => d.Items),
nodeBuilder.GetObject(),
nodeBuilder.Items(),
nodeBuilder.StartObject(typeof (Item)),
nodeBuilder.EndObject(),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
[Ignore]
public void ReadRealXamlStage1()
{
var actualNodes = FlattenNodesFromXaml(Dummy.XamlStage1);
var expectedNodes = ParseResult(Dummy.XamlStage1_Result);
AssertNodesAreEqual(expectedNodes, actualNodes.Select(node => node.NodeType).ToList());
}
[TestMethod]
[Ignore]
public void ReadRealXamlStage2()
{
var actualNodes = FlattenNodesFromXaml(Dummy.XamlStage2);
var expectedNodes = ParseResult(Dummy.XamlStage2_Result);
AssertNodesAreEqual(expectedNodes, actualNodes.Select(node => node.NodeType).ToList());
}
private static void AssertNodesAreEqual(IList<XamlNodeType> expectedNodes, IList<XamlNodeType> actualNodes)
{
CollectionAssert.AreEqual(
expectedNodes.ToList(),
actualNodes.ToList(),
"\nExpected:\n{0}\n\nActual:\n{1}",
Extensions.ToString(expectedNodes),
Extensions.ToString(actualNodes));
}
private static IList<XamlNodeType> ParseResult(string str)
{
var nodes = new List<XamlNodeType>();
var nodeTypes = Enum.GetNames(typeof(XamlNodeType));
using (var reader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(str))))
{
var builder = new StringBuilder();
while (!reader.EndOfStream)
{
var readChar = (char)reader.Read();
builder.Append(readChar);
var currentBuffer = builder.ToString();
var nodeType = nodeTypes.FirstOrDefault(nodeName => nodeName == currentBuffer);
if (nodeType != null)
{
XamlNodeType parsedNode;
if (Enum.TryParse(nodeType, out parsedNode))
{
nodes.Add(parsedNode);
builder.Clear();
}
}
}
}
return nodes;
}
private IList<XamlNode> FlattenNodesFromXaml(string xaml)
{
var pullParser = new XamlNodesPullParser(WiringContext);
var protoNodes = new SuperProtoParser(WiringContext).Parse(xaml);
return pullParser.Parse(protoNodes).ToList();
}
}
namespace OmniXaml.Tests.XamlXmlReaderTests
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Classes;
using Glass;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OmniXaml.Parsers.ProtoParser;
using OmniXaml.Parsers.ProtoParser.SuperProtoParser;
using OmniXaml.Parsers.XamlNodes;
using Xaml.Tests.Resources;
[TestClass]
public class NodeDumpTests : GivenAWiringContext
{
private readonly XamlNodeBuilder nodeBuilder;
public NodeDumpTests()
{
nodeBuilder = new XamlNodeBuilder(WiringContext.TypeContext);
}
[TestMethod]
public void ReadSingleInstance()
{
var contents = FlattenNodesFromXaml(Dummy.SingleInstance);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
[Description("With no namespace, it fails")]
public void ReadWithChild()
{
var contents = FlattenNodesFromXaml(Dummy.InstanceWithChild);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.StartMember<DummyClass>(d => d.Child),
nodeBuilder.StartObject(typeof(ChildClass)),
nodeBuilder.EndObject(),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
public void InstanceWithStringPropertyAndNsDeclaration()
{
var contents = FlattenNodesFromXaml(Dummy.StringProperty);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.StartMember<DummyClass>(d => d.SampleProperty),
nodeBuilder.Value("Property!"),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
[TestMethod]
public void ClassWithInnerCollection()
{
var contents = FlattenNodesFromXaml(Dummy.ClassWithInnerCollection);
var expected = new List<XamlNode>
{
nodeBuilder.NamespacePrefixDeclaration("root", ""),
nodeBuilder.StartObject(typeof (DummyClass)),
nodeBuilder.StartMember<DummyClass>(d => d.Items),
nodeBuilder.GetObject(),
nodeBuilder.Items(),
nodeBuilder.StartObject(typeof (Item)),
nodeBuilder.EndObject(),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
nodeBuilder.EndMember(),
nodeBuilder.EndObject(),
};
XamlNodesAssert.AreEssentiallyTheSame(expected, contents);
}
private static void AssertNodesAreEqual(IList<XamlNodeType> expectedNodes, IList<XamlNodeType> actualNodes)
{
CollectionAssert.AreEqual(
expectedNodes.ToList(),
actualNodes.ToList(),
"\nExpected:\n{0}\n\nActual:\n{1}",
Extensions.ToString(expectedNodes),
Extensions.ToString(actualNodes));
}
private static IList<XamlNodeType> ParseResult(string str)
{
var nodes = new List<XamlNodeType>();
var nodeTypes = Enum.GetNames(typeof(XamlNodeType));
using (var reader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(str))))
{
var builder = new StringBuilder();
while (!reader.EndOfStream)
{
var readChar = (char)reader.Read();
builder.Append(readChar);
var currentBuffer = builder.ToString();
var nodeType = nodeTypes.FirstOrDefault(nodeName => nodeName == currentBuffer);
if (nodeType != null)
{
XamlNodeType parsedNode;
if (Enum.TryParse(nodeType, out parsedNode))
{
nodes.Add(parsedNode);
builder.Clear();
}
}
}
}
return nodes;
}
private IList<XamlNode> FlattenNodesFromXaml(string xaml)
{
var pullParser = new XamlNodesPullParser(WiringContext);
var protoNodes = new SuperProtoParser(WiringContext).Parse(xaml);
return pullParser.Parse(protoNodes).ToList();
}
}
}

83
Xaml.Tests.Resources/Dummy.Designer.cs сгенерированный
Просмотреть файл

@ -272,15 +272,6 @@ namespace Xaml.Tests.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to NamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueE [rest of string was truncated]&quot;;.
/// </summary>
public static string ExpectedStage1 {
get {
return ResourceManager.GetString("ExpectedStage1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;DummyClass xmlns=&quot;root&quot;&gt;
/// &lt;DummyClass.Child&gt;
@ -315,9 +306,24 @@ namespace Xaml.Tests.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;DummyClass xmlns=&quot;root&quot;
/// xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
/// mc:Ignorable=&quot;d&quot;
/// xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
/// d:DesignWidth=&quot;300&quot;
/// SampleProperty=&quot;Property!&quot;&gt;
///&lt;/DummyClass&gt;.
/// </summary>
public static string Ignorable {
get {
return ResourceManager.GetString("Ignorable", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;DummyClass xmlns=&quot;root&quot;&gt;
/// &lt;SampleProperty&gt;Property!&lt;/SampleProperty&gt;
/// &lt;DummyClass.SampleProperty&gt;Property!&lt;/DummyClass.SampleProperty&gt;
///&lt;/DummyClass&gt;.
/// </summary>
public static string InnerContent {
@ -551,62 +557,5 @@ namespace Xaml.Tests.Resources {
return ResourceManager.GetString("WithAttachableProperty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;Window x:Class=&quot;WpfApplication_test1.MainWindow&quot;
/// xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
/// xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
/// xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
/// xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
/// xmlns:local=&quot;clr-namespace:WpfApplication_test1&quot;
/// mc:Ignorable=&quot;d&quot;
/// Title=&quot;MainWindow&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;
/// &lt;Grid Background=&quot;BlueViolet&quot;&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
public static string XamlStage1 {
get {
return ResourceManager.GetString("XamlStage1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to NamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueE [rest of string was truncated]&quot;;.
/// </summary>
public static string XamlStage1_Result {
get {
return ResourceManager.GetString("XamlStage1_Result", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;UserControl
/// x:Class=&quot;NcoreCpuMarkW8.UI.Controls.UcSpeedmeter&quot;
/// xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
/// xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
/// xmlns:local=&quot;using:NcoreCpuMarkW8.UI.Controls&quot;
/// xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
/// xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
/// mc:Ignorable=&quot;d&quot;
/// d:DesignHeight=&quot;400&quot;
/// d:DesignWidth=&quot;600&quot;&gt;
///
/// &lt;Grid MinHeight=&quot;400&quot; MinWidth=&quot;600&quot;&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
public static string XamlStage2 {
get {
return ResourceManager.GetString("XamlStage2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to NamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationStartObjectStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberEndObjectEndM [rest of string was truncated]&quot;;.
/// </summary>
public static string XamlStage2_Result {
get {
return ResourceManager.GetString("XamlStage2_Result", resourceCulture);
}
}
}
}

Просмотреть файл

@ -169,9 +169,6 @@
<data name="EnumProperty" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\enumproperty.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="ExpectedStage1" xml:space="preserve">
<value>NamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberEndObjectEndMemberEndObjectEndMemberEndObject</value>
</data>
<data name="ExpectedStage11" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\expectedstage1.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
@ -226,18 +223,6 @@
<data name="WithAttachableProperty" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\withattachableproperty.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="XamlStage1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\xamlstage1.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="XamlStage1_Result" xml:space="preserve">
<value>NamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberEndObjectEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberEndObjectEndMemberEndObjectEndMemberEndObject</value>
</data>
<data name="XamlStage2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\xamlstage2.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="XamlStage2_Result" xml:space="preserve">
<value>NamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationNamespaceDeclarationStartObjectStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberStartObjectStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberEndObjectEndMemberEndObjectValueStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberStartObjectStartMemberValueEndMemberStartMemberValueEndMemberEndObjectEndMemberEndObjectValueStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberEndObjectValueStartObjectStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberStartMemberValueEndMemberEndObjectEndMemberEndObjectEndMemberEndObjectEndMemberEndObject</value>
</data>
<data name="FourLevelsOfNesting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\fourlevelsofnesting.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
@ -253,4 +238,7 @@
<data name="InnerContent" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\innercontent.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="Ignorable" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\dummy\ignorable.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
</root>

58
Xaml.Tests.Resources/Wpf.Designer.cs сгенерированный
Просмотреть файл

@ -79,21 +79,11 @@ namespace Xaml.Tests.Resources {
}
/// <summary>
/// Looks up a localized string similar to &lt;Window Title=&quot;MainWindow&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;
/// &lt;Grid&gt;
/// &lt;Grid.RowDefinitions&gt;
/// &lt;RowDefinition Height=&quot;Auto&quot;/&gt;
/// &lt;RowDefinition /&gt;
/// &lt;/Grid.RowDefinitions&gt;
/// &lt;Menu&gt;
/// &lt;MenuItem Header=&quot;File&quot;&gt;
/// &lt;MenuItem Header=&quot;Open&quot;&gt;
/// &lt;MenuItem.Icon&gt;
/// &lt;Image Source=&quot;github_icon.png&quot;&gt;&lt;/Image&gt;
/// &lt;/MenuItem.Icon&gt;
/// &lt;/MenuItem&gt;
/// &lt;MenuItem Header=&quot;Save&quot;&gt;
/// &lt;MenuItem He [rest of string was truncated]&quot;;.
/// Looks up a localized string similar to &lt;Menu xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&gt;
/// &lt;MenuItem Header=&quot;File&quot;&gt;
/// &lt;MenuItem /&gt;
/// &lt;/MenuItem&gt;
///&lt;/Menu&gt;.
/// </summary>
public static string MicroShowCase {
get {
@ -146,6 +136,44 @@ namespace Xaml.Tests.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;Window x:Class=&quot;WpfApplication_test1.MainWindow&quot;
/// xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
/// xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
/// xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
/// xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
/// xmlns:local=&quot;clr-namespace:WpfApplication_test1&quot;
/// mc:Ignorable=&quot;d&quot;
/// Title=&quot;MainWindow&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;
/// &lt;Grid Background=&quot;BlueViolet&quot;&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
public static string Stage2 {
get {
return ResourceManager.GetString("Stage2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;UserControl
/// x:Class=&quot;NcoreCpuMarkW8.UI.Controls.UcSpeedmeter&quot;
/// xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
/// xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
/// xmlns:local=&quot;using:NcoreCpuMarkW8.UI.Controls&quot;
/// xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
/// xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
/// mc:Ignorable=&quot;d&quot;
/// d:DesignHeight=&quot;400&quot;
/// d:DesignWidth=&quot;600&quot;&gt;
/// &lt;Grid MinHeight=&quot;400&quot; MinWidth=&quot;600&quot;&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
public static string Stage3 {
get {
return ResourceManager.GetString("Stage3", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;Window xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&gt;&lt;/Window&gt;.
/// </summary>

Просмотреть файл

@ -130,6 +130,12 @@
<data name="Stage1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\wpf\stage1.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="Stage2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\wpf\stage2.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="Stage3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\wpf\stage3.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>
<data name="Window" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xaml\wpf\window.xaml;System.String, System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;utf-8</value>
</data>

Просмотреть файл

@ -34,17 +34,17 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Dummy.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Dummy.resx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtoInputs1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>ProtoInputs.resx</DependentUpon>
</Compile>
<Compile Include="Dummy.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Dummy.resx</DependentUpon>
</Compile>
<Compile Include="Wpf.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@ -54,6 +54,7 @@
<ItemGroup>
<EmbeddedResource Include="Dummy.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Dummy.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="ProtoInputs.resx">
@ -63,6 +64,7 @@
<EmbeddedResource Include="Wpf.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Wpf.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
@ -173,7 +175,7 @@
</None>
</ItemGroup>
<ItemGroup>
<None Include="Xaml\Dummy\StringProperty.xaml">
<None Include="Xaml\Dummy\Ignorable.xaml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
@ -263,12 +265,7 @@
</None>
</ItemGroup>
<ItemGroup>
<None Include="Xaml\Dummy\XamlStage2.xaml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Xaml\Dummy\XamlStage1.xaml">
<None Include="Xaml\Wpf\Stage2.xaml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
@ -302,6 +299,16 @@
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Xaml\Wpf\Stage3.xaml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Xaml\Dummy\StringProperty.xaml">
<SubType>Designer</SubType>
</None>
</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.

Просмотреть файл

@ -0,0 +1,7 @@
<DummyClass xmlns="root"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d:DesignWidth="300"
SampleProperty="Property!">
</DummyClass>

Просмотреть файл

@ -8,26 +8,28 @@
mc:Ignorable="d"
d:DesignHeight="400"
d:DesignWidth="600">
<Grid MinHeight="400" MinWidth="600">
<Canvas>
<Image Source= "/Assets/velocimetro.png" ></Image>
<Image x:Name="mgBigSpeed" Source= "/Assets/medidorGrande.png" Canvas.Left="300" Canvas.Top="58"
<Image></Image>
<Image x:Name="mgBigSpeed" Canvas.Left="300" Canvas.Top="58"
RenderTransformOrigin="0.5, 0.9">
<Image.RenderTransform>
<RotateTransform x:Name="RotateTransformBig" Angle="-90.00"/>
<RotateTransform x:Name="RotateTransformBig" Angle="-90.00" />
</Image.RenderTransform>
</Image>
<Image x:Name="mgSmallSpeed" Source= "/Assets/medidorPequeno.png" Canvas.Left="300" Canvas.Top="168"
<Image x:Name="mgSmallSpeed" Canvas.Left="300" Canvas.Top="168"
RenderTransformOrigin="0.5, 0.81" UseLayoutRounding="False" d:LayoutRounding="Auto">
<Image.RenderTransform>
<RotateTransform x:Name="RotateTransformSmall" Angle="-90.00"/>
<RotateTransform x:Name="RotateTransformSmall" Angle="-90.00" />
</Image.RenderTransform>
</Image>
<Image Source="/Assets/bolaVelocimetro.png" Canvas.Left="233" Canvas.Top="244"></Image>
<TextBlock x:Name="txtSpeedBig" Canvas.Left="227" TextWrapping="Wrap" Text="speedBig" Canvas.Top="57" Height="29" Width="159" FontFamily="Calibri" FontSize="22" Foreground="#FF026A9C" HorizontalAlignment="Center" TextAlignment="Center"/>
<TextBlock x:Name="txtSpeedSmall" Canvas.Left="227" TextWrapping="Wrap" Text="speedSmall" Canvas.Top="162" Height="29" Width="159" FontFamily="Calibri" FontSize="22" Foreground="#FFBD0B0E" HorizontalAlignment="Center" TextAlignment="Center"/>
<Image Canvas.Left="233" Canvas.Top="244"></Image>
<TextBlock x:Name="txtSpeedBig" Canvas.Left="227" TextWrapping="Wrap" Text="speedBig" Canvas.Top="57"
Height="29" Width="159" FontFamily="Calibri" FontSize="22" Foreground="#FF026A9C"
HorizontalAlignment="Center" TextAlignment="Center" />
<TextBlock x:Name="txtSpeedSmall" Canvas.Left="227" TextWrapping="Wrap" Text="speedSmall" Canvas.Top="162"
Height="29" Width="159" FontFamily="Calibri" FontSize="22" Foreground="#FFBD0B0E"
HorizontalAlignment="Center" TextAlignment="Center" />
</Canvas>
</Grid>
</UserControl>