Esempio n. 1
0
        public void OnCommand(int CommandID, ShortCutMenuContextConstants Context, DocumentTypeConstants ActiveDocumentType, object pActiveDocument, object pActiveWindow, object pActiveSelectSet)
        {
            var myAddIn   = (MyAddIn)this.SolidEdgeAddIn;
            var control   = GetControl(CommandID);
            var commandId = (CommandIds)control.CommandId;

            switch (commandId)
            {
            case CommandIds.Save:
                //ShowControlPanelDialog();
                break;
            }

            // Example of how to determine what time of control was clicked.
            if (control is RibbonButton ribbonButton)
            {
            }
            else if (control is RibbonCheckBox checkBox)
            {
                // Demo toggling state.
                checkBox.Checked = !checkBox.Checked;
            }
            else if (control is RibbonRadioButton radioButton)
            {
                // Demo toggling state.
                radioButton.Checked = !radioButton.Checked;
            }
        }
Esempio n. 2
0
        public void OnCommandUpdateUI(int CommandID, ShortCutMenuContextConstants Context, DocumentTypeConstants ActiveDocumentType, object pActiveDocument, object pActiveWindow, object pActiveSelectSet, ref int CommandFlags, out string MenuItemText, ref int BitmapID)
        {
            MenuItemText = null;
            var myAddIn   = (MyAddIn)this.SolidEdgeAddIn;
            var flags     = default(SolidEdgeConstants.SECommandActivation);
            var control   = Controls.First(x => x.CommandId == CommandID);
            var commandId = (CommandIds)CommandID;

            if (control != null)
            {
                if (control.Enabled)
                {
                    flags |= SolidEdgeConstants.SECommandActivation.seCmdActive_Enabled;
                }

                if (control.Checked)
                {
                    flags |= SolidEdgeConstants.SECommandActivation.seCmdActive_Checked;
                }

                if (control.UseDotMark)
                {
                    flags |= SolidEdgeConstants.SECommandActivation.seCmdActive_UseDotMark;
                }

                flags       |= SolidEdgeConstants.SECommandActivation.seCmdActive_ChangeText;
                CommandFlags = (int)flags;
                MenuItemText = control.Label;
            }
        }
Esempio n. 3
0
 void SolidEdgeFramework.ISEAddInEventsEx2.OnCommand(int CommandID, ShortCutMenuContextConstants Context, DocumentTypeConstants ActiveDocumentType, object pActiveDocument, object pActiveWindow, object pActiveSelectSet)
 {
     // Forward the call to the active ribbon if it implements this specific event.
     ((SolidEdgeFramework.ISEAddInEventsEx2)ActiveRibbon)?.OnCommand(CommandID, Context, ActiveDocumentType, pActiveDocument, pActiveWindow, pActiveSelectSet);
 }
Esempio n. 4
0
        void SolidEdgeFramework.ISEAddInEventsEx2.OnCommandUpdateUI(int CommandID, ShortCutMenuContextConstants Context, DocumentTypeConstants ActiveDocumentType, object pActiveDocument, object pActiveWindow, object pActiveSelectSet, ref int CommandFlags, out string MenuItemText, ref int BitmapID)
        {
            MenuItemText = null;

            // Forward the call to the active ribbon if it implements this specific event.
            ((SolidEdgeFramework.ISEAddInEventsEx2)ActiveRibbon)?.OnCommandUpdateUI(CommandID, Context, ActiveDocumentType, pActiveDocument, pActiveWindow, pActiveSelectSet, ref CommandFlags, out MenuItemText, ref BitmapID);
        }
Esempio n. 5
0
        public void OnCommand(int CommandID, ShortCutMenuContextConstants Context, DocumentTypeConstants ActiveDocumentType, object pActiveDocument, object pActiveWindow, object pActiveSelectSet)
        {
            var myAddIn     = (MyAddIn)this.SolidEdgeAddIn;
            var application = myAddIn.Application;
            var control     = GetControl(CommandID);
            var commandId   = (CommandIds)control.CommandId;

            switch (commandId)
            {
            case CommandIds.Save:
                ShowSaveFileDialogDemo();
                break;

            case CommandIds.Folder:
                ShowFolderBrowserDialogDemo();
                break;

            case CommandIds.Tools:
                application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartToolsOptions);
                break;

            case CommandIds.Printer:
                application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartFilePrint);
                break;

            case CommandIds.Help:
                application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartHelpSolidEdgeontheWeb);
                break;

            case CommandIds.CommandPrompt:
                Process.Start("cmd.exe");
                break;

            case CommandIds.Notepad:
                Process.Start("notepad.exe");
                break;

            case CommandIds.BoundingBox:
                control.Checked = !control.Checked;
                myAddIn.My3dViewOverlay.ShowBoundingBox = control.Checked;
                break;

            case CommandIds.GdiPlus:
                control.Checked = !control.Checked;
                myAddIn.My3dViewOverlay.ShowGDIPlusDemo = control.Checked;
                break;

            case CommandIds.OpenGlBoxes:
                control.Checked = !control.Checked;
                myAddIn.My3dViewOverlay.ShowOpenGlBoxesDemo = control.Checked;
                break;

            default:
                if (control is SolidEdgeSDK.AddIn.RibbonButton)
                {
                    ShowCustomDialogDemo();
                }
                break;
            }

            // Example of how to determine what type of control was clicked.
            if (control is RibbonButton ribbonButton)
            {
            }
            else if (control is RibbonCheckBox checkBox)
            {
                // Demo toggling state.
                checkBox.Checked = !checkBox.Checked;
            }
            else if (control is RibbonRadioButton radioButton)
            {
                // Demo toggling state.
                radioButton.Checked = !radioButton.Checked;
            }
        }