Ejemplo n.º 1
0
        /// <include file='doc\VsWindowPane.uex' path='docs/doc[@for="VsWindowPane.IVsToolboxUser.ItemPicked"]/*' />
        /// <devdoc>
        ///     This happens when a user double-clicks a toolbox item.  We add the
        ///     item to the center of the form.
        /// </devdoc>
        void IVsToolboxUser.ItemPicked(NativeMethods.IOleDataObject pDO)
        {
            if (toolboxService == null)
            {
                toolboxService = (IToolboxService)GetService((typeof(IToolboxService)));
            }

            if (toolboxService != null)
            {
                ToolboxItem item = toolboxService.DeserializeToolboxItem(pDO, DesignerHost);

                if (item != null)
                {
                    if (OnToolPicked(item))
                    {
                        toolboxService.SelectedToolboxItemUsed();
                    }
                }
            }

            if (toolboxUser == null)
            {
                toolboxUser = (IVsToolboxUser)GetService(typeof(IVsToolboxUser));
            }

            if (toolboxUser != null)
            {
                toolboxUser.ItemPicked(pDO);
            }
        }
Ejemplo n.º 2
0
        /// <include file='doc\VsWindowPane.uex' path='docs/doc[@for="VsWindowPane.IVsToolboxUser.IsSupported"]/*' />
        /// <devdoc>
        /// </devdoc>
        int IVsToolboxUser.IsSupported(NativeMethods.IOleDataObject pDO)
        {
            int supported = NativeMethods.S_FALSE;

            if (toolboxService == null)
            {
                toolboxService = (IToolboxService)GetService(typeof(IToolboxService));
            }

            if (toolboxService != null && toolboxService.IsSupported(pDO, DesignerHost))
            {
                supported = NativeMethods.S_OK;
            }

            if (toolboxUser == null)
            {
                toolboxUser = (IVsToolboxUser)GetService(typeof(IVsToolboxUser));
            }

            if (toolboxUser != null)
            {
                if (toolboxUser.IsSupported(pDO) == NativeMethods.S_OK)
                {
                    supported = NativeMethods.S_OK;
                }
            }

            return(supported);
        }