From e40d18e1a45dc0762394ebb22920dadc7a3e7cd8 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Tue, 7 Mar 2017 21:52:47 +0200 Subject: [PATCH] restore same public api of xaml loader before portable.xaml --- .../AvaloniaXamlLoaderPortableXaml.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs index 0370196372..84d65e20b3 100644 --- a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs +++ b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs @@ -105,7 +105,7 @@ namespace Avalonia.Markup.Xaml initialize?.BeginInit(); try { - return Load(stream, type, rootInstance, uri); + return Load(stream, rootInstance, uri); } finally { @@ -143,7 +143,7 @@ namespace Avalonia.Markup.Xaml using (var stream = assetLocator.Open(uri, baseUri)) { - return Load(stream, null, rootInstance, uri); + return Load(stream, rootInstance, uri); } } @@ -155,13 +155,13 @@ namespace Avalonia.Markup.Xaml /// The optional instance into which the XAML should be loaded. /// /// The loaded object. - public object Load(string xaml, Type type = null, object rootInstance = null) + public object Load(string xaml, object rootInstance = null) { Contract.Requires(xaml != null); using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml))) { - return Load(stream, type, rootInstance); + return Load(stream, rootInstance); } } @@ -174,7 +174,7 @@ namespace Avalonia.Markup.Xaml /// /// The URI of the XAML /// The loaded object. - public object Load(Stream stream, Type type = null, object rootInstance = null, Uri uri = null) + public object Load(Stream stream, object rootInstance = null, Uri uri = null) { try { @@ -185,10 +185,7 @@ namespace Avalonia.Markup.Xaml var readerSettings = new XamlXmlReaderSettings(); - if (rootInstance != null && type == null) - { - type = rootInstance.GetType(); - } + Type type = rootInstance?.GetType(); if (type != null) {