This repository has been archived on 2023-01-27. You can view files and clone it, but cannot push or open issues or pull requests.
cad/ref/xcad/docs/_src/Extension/CommandsManager/CustomEnableAddIn.cs
2022-10-15 19:16:08 +02:00

41 lines
1.1 KiB
C#

using System;
using System.Runtime.InteropServices;
using Xarial.XCad.Base.Attributes;
using Xarial.XCad.SolidWorks;
using Xarial.XCad.UI.Commands;
using Xarial.XCad.UI.Commands.Structures;
namespace Xarial.XCad.Documentation
{
[Title("Custom enable state add-in")]
[ComVisible(true), Guid("E02CA015-09D7-4428-A2D8-C2E20E0EA52E")]
public class CustomEnableAddIn : SwAddInEx
{
//--- CustomEnableState
public enum Commands_e
{
Command1,
Command2
}
public override void OnConnect()
{
this.CommandManager.AddCommandGroup<Commands_e>().CommandStateResolve += OnButtonEnable;
}
private void OnButtonEnable(Commands_e cmd, CommandState state)
{
switch (cmd)
{
case Commands_e.Command1:
case Commands_e.Command2:
//TODO: implement logic to identify the state of the button
state.Checked = false;
state.Enabled = false;
break;
}
}
//---
}
}