private void OnCommandClick(XCad.UI.Commands.Structures.CommandSpec spec) { var cmdSpec = (CommandItemInfoSpec)spec; var macroInfo = cmdSpec.Info; if (RunMacroCommand(macroInfo, out Exception err)) { if (macroInfo.ResolveButtonStateCodeOnce || macroInfo.ToggleButtonStateCodeType == ToggleButtonStateCode_e.None) { if (m_CachedToggleStates.TryGetValue(macroInfo, out bool isChecked)) { isChecked = !isChecked; m_CachedToggleStates[macroInfo] = isChecked; } else { Debug.Assert(false, "State should have been resolved by SOLIDWORKS before this call"); } } } else { m_Msg.ShowError(err, $"Failed to run macro: '{cmdSpec.Title}'"); } }
private void OnCommandStateResolve(XCad.UI.Commands.Structures.CommandSpec spec, XCad.UI.Commands.Structures.CommandState state) { var cmdSpec = (CommandItemInfoSpec)spec; state.Enabled = cmdSpec.Info.Scope.IsInScope(m_App); if (state.Enabled) { if (cmdSpec.Info.Triggers.HasFlag(Triggers_e.ToggleButton)) { state.Checked = TryResolveState(cmdSpec.Info); } } }
private void OnCommandClick(XCad.UI.Commands.Structures.CommandSpec spec) { var cmdSpec = (CommandItemInfoSpec)spec; RunMacroCommand(cmdSpec.Info); }
private void OnCommandStateResolve(XCad.UI.Commands.Structures.CommandSpec spec, XCad.UI.Commands.Structures.CommandState state) { var cmdSpec = (CommandItemInfoSpec)spec; state.Enabled = cmdSpec.Info.Scope.IsInScope(m_App); }