[Export(typeof(IExternalCallback))]
    public class MainMenu: AddinProxy, IExternalCallback
    {
        public MainMenu()
        {

        }
        
        [ImportingConstructor()]
        public MainMenu([Import] ISwAddinBase owner)
        {
            _OwnerAddin = owner;
           
        }

        public dynamic ExternalCallbackContainer
        {
            get { return this; }
        }

        [MenuItemCallback(new SolidWorks.Interop.swconst.swDocumentTypes_e[] {
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocPART ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocASSEMBLY ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocDRAWING ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocNONE ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocSDM} ,
                "dGAF About",
                null,
                null,
                SolidWorks.Interop.swconst.swMenuIdentifiers_e.swHelpMenu)]
        public void AboutCallback()
        {
            System.Windows.Forms.MessageBox.Show(@"About: Generic Addin Framework R2");
        }

        [MenuItemCallback(new SolidWorks.Interop.swconst.swDocumentTypes_e[] {
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocPART ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocASSEMBLY ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocDRAWING ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocNONE ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocSDM},
                "dGAF Help",
                null,
                null,
                SolidWorks.Interop.swconst.swMenuIdentifiers_e.swHelpMenu, 3)]
        public void HelpCallback()
        {
            System.Windows.Forms.MessageBox.Show(@"Help: Generic Addin Framework R2");
        }

        [MenuItemCallback(new SolidWorks.Interop.swconst.swDocumentTypes_e[] {
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocPART,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocASSEMBLY ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocDRAWING ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocNONE ,
                SolidWorks.Interop.swconst.swDocumentTypes_e.swDocSDM }, 
                "dGAF Manager",
                null,
                null,
                SolidWorks.Interop.swconst.swMenuIdentifiers_e.swToolsMenu, 4)]
        public void GafManagerCallback()
        {
            AddinManager manager = new AddinManager(_OwnerAddin.compositionContainer);
            manager.ShowDialog();
        }
    }

Last edited Jun 30, 2010 at 5:13 PM by fixitchris, version 1

Comments

No comments yet.