コード例 #1
0
        public void GetPropertyPage(ref Guid guidPage, Microsoft.VisualStudio.Shell.Interop.VSPROPSHEETPAGE[] ppage)
        {
            PropertySheet sheet = GetPropertySheet(guidPage);

            if (sheet != null && ppage != null)
            {
                ppage[0]            = new VSPROPSHEETPAGE();
                ppage[0].dwSize     = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));
                ppage[0].hwndDlg    = sheet.Handle;
                ppage[0].pfnDlgProc = NativeWindowHelper.GetNativeWndProc(sheet);
                return;
            }
            throw new NotImplementedException();
        }
コード例 #2
0
ファイル: Package.cs プロジェクト: Plankankul/SpecSharp
        public int GetPropertyPage(ref Guid guidPage, Microsoft.VisualStudio.Shell.Interop.VSPROPSHEETPAGE[] ppage)
        {
            PropertySheet sheet = GetPropertySheet(guidPage);

            if (sheet != null && ppage != null)
            {
                ppage[0]            = new VSPROPSHEETPAGE();
                ppage[0].dwSize     = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));
                ppage[0].hwndDlg    = sheet.Handle;
                ppage[0].pfnDlgProc = NativeWindowHelper.GetNativeWndProc(sheet);
                return(0);
            }
            return((int)HResult.E_NOTIMPL);
        }
コード例 #3
0
 public int GetComponentSelectorPage(ref Guid rguidPage, VSPROPSHEETPAGE[] ppage) {
     if (rguidPage == typeof(WebPiComponentPickerControl).GUID) {
         var page = new VSPROPSHEETPAGE();
         page.dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));
         var pickerPage = new WebPiComponentPickerControl();
         if (_packageContainer == null) {
             _packageContainer = new PackageContainer(this);
         }
         _packageContainer.Add(pickerPage);
         //IWin32Window window = pickerPage;
         page.hwndDlg = pickerPage.Handle;
         ppage[0] = page;
         return VSConstants.S_OK;
     }
     return VSConstants.E_FAIL;
 }
コード例 #4
0
ファイル: Package.cs プロジェクト: hesam/SketchSharp
 public void GetPropertyPage(ref Guid guidPage, Microsoft.VisualStudio.Shell.Interop.VSPROPSHEETPAGE[] ppage){      
   PropertySheet sheet = GetPropertySheet(guidPage);
   if (sheet != null && ppage != null ) {
     ppage[0] = new VSPROPSHEETPAGE();
     ppage[0].dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));        
     ppage[0].hwndDlg = sheet.Handle;        
     ppage[0].pfnDlgProc = NativeWindowHelper.GetNativeWndProc(sheet); 
     return;
   }
   throw new NotImplementedException();
 }
コード例 #5
0
ファイル: PythonToolsPackage.cs プロジェクト: wenh123/PTVS
 public int GetComponentSelectorPage(ref Guid rguidPage, VSPROPSHEETPAGE[] ppage) {
     if (rguidPage == typeof(WebPiComponentPickerControl).GUID) {
         var page = new VSPROPSHEETPAGE();
         page.dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));
         var pickerPage = new WebPiComponentPickerControl();
         if (_packageContainer == null) {
             _packageContainer = new PackageContainer(this);
         }
         _packageContainer.Add(pickerPage);
         //IWin32Window window = pickerPage;
         page.hwndDlg = pickerPage.Handle;
         ppage[0] = page;
         return VSConstants.S_OK;
     }
     return VSConstants.E_FAIL;
 }
