Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
#3 Added more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
godrose committed Jan 15, 2018
1 parent 12c01a3 commit eb6fd60
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace LogoFX.Client.Mvvm.Commanding
{
/// <summary>
/// The platform-specific <see cref="ActionCommand"/> extensions.
/// </summary>
public static class ActionCommandExtensions
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static TBootstrapper UseCommanding<TBootstrapper>(
/// <summary>
/// This midlleware initializes the <see cref="ICanExecuteManager"/> factory
/// </summary>
/// <typeparam name="TBootstrapper"></typeparam>
/// <typeparam name="TBootstrapper">The type of the bootstrapper.</typeparam>
public class InitializeCanExecuteManagerMiddleware<TBootstrapper> : IMiddleware<TBootstrapper>
where TBootstrapper : class, IHaveRegistrator
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
namespace LogoFX.Client.Mvvm.Commanding
{
/// <inheritdoc/>
/// <typeparam name="T">The type of the <see cref="ICanExecuteManager"/> instance to be created.</typeparam>
public class CanExecuteManagerFactory<T> : ICanExecuteManagerFactory where T : ICanExecuteManager, new()
{
/// <inheritdoc/>
public ICanExecuteManager CreateCanExecuteManager()
{
return new T();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
namespace LogoFX.Client.Mvvm.Commanding
{
/// <summary>
/// The Ambient Context for <see cref="ICanExecuteManagerFactory"/>
/// </summary>
public static class CanExecuteManagerFactoryContext
{
private static ICanExecuteManagerFactory _canExecuteManagerFactory = new DefaultCanExecuteManagerFactory();

/// <summary>
/// Gets or sets the current <see cref="ICanExecuteManagerFactory"/> implementation.
/// </summary>
public static ICanExecuteManagerFactory Current
{
get => _canExecuteManagerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

namespace LogoFX.Client.Mvvm.Commanding
{
/// <summary>
/// Default implementation of the <see cref="ICanExecuteManager"/>
/// </summary>
public class DefaultCanExecuteManager : ICanExecuteManager
{
/// <inheritdoc/>
public EventHandler CanExecuteHandler { get; private set; }

/// <inheritdoc/>
public void AddHandler(EventHandler eventHandler)
{
CanExecuteHandler += eventHandler;
}

/// <inheritdoc/>
public void RemoveHandler(EventHandler eventHandler)
{
CanExecuteHandler -= eventHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
namespace LogoFX.Client.Mvvm.Commanding
{
/// <summary>
/// The default implementation of the <see cref="ICanExecuteManagerFactory"/>
/// </summary>
public class DefaultCanExecuteManagerFactory : ICanExecuteManagerFactory
{
/// <inheritdoc/>
public ICanExecuteManager CreateCanExecuteManager()
{
return new DefaultCanExecuteManager();
Expand Down
15 changes: 15 additions & 0 deletions src/LogoFX.Client.Mvvm.Commanding/src/ICanExecuteManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@

namespace LogoFX.Client.Mvvm.Commanding
{
/// <summary>
/// The platform-independent abstraction of command execution predicate manager.
/// </summary>
public interface ICanExecuteManager
{
/// <summary>
/// Gets the execution predicate handler.
/// </summary>
EventHandler CanExecuteHandler { get; }
/// <summary>
/// Adds an event handler to the execution predicate.
/// </summary>
/// <param name="eventHandler"></param>
void AddHandler(EventHandler eventHandler);

/// <summary>
/// Removes event handler from the execution predicate.
/// </summary>
/// <param name="eventHandler"></param>
void RemoveHandler(EventHandler eventHandler);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
namespace LogoFX.Client.Mvvm.Commanding
{
/// <summary>
/// The factory for creating instances of <see cref="ICanExecuteManager"/>
/// </summary>
public interface ICanExecuteManagerFactory
{
/// <summary>
/// Creates new instance of <see cref="ICanExecuteManager"/>
/// </summary>
/// <returns></returns>
ICanExecuteManager CreateCanExecuteManager();
}
}

0 comments on commit eb6fd60

Please sign in to comment.