Skip to content

Commit

Permalink
Merge pull request #2067 from Jesus805/master
Browse files Browse the repository at this point in the history
Added missing XML Docs to various classes in Prism.Wpf
  • Loading branch information
brianlagunas committed Jul 2, 2020
2 parents 695606b + 6e7a514 commit b2be9cc
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 39 deletions.
4 changes: 4 additions & 0 deletions src/Wpf/Prism.Unity.Wpf/Legacy/UnityBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ protected virtual IUnityContainer CreateContainer()
return new UnityContainer();
}

/// <summary>
/// Creates the <see cref="IContainerExtension"/> used by Prism.
/// </summary>
/// <returns>The container extension.</returns>
protected override IContainerExtension CreateContainerExtension()
{
return new UnityContainerExtension(Container);
Expand Down
3 changes: 3 additions & 0 deletions src/Wpf/Prism.Unity.Wpf/Legacy/UnityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Prism.Unity
{
/// <summary>
/// <see cref="IUnityContainer"/> extensions.
/// </summary>
public static class UnityExtensions
{
/// <summary>
Expand Down
11 changes: 11 additions & 0 deletions src/Wpf/Prism.Unity.Wpf/PrismApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@

namespace Prism.Unity
{
/// <summary>
/// Base application class that uses <see cref="UnityContainerExtension"/> as it's container.
/// </summary>
public abstract class PrismApplication : PrismApplicationBase
{
/// <summary>
/// Create a new <see cref="UnityContainerExtension"/> used by Prism.
/// </summary>
/// <returns>A new <see cref="UnityContainerExtension"/>.</returns>
protected override IContainerExtension CreateContainerExtension()
{
return new UnityContainerExtension();
}

/// <summary>
/// Registers the <see cref="Type"/>s of the Exceptions that are not considered
/// root exceptions by the <see cref="ExceptionExtensions"/>.
/// </summary>
protected override void RegisterFrameworkExceptionTypes()
{
ExceptionExtensions.RegisterFrameworkExceptionType(typeof(ResolutionFailedException));
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf/Prism.Wpf/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public abstract class Bootstrapper
/// <summary>
/// Creates the container extension used by Prism.
/// </summary>
/// <returns>The container extension</returns>
/// <returns>The container extension.</returns>
protected abstract IContainerExtension CreateContainerExtension();

/// <summary>
Expand Down
22 changes: 22 additions & 0 deletions src/Wpf/Prism.Wpf/Common/MvvmHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@

namespace Prism.Common
{
/// <summary>
/// Helper class for MVVM.
/// </summary>
public static class MvvmHelpers
{
/// <summary>
/// Perform an <see cref="Action{T}"/> on a view and viewmodel.
/// </summary>
/// <remarks>
/// The action will be performed on the view and its viewmodel if they implement <typeparamref name="T"/>.
/// </remarks>
/// <typeparam name="T">The <see cref="Action{T}"/> parameter type.</typeparam>
/// <param name="view">The view to perform the <see cref="Action{T}"/> on.</param>
/// <param name="action">The <see cref="Action{T}"/> to perform.</param>
public static void ViewAndViewModelAction<T>(object view, Action<T> action) where T : class
{
T viewAsT = view as T;
Expand All @@ -28,6 +40,16 @@ public static void ViewAndViewModelAction<T>(object view, Action<T> action) wher
}
}

/// <summary>
/// Get an implementer from a view or viewmodel.
/// </summary>
/// <remarks>
/// If the view implements <typeparamref name="T"/> it will be returned.
/// Otherwise if the view's datacontext implements <typeparamref name="T"/> it will be returned instead.
/// </remarks>
/// <typeparam name="T">The implementer type to get.</typeparam>
/// <param name="view">The view to get <typeparamref name="T"/> from.</param>
/// <returns>view or viewmodel as <typeparamref name="T"/>.</returns>
public static T GetImplementerFromViewOrViewModel<T>(object view) where T : class
{
T viewAsT = view as T;
Expand Down
12 changes: 8 additions & 4 deletions src/Wpf/Prism.Wpf/Interactivity/CommandBehaviorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Prism.Interactivity
/// <summary>
/// Base behavior to handle connecting a <see cref="System.Windows.Controls.Control"/> to a Command.
/// </summary>
/// <typeparam name="T">The target object must derive from Control</typeparam>
/// <typeparam name="T">The target object must derive from Control.</typeparam>
/// <remarks>
/// CommandBehaviorBase can be used to provide new behaviors for commands.
/// </remarks>
Expand All @@ -36,6 +36,10 @@ public CommandBehaviorBase(T targetObject)
}

bool _autoEnabled = true;
/// <summary>
/// If <c>true</c> the target object's IsEnabled property will update based on the commands ability to execute.
/// If <c>false</c> the target object's IsEnabled property will not update.
/// </summary>
public bool AutoEnable
{
get { return _autoEnabled; }
Expand All @@ -47,7 +51,7 @@ public bool AutoEnable
}

/// <summary>
/// Corresponding command to be execute and monitored for <see cref="ICommand.CanExecuteChanged"/>
/// Corresponding command to be execute and monitored for <see cref="ICommand.CanExecuteChanged"/>.
/// </summary>
public ICommand Command
{
Expand All @@ -69,7 +73,7 @@ public ICommand Command
}

/// <summary>
/// The parameter to supply the command during execution
/// The parameter to supply the command during execution.
/// </summary>
public object CommandParameter
{
Expand Down Expand Up @@ -124,7 +128,7 @@ private void CommandCanExecuteChanged(object sender, EventArgs e)
}

/// <summary>
/// Executes the command, if it's set, providing the <see cref="CommandParameter"/>
/// Executes the command, if it's set, providing the <see cref="CommandParameter"/>.
/// </summary>
protected virtual void ExecuteCommand(object parameter)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Wpf/Prism.Wpf/Ioc/IContainerRegistryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace Prism.Ioc
{
/// <summary>
/// <see cref="IContainerRegistry"/> extensions.
/// </summary>
public static class IContainerRegistryExtensions
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Wpf/Prism.Wpf/Logging/TextLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Prism.Logging
/// </summary>
public class TextLogger : ILoggerFacade, IDisposable
{
/// <summary>
/// A <see cref="TextWriter"/> that writes to console output.
/// </summary>
public TextWriter Writer { get; set; } = Console.Out;

/// <summary>
Expand Down
62 changes: 32 additions & 30 deletions src/Wpf/Prism.Wpf/Modularity/IModuleCatalogExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using System;
using System;
using Prism.Properties;

namespace Prism.Modularity
{
/// <summary>
/// <see cref="IModuleCatalog"/> extensions.
/// </summary>
public static class IModuleCatalogExtensions
{
/// <summary>
/// Adds the module.
/// Adds the module to the <see cref="IModuleCatalog"/>.
/// </summary>
/// <param name="catalog">Catalog</param>
/// <param name="mode"><see cref="InitializationMode"/></param>
/// <param name="dependsOn">Collection of module names (<see cref="ModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="mode">The <see cref="InitializationMode"/> to use.</param>
/// <param name="dependsOn">Collection of module names (<see cref="IModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <typeparam name="T">The <see cref="IModule"/> type parameter.</typeparam>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, InitializationMode mode = InitializationMode.WhenAvailable, params string[] dependsOn)
Expand All @@ -20,12 +23,12 @@ public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, Initializ
}

/// <summary>
/// Adds the module.
/// Adds the module to the <see cref="IModuleCatalog"/>.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="name">Name.</param>
/// <param name="mode"><see cref="IModule"/>.</param>
/// <param name="dependsOn">Collection of module names (<see cref="ModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="name">Name of the module to be added.</param>
/// <param name="mode">The <see cref="InitializationMode"/> to use.</param>
/// <param name="dependsOn">Collection of module names (<see cref="IModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <typeparam name="T">The <see cref="IModule"/> type parameter.</typeparam>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, string name, InitializationMode mode = InitializationMode.WhenAvailable, params string[] dependsOn)
Expand All @@ -37,7 +40,7 @@ public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, string na
/// <summary>
/// Adds a groupless <see cref="IModuleInfo"/> to the catalog.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="moduleType"><see cref="Type"/> of the module to be added.</param>
/// <param name="dependsOn">Collection of module names (<see cref="IModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
Expand All @@ -49,7 +52,7 @@ public static IModuleCatalog AddModule(this IModuleCatalog catalog, Type moduleT
/// <summary>
/// Adds a groupless <see cref="IModuleInfo"/> to the catalog.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="moduleType"><see cref="Type"/> of the module to be added.</param>
/// <param name="initializationMode">Stage on which the module to be added will be initialized.</param>
/// <param name="dependsOn">Collection of module names (<see cref="IModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
Expand All @@ -63,12 +66,12 @@ public static IModuleCatalog AddModule(this IModuleCatalog catalog, Type moduleT
}

/// <summary>
/// Adds a groupless <see cref="ModuleInfo"/> to the catalog.
/// Adds a groupless <see cref="IModuleInfo"/> to the catalog.
/// </summary>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="moduleName">Name of the module to be added.</param>
/// <param name="catalog">Catalog.</param>
/// <param name="moduleType"><see cref="Type"/> of the module to be added.</param>
/// <param name="dependsOn">Collection of module names (<see cref="ModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <param name="dependsOn">Collection of module names (<see cref="IModuleInfo.ModuleName"/>) of the modules on which the module to be added logically depends on.</param>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
public static IModuleCatalog AddModule(this IModuleCatalog catalog, string moduleName, string moduleType, params string[] dependsOn)
{
Expand All @@ -78,7 +81,7 @@ public static IModuleCatalog AddModule(this IModuleCatalog catalog, string modul
/// <summary>
/// Adds a groupless <see cref="ModuleInfo"/> to the catalog.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="moduleName">Name of the module to be added.</param>
/// <param name="moduleType"><see cref="Type"/> of the module to be added.</param>
/// <param name="initializationMode">Stage on which the module to be added will be initialized.</param>
Expand All @@ -92,7 +95,7 @@ public static IModuleCatalog AddModule(this IModuleCatalog catalog, string modul
/// <summary>
/// Adds a groupless <see cref="ModuleInfo"/> to the catalog.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="moduleName">Name of the module to be added.</param>
/// <param name="moduleType"><see cref="Type"/> of the module to be added.</param>
/// <param name="refValue">Reference to the location of the module to be added assembly.</param>
Expand All @@ -116,34 +119,33 @@ public static IModuleCatalog AddModule(this IModuleCatalog catalog, string modul
}

/// <summary>
/// Adds the module.
/// Adds the module to the <see cref="IModuleCatalog"/>.
/// </summary>
/// <param name="catalog">Catalog</param>
/// <param name="mode"><see cref="InitializationMode"/></param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="mode">The <see cref="InitializationMode"/> to use.</param>
/// <typeparam name="T">The <see cref="IModule"/> type parameter.</typeparam>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, InitializationMode mode = InitializationMode.WhenAvailable)
where T : IModule =>
catalog.AddModule<T>(typeof(T).Name, mode);


/// <summary>
/// Adds the module.
/// Adds the module to the <see cref="IModuleCatalog"/>.
/// </summary>
/// <param name="catalog">Catalog</param>
/// <param name="name">Name.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="name">Name of the module to be added.</param>
/// <typeparam name="T">The <see cref="IModule"/> type parameter.</typeparam>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, string name)
where T : IModule =>
catalog.AddModule<T>(name, InitializationMode.WhenAvailable);

/// <summary>
/// Adds the module.
/// Adds the module to the <see cref="IModuleCatalog"/>.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="name">Name.</param>
/// <param name="mode"><see cref="IModule"/>.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="name">Name of the module to be added.</param>
/// <param name="mode">The <see cref="InitializationMode"/> to use.</param>
/// <typeparam name="T">The <see cref="IModule"/> type parameter.</typeparam>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module.</returns>
public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, string name, InitializationMode mode)
Expand All @@ -153,11 +155,11 @@ public static IModuleCatalog AddModule<T>(this IModuleCatalog catalog, string na
/// <summary>
/// Creates and adds a <see cref="ModuleInfoGroup"/> to the catalog.
/// </summary>
/// <param name="catalog">Catalog.</param>
/// <param name="catalog">The catalog to add the module to.</param>
/// <param name="initializationMode">Stage on which the module group to be added will be initialized.</param>
/// <param name="refValue">Reference to the location of the module group to be added.</param>
/// <param name="moduleInfos">Collection of <see cref="ModuleInfo"/> included in the group.</param>
/// <returns>The same <see cref="IModuleCatalog"/> instance with the added module group.</returns>
/// <returns>The same <see cref="IModuleCatalog"/> with the added module group.</returns>
public static IModuleCatalog AddGroup(this IModuleCatalog catalog, InitializationMode initializationMode, string refValue, params ModuleInfo[] moduleInfos)
{
if (!(catalog is IModuleGroupsCatalog groupSupport))
Expand Down
17 changes: 14 additions & 3 deletions src/Wpf/Prism.Wpf/Mvvm/ViewModelLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,22 @@ public static class ViewModelLocator
/// The AutoWireViewModel attached property.
/// </summary>
public static DependencyProperty AutoWireViewModelProperty = DependencyProperty.RegisterAttached("AutoWireViewModel", typeof(bool), typeof(ViewModelLocator), new PropertyMetadata(defaultValue: false, propertyChangedCallback: AutoWireViewModelChanged));

/// <summary>
/// Gets the value for the <see cref="AutoWireViewModelProperty"/> attached property.
/// </summary>
/// <param name="obj">The target element.</param>
/// <returns>The <see cref="AutoWireViewModelProperty"/> attached to the <paramref name="obj"/> element.</returns>
public static bool GetAutoWireViewModel(DependencyObject obj)
{
return (bool)obj.GetValue(AutoWireViewModelProperty);
}

/// <summary>
/// Sets the <see cref="AutoWireViewModelProperty"/> attached property.
/// </summary>
/// <param name="obj">The target element.</param>
/// <param name="value">The value to attach.</param>
public static void SetAutoWireViewModel(DependencyObject obj, bool value)
{
obj.SetValue(AutoWireViewModelProperty, value);
Expand All @@ -41,10 +52,10 @@ private static void AutoWireViewModelChanged(DependencyObject d, DependencyPrope
}

/// <summary>
/// Sets the DataContext of a View
/// Sets the DataContext of a View.
/// </summary>
/// <param name="view">The View to set the DataContext on</param>
/// <param name="viewModel">The object to use as the DataContext for the View</param>
/// <param name="view">The View to set the DataContext on.</param>
/// <param name="viewModel">The object to use as the DataContext for the View.</param>
static void Bind(object view, object viewModel)
{
if (view is FrameworkElement element)
Expand Down
13 changes: 13 additions & 0 deletions src/Wpf/Prism.Wpf/Regions/Behaviors/DestructibleRegionBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@

namespace Prism.Regions.Behaviors
{
/// <summary>
/// Calls <see cref="IDestructible.Destroy"/> on Views and ViewModels
/// removed from the <see cref="IRegion.Views"/> collection.
/// </summary>
/// <remarks>
/// The View and/or ViewModels must implement <see cref="IDestructible"/> for this behavior to work.
/// </remarks>
public class DestructibleRegionBehavior : RegionBehavior
{
/// <summary>
/// The key of this behavior.
/// </summary>
public const string BehaviorKey = "IDestructibleRegionBehavior";

/// <summary>
/// Attaches the <see cref="DestructibleRegionBehavior"/> to the <see cref="IRegion.Views"/> collection.
/// </summary>
protected override void OnAttach()
{
Region.Views.CollectionChanged += Views_CollectionChanged;
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface IRegionNavigationJournal
/// Gets a value that indicates whether there is at least one entry in the forward navigation history.
/// </summary>
/// <value>
/// <c>true</c> if this instance can go forward; otherwise, <c>false</c>.
/// <c>true</c> if this instance can go forward; otherwise, <c>false</c>.
/// </value>
bool CanGoForward { get; }

Expand Down

0 comments on commit b2be9cc

Please sign in to comment.