Пример #1
0
        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}'");
            }
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        private void OnCommandClick(XCad.UI.Commands.Structures.CommandSpec spec)
        {
            var cmdSpec = (CommandItemInfoSpec)spec;

            RunMacroCommand(cmdSpec.Info);
        }
Пример #4
0
        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);
        }