Files
2026-02-23 16:57:09 +08:00

41 lines
1.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Autodesk.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UIFramework;
using UIFrameworkServices;
namespace DotNet.Revit.InvokeCommand
{
public static class InvokeHelper
{
/// <summary>
/// 指定一个命令Id调用命令.
/// </summary>
/// <param name="id">命令控件的Id值</param>
/// <returns></returns>
public static bool Invoke(string cmdId)
{
if (ExternalCommandHelper.CanExecute(cmdId))
{
ExternalCommandHelper.executeExternalCommand(cmdId);
return true;
}
else if (CommandHandlerService.canExecute(cmdId))
{
CommandHandlerService.invokeCommandHandler(cmdId);
return true;
}
else
{
return false;
}
}
}
}