Skip to content

Commit

Permalink
removed old API for creating xaml catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlagunas committed Aug 22, 2020
1 parent 382e691 commit 061d078
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
32 changes: 0 additions & 32 deletions src/Wpf/Prism.Wpf/Modularity/ModuleCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,6 @@ public ModuleCatalog(IEnumerable<ModuleInfo> modules) : base(modules)
{
}

/// <summary>
/// Creates a <see cref="ModuleCatalog"/> from XAML.
/// </summary>
/// <param name="xamlStream"><see cref="Stream"/> that contains the XAML declaration of the catalog.</param>
/// <returns>An instance of <see cref="ModuleCatalog"/> built from the XAML.</returns>
public static ModuleCatalog CreateFromXaml(Stream xamlStream)
{
if (xamlStream == null)
{
throw new ArgumentNullException(nameof(xamlStream));
}

return XamlReader.Load(xamlStream) as ModuleCatalog;
}

/// <summary>
/// Creates a <see cref="ModuleCatalog"/> from a XAML included as an Application Resource.
/// </summary>
/// <param name="builderResourceUri">Relative <see cref="Uri"/> that identifies the XAML included as an Application Resource.</param>
/// <returns>An instance of <see cref="ModuleCatalog"/> build from the XAML.</returns>
public static ModuleCatalog CreateFromXaml(Uri builderResourceUri)
{
var streamInfo = System.Windows.Application.GetResourceStream(builderResourceUri);

if ((streamInfo != null) && (streamInfo.Stream != null))
{
return CreateFromXaml(streamInfo.Stream);
}

return null;
}

/// <summary>
///
/// </summary>
Expand Down
36 changes: 35 additions & 1 deletion src/Wpf/Prism.Wpf/Modularity/XamlModuleCatalog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.IO;
using System.Windows.Markup;

namespace Prism.Modularity
{
Expand Down Expand Up @@ -32,7 +34,7 @@ public XamlModuleCatalog(Uri resourceUri)
/// </summary>
protected override void InnerLoad()
{
var catalog = ModuleCatalog.CreateFromXaml(_resourceUri);
var catalog = CreateFromXaml(_resourceUri);

foreach(IModuleCatalogItem item in catalog.Items)
{
Expand All @@ -53,5 +55,37 @@ protected override void InnerLoad()
Items.Add(item);
}
}

/// <summary>
/// Creates a <see cref="ModuleCatalog"/> from XAML.
/// </summary>
/// <param name="xamlStream"><see cref="Stream"/> that contains the XAML declaration of the catalog.</param>
/// <returns>An instance of <see cref="ModuleCatalog"/> built from the XAML.</returns>
private static ModuleCatalog CreateFromXaml(Stream xamlStream)
{
if (xamlStream == null)
{
throw new ArgumentNullException(nameof(xamlStream));
}

return XamlReader.Load(xamlStream) as ModuleCatalog;
}

/// <summary>
/// Creates a <see cref="ModuleCatalog"/> from a XAML included as an Application Resource.
/// </summary>
/// <param name="builderResourceUri">Relative <see cref="Uri"/> that identifies the XAML included as an Application Resource.</param>
/// <returns>An instance of <see cref="ModuleCatalog"/> build from the XAML.</returns>
private static ModuleCatalog CreateFromXaml(Uri builderResourceUri)
{
var streamInfo = System.Windows.Application.GetResourceStream(builderResourceUri);

if ((streamInfo != null) && (streamInfo.Stream != null))
{
return CreateFromXaml(streamInfo.Stream);
}

return null;
}
}
}

0 comments on commit 061d078

Please sign in to comment.