コード例 #6
0
ファイル: Package.cs プロジェクト: hesam/SketchSharp
        /// <include file='doc\Package.uex' path='docs/doc[@for="Package.IVsPackage.GetPropertyPage"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// IVsPackage implementation.
        /// </devdoc>
        int IVsPackage.GetPropertyPage(ref Guid rguidPage, VSPROPSHEETPAGE[] ppage) {
            if (ppage == null || ppage.Length < 1)
                throw new ArgumentException(SR.GetString(SR.General_ArraySizeShouldBeAtLeast1), "ppage");

            if (zombie)
                Marshal.ThrowExceptionForHR(NativeMethods.E_UNEXPECTED);

            IWin32Window pageWindow = null;

            // First, check out the active pages.
            //
            if (_pagesAndProfiles != null) {
                foreach(object page in _pagesAndProfiles.Components) {
                    if (page.GetType().GUID.Equals(rguidPage)) {

                        // Found a match.
                        //
                        IWin32Window w = page as IWin32Window;
                        if (w != null) {
                            if (w is DialogPage) {
                                ((DialogPage)w).ResetContainer();
                            }
                            pageWindow = w;
                            break;
                        }
                    }
                }
            }

            if (pageWindow == null) {

                DialogPage page = null;

                // Didn't find it in our cache.  Now look in the metadata attributes
                // for the class.  Look at all types at the same time.
                //
                AttributeCollection attributes = TypeDescriptor.GetAttributes(this);
                foreach(Attribute attr in attributes) {
                    if (attr is ProvideOptionPageAttribute) {
                        Type pageType = ((ProvideOptionPageAttribute)attr).PageType;
                        if (pageType.GUID.Equals(rguidPage)) {

                            // Found a matching attribute.  Now go get the DialogPage with GetDialogPage.
                            // This has a side-effect of storing the page in
                            // _pagesAndProfiles for us.
                            //
                            page = GetDialogPage(pageType);
                            pageWindow = page;
                            break;
                        }
                    }
                    else if (attr is ProvideToolboxPageAttribute) {
                        Type pageType = ((ProvideToolboxPageAttribute)attr).PageType;
                        if (pageType.GUID.Equals(rguidPage)) {

                            // Found our boy.  We get it through GetDialogPage.
                            // This has a side-effect of storing the page in
                            // _pagesAndProfiles for us.
                            //
                            page = GetDialogPage(pageType);
                            pageWindow = page;
                            break;
                        }
                    }

                    if (page != null)
                    {
                        if (_pagesAndProfiles == null)       
                        {
                            _pagesAndProfiles = new PackageContainer(this);
                        }
                        _pagesAndProfiles.Add(page);

                        // No need to continue looking in the attributes, 
                        // we've already found the one we're looking for
                        break;
                    }
                }
            }

            // We should now have a page window. If we don't then the requested page
            // doesn't exist.
            //
            if (pageWindow == null) {
                Marshal.ThrowExceptionForHR(NativeMethods.E_NOTIMPL);
            }

            ppage[0].dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));
            ppage[0].hwndDlg = pageWindow.Handle;
            // zero-out all the fields we aren't using.
            ppage[0].dwFlags = 0;
            ppage[0].HINSTANCE = 0;
            ppage[0].dwTemplateSize = 0;
            ppage[0].pTemplate = IntPtr.Zero;
            ppage[0].pfnDlgProc = IntPtr.Zero;
            ppage[0].lParam = IntPtr.Zero;
            ppage[0].pfnCallback = IntPtr.Zero;
            ppage[0].pcRefParent = IntPtr.Zero;
            ppage[0].dwReserved = 0;
            ppage[0].wTemplateId = (ushort)0;

            return NativeMethods.S_OK;
        }
コード例 #7
0
ファイル: Package.cs プロジェクト: sillsdev/FwSupportTools
 int IVsPackage.GetPropertyPage(ref Guid rguidPage, VSPROPSHEETPAGE[] ppage)
 {
     if (this.Closed)
     {
         return NativeMethods.E_UNEXPECTED;
     }
     return NativeMethods.S_OK;
 }
コード例 #8
0
 public int GetPropertyPage(ref Guid rguidPage, VSPROPSHEETPAGE[] ppage)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
ファイル: Package.cs プロジェクト: hesam/SketchSharp
 public int GetPropertyPage(ref Guid guidPage, Microsoft.VisualStudio.Shell.Interop.VSPROPSHEETPAGE[] ppage){      
   PropertySheet sheet = GetPropertySheet(guidPage);
   if (sheet != null && ppage != null ){
     ppage[0] = new VSPROPSHEETPAGE();
     ppage[0].dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE));        
     ppage[0].hwndDlg = sheet.Handle;        
     ppage[0].pfnDlgProc = NativeWindowHelper.GetNativeWndProc(sheet); 
     return 0;
   }
   return (int)HResult.E_NOTIMPL;
 }