mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-08 10:16:36 +08:00
28 lines
1.2 KiB
C#
28 lines
1.2 KiB
C#
namespace Fluent.Extensions
|
|
{
|
|
using System.Windows.Input;
|
|
using Fluent.Internal;
|
|
|
|
/// <summary>
|
|
/// Extensions for <see cref="ICommandSource"/>.
|
|
/// </summary>
|
|
public static class ICommandSourceExtensions
|
|
{
|
|
/// <summary>
|
|
/// Execute <see cref="ICommandSource.Command"/> using <see cref="ICommandSource.CommandParameter"/> and <see cref="ICommandSource.CommandTarget"/>.
|
|
/// </summary>
|
|
public static void ExecuteCommand(this ICommandSource commandSource)
|
|
{
|
|
CommandHelper.Execute(commandSource.Command, commandSource.CommandParameter, commandSource.CommandTarget);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determines whether the <see cref="ICommandSource.Command"/> can be executed using <see cref="ICommandSource.CommandParameter"/> and <see cref="ICommandSource.CommandTarget"/>.
|
|
/// </summary>
|
|
/// <returns>Returns the commands result of CanExecute.</returns>
|
|
public static bool CanExecuteCommand(this ICommandSource commandSource)
|
|
{
|
|
return CommandHelper.CanExecute(commandSource.Command, commandSource.CommandParameter, commandSource.CommandTarget);
|
|
}
|
|
}
|
|
} |