Exemplo n.º 1
0
        /// <summary>
        /// Creates a native <see cref="CAUUID"/> structure by allocating the necessary COM memory for the array.
        /// </summary>
        /// <param name="guids">An array of GUIDs to return in the <b>CAUUID</b> structure.</param>
        /// <returns>A <see cref="CAUUID"/> structure filled in with the contents of <paramref name="guids"/>.</returns>
        public static CAUUID CreateCAUUIDFromGuidArray(Guid[] guids)
        {
            CAUUID cauuid = new CAUUID();

            if (guids != null)
            {
                cauuid.cElems = (uint)guids.Length;

                // Allocate the memory for the array of GUIDs
                int cbGuid = Marshal.SizeOf(typeof(Guid));
                cauuid.pElems = Marshal.AllocCoTaskMem(guids.Length * cbGuid);

                // Iterate over the GUID array and copy them into the COM memory
                IntPtr pCurrent = cauuid.pElems;
                for (int i = 0; i < guids.Length; i++)
                {
                    // Copy the managed GUID structure to the COM memory block
                    Marshal.StructureToPtr(guids[i], pCurrent, false);

                    // Move the pointer to the next element
                    pCurrent = new IntPtr(pCurrent.ToInt64() + cbGuid);
                }
            }

            return(cauuid);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves the configuration dependent property pages.
        /// </summary>
        /// <param name="pages">The pages to return.</param>
        private void GetCfgPropertyPages(CAUUID[] pages)
        {
            // We do not check whether the supportsProjectDesigner is set to true on the ProjectNode.
            // We rely that the caller knows what to call on us.
            if (pages == null)
            {
                throw new ArgumentNullException("pages");
            }

            if (pages.Length == 0)
            {
                throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
            }

            // Retrive the list of guids from hierarchy properties.
            // Because a flavor could modify that list we must make sure we are calling the outer most implementation of IVsHierarchy
            string       guidsList = String.Empty;
            IVsHierarchy hierarchy = this.project.InteropSafeIVsHierarchy;
            object       variant   = null;

            ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID2.VSHPROPID_CfgPropertyPagesCLSIDList, out variant), new int[] { VSConstants.DISP_E_MEMBERNOTFOUND, VSConstants.E_NOTIMPL });
            guidsList = (string)variant;

            Guid[] guids = Utilities.GuidsArrayFromSemicolonDelimitedStringOfGuids(guidsList);
            if (guids == null || guids.Length == 0)
            {
                pages[0]        = new CAUUID();
                pages[0].cElems = 0;
            }
            else
            {
                pages[0] = PackageUtilities.CreateCAUUIDFromGuidArray(guids);
            }
        }
        public void GetPages(ref CAUUID pPages)
        {
            Guid[] g = new Guid[2];

            g[0] = typeof(RSSLayerProps).GUID;
            g[1] = typeof(RSSLayerProps2).GUID;
            pPages.SetPages(g);
        }
Exemplo n.º 4
0
 void ISpecifyPropertyPages.GetPages(CAUUID[] ppages) {
   ppages[0] = new CAUUID();
   Guid[] guids = GetPropertyPageGuids();        
   ppages[0].cElems = (uint)guids.Length;
   int size = Marshal.SizeOf(typeof(Guid));
   ppages[0].pElems = Marshal.AllocCoTaskMem(guids.Length*size);
   IntPtr ptr = ppages[0].pElems;
   for (int i = 0; i < guids.Length; i++) {      
     Marshal.StructureToPtr(guids[i], ptr, false);
     ptr = new IntPtr(ptr.ToInt64() + size);
   }
 }
Exemplo n.º 5
0
        void ISpecifyPropertyPages.GetPages(CAUUID[] ppages)
        {
            ppages[0] = new CAUUID();
            Guid[] guids = GetPropertyPageGuids();
            ppages[0].cElems = (uint)guids.Length;
            int size = Marshal.SizeOf(typeof(Guid));

            ppages[0].pElems = Marshal.AllocCoTaskMem(guids.Length * size);
            IntPtr ptr = ppages[0].pElems;

            for (int i = 0; i < guids.Length; i++)
            {
                Marshal.StructureToPtr(guids[i], ptr, false);
                ptr = new IntPtr(ptr.ToInt64() + size);
            }
        }
Exemplo n.º 6
0
        //==========================================================================================
        // Methods
        //==========================================================================================

        #region ISpecifyPropertyPages Implementation
        //==========================================================================================
        // ISpecifyPropertyPages Implementation
        //==========================================================================================

        void ISpecifyPropertyPages.GetPages(CAUUID[] pages)
        {
            Tracer.VerifyNonEmptyArrayArgument(pages, "pages");

            pages[0]        = new CAUUID();
            pages[0].cElems = 0;

            // Get the property pages that the project supports
            if (this.ShouldTriggerPropertyPages)
            {
#if !VS_2003 // TODO: On VS 2003, we get an error when showing a property page, saying something like "There is not enough storage space to complete the current operation."
                Guid[] propertyPageGuids = this.Node.Hierarchy.AttachedProject.CommonPropertyPageGuids;
                pages[0] = PackageUtility.CreateCAUUIDFromGuidArray(propertyPageGuids);
#endif
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Retrieves the common property pages. The NodeProperties is the BrowseObject and that will be called to support
        /// configuration independent properties.
        /// </summary>
        /// <param name="pages">The pages to return.</param>
        private void GetCommonPropertyPages(CAUUID[] pages)
        {
            // We do not check whether the supportsProjectDesigner is set to false on the ProjectNode.
            // We rely that the caller knows what to call on us.
            if (pages == null)
            {
                throw new ArgumentNullException("pages");
            }

            if (pages.Length == 0)
            {
                throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
            }

            // Only the project should show the property page the rest should show the project properties.
            if (this.node != null && (this.node is ProjectNode))
            {
                // Retrieve the list of guids from hierarchy properties.
                // Because a flavor could modify that list we must make sure we are calling the outer most implementation of IVsHierarchy
                string       guidsList = String.Empty;
                IVsHierarchy hierarchy = HierarchyNode.GetOuterHierarchy(this.Node.ProjectMgr);
                object       variant   = null;
                ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID2.VSHPROPID_PropertyPagesCLSIDList, out variant));
                guidsList = (string)variant;

                Guid[] guids = Utilities.GuidsArrayFromSemicolonDelimitedStringOfGuids(guidsList);
                if (guids == null || guids.Length == 0)
                {
                    pages[0]        = new CAUUID();
                    pages[0].cElems = 0;
                }
                else if (guidsList == Guid.Empty.ToString("B"))
                {
                    pages[0]        = new CAUUID();
                    pages[0].cElems = 0;
                }
                else
                {
                    pages[0] = PackageUtilities.CreateCAUUIDFromGuidArray(guids);
                }
            }
            else
            {
                pages[0]        = new CAUUID();
                pages[0].cElems = 0;
            }
        }
Exemplo n.º 8
0
        public static CAUUID CreateCAUUIDFromGuidArray(Guid[] guids)
        {
            CAUUID cauuid = new CAUUID();

            if (guids != null)
            {
                cauuid.cElems = (uint)guids.Length;

                int size = Marshal.SizeOf(typeof(Guid));

                cauuid.pElems = Marshal.AllocCoTaskMem(guids.Length * size);

                IntPtr ptr = cauuid.pElems;

                for (int i = 0; i < guids.Length; i++)
                {
                    Marshal.StructureToPtr(guids[i], ptr, false);
                    ptr = new IntPtr(ptr.ToInt64() + size);
                }
            }

            return(cauuid);
        }
Exemplo n.º 9
0
        public unsafe static bool NeedsComponentEditor(object obj)
        {
            if (obj is Oleaut32.IPerPropertyBrowsing)
            {
                // check for a property page
                Guid    guid = Guid.Empty;
                HRESULT hr   = ((Oleaut32.IPerPropertyBrowsing)obj).MapPropertyToPage(Ole32.DispatchID.MEMBERID_NIL, &guid);
                if ((hr == HRESULT.S_OK) && !guid.Equals(Guid.Empty))
                {
                    return(true);
                }
            }

            if (obj is ISpecifyPropertyPages ispp)
            {
                var uuids = new CAUUID();
                try
                {
                    HRESULT hr = ispp.GetPages(&uuids);
                    if (!hr.Succeeded())
                    {
                        return(false);
                    }

                    return(uuids.cElems > 0);
                }
                finally
                {
                    if (uuids.pElems != null)
                    {
                        Marshal.FreeCoTaskMem((IntPtr)uuids.pElems);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 10
0
 public void GetPages(CAUUID[] pages)
 {
     this.GetCfgPropertyPages(pages);
 }
Exemplo n.º 11
0
        public unsafe override bool EditComponent(ITypeDescriptorContext context, object obj, IWin32Window parent)
        {
            IntPtr handle = (parent == null ? IntPtr.Zero : parent.Handle);

            // try to get the page guid
            if (obj is Oleaut32.IPerPropertyBrowsing)
            {
                // check for a property page
                Guid    guid = Guid.Empty;
                HRESULT hr   = ((Oleaut32.IPerPropertyBrowsing)obj).MapPropertyToPage(Ole32.DispatchID.MEMBERID_NIL, &guid);
                if (hr == HRESULT.S_OK & !guid.Equals(Guid.Empty))
                {
                    IntPtr pUnk = Marshal.GetIUnknownForObject(obj);
                    try
                    {
                        Oleaut32.OleCreatePropertyFrame(
                            new HandleRef(parent, handle),
                            0,
                            0,
                            "PropertyPages",
                            1,
                            &pUnk,
                            1,
                            &guid,
                            (uint)Application.CurrentCulture.LCID,
                            0,
                            IntPtr.Zero);
                        return(true);
                    }
                    finally
                    {
                        Marshal.Release(pUnk);
                    }
                }
            }

            if (obj is ISpecifyPropertyPages ispp)
            {
                try
                {
                    var     uuids = new CAUUID();
                    HRESULT hr    = ispp.GetPages(&uuids);
                    if (!hr.Succeeded() || uuids.cElems == 0)
                    {
                        return(false);
                    }

                    IntPtr pUnk = Marshal.GetIUnknownForObject(obj);
                    try
                    {
                        Oleaut32.OleCreatePropertyFrame(
                            new HandleRef(parent, handle),
                            0,
                            0,
                            "PropertyPages",
                            1,
                            &pUnk,
                            uuids.cElems,
                            uuids.pElems,
                            (uint)Application.CurrentCulture.LCID,
                            0,
                            IntPtr.Zero);
                        return(true);
                    }
                    finally
                    {
                        Marshal.Release(pUnk);
                        if (uuids.pElems != null)
                        {
                            Marshal.FreeCoTaskMem((IntPtr)uuids.pElems);
                        }
                    }
                }
                catch (Exception ex)
                {
                    string errString = SR.ErrorPropertyPageFailed;

                    IUIService uiSvc = (context != null) ? ((IUIService)context.GetService(typeof(IUIService))) : null;

                    if (uiSvc == null)
                    {
                        RTLAwareMessageBox.Show(null, errString, SR.PropertyGridTitle,
                                                MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                MessageBoxDefaultButton.Button1, 0);
                    }
                    else if (ex != null)
                    {
                        uiSvc.ShowError(ex, errString);
                    }
                    else
                    {
                        uiSvc.ShowError(errString);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates a native <see cref="CAUUID"/> structure by allocating the necessary COM memory for the array.
        /// </summary>
        /// <param name="guids">An array of GUIDs to return in the <b>CAUUID</b> structure.</param>
        /// <returns>A <see cref="CAUUID"/> structure filled in with the contents of <paramref name="guids"/>.</returns>
        public static CAUUID CreateCAUUIDFromGuidArray(Guid[] guids)
        {
            CAUUID cauuid = new CAUUID();

            if (guids != null)
            {
                cauuid.cElems = (uint)guids.Length;

                // Allocate the memory for the array of GUIDs
                int cbGuid = Marshal.SizeOf(typeof(Guid));
                cauuid.pElems = Marshal.AllocCoTaskMem(guids.Length * cbGuid);

                // Iterate over the GUID array and copy them into the COM memory
                IntPtr pCurrent = cauuid.pElems;
                for (int i = 0; i < guids.Length; i++)
                {
                    // Copy the managed GUID structure to the COM memory block
                    Marshal.StructureToPtr(guids[i], pCurrent, false);

                    // Move the pointer to the next element
                    pCurrent = new IntPtr(pCurrent.ToInt64() + cbGuid);
                }
            }

            return cauuid;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            try
            {
                //search for the weatherLayer first
                ILayer layer = null;
                RSSWeatherLayerClass RSSLayer = null;

                if (m_pHookHelper.FocusMap.LayerCount == 0)
                {
                    return;
                }

                IEnumLayer layers = m_pHookHelper.FocusMap.get_Layers(null, false);
                layers.Reset();
                layer = layers.Next();
                while (layer != null)
                {
                    if (layer is RSSWeatherLayerClass)
                    {
                        RSSLayer = (RSSWeatherLayerClass)layer;
                        break;
                    }
                    layer = layers.Next();
                }

                //In case that the weather layer wasn't found,just return
                if (null == RSSLayer)
                {
                    return;
                }


                //Launch the layer's properties
                Type   typ;
                object obj;
                Guid[] g;

                // METHOD 1: Instantiating a COM object and displaying its property pages
                // ONLY WORKS ON TRUE COM OBJECTS!  .NET objects that have rolled their own
                // ISpecifyPropertyPages implementation will error out when you try to cast
                // the instantiated object to your own ISpecifyPropertyPages implementation.

                // Get the typeinfo for the ActiveX common dialog control
                typ = Type.GetTypeFromProgID("MSComDlg.CommonDialog");

                // Create an instance of the control.  We pass it to the property frame function
                // so the property pages have an object from which to get current settings and apply
                // new settings.
                obj = Activator.CreateInstance(typ);
                // This handy function calls IPersistStreamInit->New on COM objects to initialize them
                ActiveXMessageFormatter.InitStreamedObject(obj);

                // Get the property pages for the control using the direct CAUUID method
                // This only works for true COM objects and I demonstrate it here only
                // to show how it is done.  Use the static method
                // PropertyPage.GetPagesForType() method for real-world use.
                ISpecifyPropertyPages pag = (ISpecifyPropertyPages)obj;
                CAUUID cau = new CAUUID(0);
                pag.GetPages(ref cau);
                g = cau.GetPages();

                // Instantiating a .NET object and displaying its property pages
                // WORKS ON ALL OBJECTS, .NET or COM

                // Create an instance of the .NET control, MyUserControl
                typ = Type.GetTypeFromProgID("RSSWeatherLayer.PropertySheet");

                // Retrieve the pages for the control
                g = PropertyPage.GetPagesForType(typ);

                // Create an instance of the control that we can give to the property pages
                obj = Activator.CreateInstance(typ);

                //add the RSS layer to the property-sheet control
                ((PropertySheet)obj).RSSWatherLayer = RSSLayer;

                // Display the OLE Property page for the control
                object[] items = new object[] { obj };

                PropertyPage.CreatePropertyFrame(IntPtr.Zero, 500, 500, "RSS Layer properties", items, g);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Retrieves the common property pages. The NodeProperties is the BrowseObject and that will be called to support 
        /// configuration independent properties.
        /// </summary>
        /// <param name="pages">The pages to return.</param>
        private void GetCommonPropertyPages(CAUUID[] pages)
        {
            // We do not check whether the supportsProjectDesigner is set to false on the ProjectNode.
            // We rely that the caller knows what to call on us.
            if (pages == null)
            {
                throw new ArgumentNullException("pages");
            }

            if (pages.Length == 0)
            {
                throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
            }

            // Only the project should show the property page the rest should show the project properties.
            if (this.node != null && (this.node is ProjectNode))
            {
                // Retrieve the list of guids from hierarchy properties.
                // Because a flavor could modify that list we must make sure we are calling the outer most implementation of IVsHierarchy
                string guidsList = String.Empty;
                IVsHierarchy hierarchy = HierarchyNode.GetOuterHierarchy(this.Node.ProjectMgr);
                object variant = null;
                ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID2.VSHPROPID_PropertyPagesCLSIDList, out variant));
                guidsList = (string)variant;

                Guid[] guids = Utilities.GuidsArrayFromSemicolonDelimitedStringOfGuids(guidsList);
                if (guids == null || guids.Length == 0)
                {
                    pages[0] = new CAUUID();
                    pages[0].cElems = 0;
                }
                else
                {
                    pages[0] = PackageUtilities.CreateCAUUIDFromGuidArray(guids);
                }
            }
            else
            {
                pages[0] = new CAUUID();
                pages[0].cElems = 0;
            }
        }
Exemplo n.º 15
0
 public virtual void GetPages(CAUUID[] pages)
 {
     this.GetCommonPropertyPages(pages);
 }
Exemplo n.º 16
0
 void ISpecifyPropertyPages.GetPages(CAUUID[] pPages)
 {
     pPages[0] = new CAUUID();
     pPages[0].cElems = 0;
 }
Exemplo n.º 17
0
        /// <include file='doc\PropertyPages.uex' path='docs/doc[@for="NodeProperties.GetPages"]/*' />
        public virtual void GetPages(CAUUID[] ppages) {
            ppages[0] = new CAUUID();
            if (Node.ProjectMgr != null) {
                Guid[] guids = Node.ProjectMgr.GetPropertyPageGuids();

                if (guids != null) {
                    ppages[0].cElems = (uint)guids.Length;

                    int size = Marshal.SizeOf(typeof(Guid));

                    ppages[0].pElems = Marshal.AllocCoTaskMem(guids.Length * size);

                    IntPtr ptr = ppages[0].pElems;

                    for (int i = 0; i < guids.Length; i++) {
                        Marshal.StructureToPtr(guids[i], ptr, false);
                        ptr = new IntPtr(ptr.ToInt64() + size);
                    }
                }
            } else {
                ppages[0].cElems = 0;
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// ills an array of CLSIDs for each property page that can be displayed in this object's property sheet.
        /// </summary>
        /// <param name="pPages">Pointer to a caller-allocated CAUUID structure that must be initialized and filled before returning.</param>
        public void GetPages(ref CAUUID pPages)
        {
            Guid[] g = new Guid[1];

              g[0] = typeof(SymbolSelectorPropPage).GUID;
              pPages.SetPages(g);
        }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      try
      {
        //search for the weatherLayer first
        ILayer layer = null;
        RSSWeatherLayerClass RSSLayer = null;

        if (m_pHookHelper.FocusMap.LayerCount == 0)
          return;

        IEnumLayer layers = m_pHookHelper.FocusMap.get_Layers(null, false);
        layers.Reset();
        layer = layers.Next();
        while (layer != null)
        {
          if (layer is RSSWeatherLayerClass)
          {
            RSSLayer = (RSSWeatherLayerClass)layer;
            break;
          }
          layer = layers.Next();
        }

        //In case that the weather layer wasn't found,just return
        if (null == RSSLayer)
          return;


        //Launch the layer's properties
        Type typ;
        object obj;
        Guid[] g;

        // METHOD 1: Instantiating a COM object and displaying its property pages
        // ONLY WORKS ON TRUE COM OBJECTS!  .NET objects that have rolled their own
        // ISpecifyPropertyPages implementation will error out when you try to cast
        // the instantiated object to your own ISpecifyPropertyPages implementation.

        // Get the typeinfo for the ActiveX common dialog control
        typ = Type.GetTypeFromProgID("MSComDlg.CommonDialog");

        // Create an instance of the control.  We pass it to the property frame function
        // so the property pages have an object from which to get current settings and apply
        // new settings.
        obj = Activator.CreateInstance(typ);
        // This handy function calls IPersistStreamInit->New on COM objects to initialize them
        ActiveXMessageFormatter.InitStreamedObject(obj);

        // Get the property pages for the control using the direct CAUUID method
        // This only works for true COM objects and I demonstrate it here only
        // to show how it is done.  Use the static method
        // PropertyPage.GetPagesForType() method for real-world use.
        ISpecifyPropertyPages pag = (ISpecifyPropertyPages)obj;
        CAUUID cau = new CAUUID(0);
        pag.GetPages(ref cau);
        g = cau.GetPages();

        // Instantiating a .NET object and displaying its property pages
        // WORKS ON ALL OBJECTS, .NET or COM    

        // Create an instance of the .NET control, MyUserControl
        typ = Type.GetTypeFromProgID("RSSWeatherLayer.PropertySheet");

        // Retrieve the pages for the control
        g = PropertyPage.GetPagesForType(typ);

        // Create an instance of the control that we can give to the property pages
        obj = Activator.CreateInstance(typ);

        //add the RSS layer to the property-sheet control
        ((PropertySheet)obj).RSSWatherLayer = RSSLayer;

        // Display the OLE Property page for the control
        object[] items = new object[] { obj };

        PropertyPage.CreatePropertyFrame(IntPtr.Zero, 500, 500, "RSS Layer properties", items, g);
      }
      catch (Exception ex)
      {
        System.Diagnostics.Trace.WriteLine(ex.Message);
      }
    }
Exemplo n.º 20
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            try
              {
            IMapControl4 mapControl = null;

            if (m_pHookHelper.Hook is IMapControl4)
              mapControl = (IMapControl4)m_pHookHelper.Hook;
            else if (m_pHookHelper.Hook is IToolbarControl2)
            {
              IToolbarControl2 toolbarControl = (IToolbarControl2)m_pHookHelper.Hook;
              mapControl = (IMapControl4)toolbarControl.Buddy;
            }

            if (null == mapControl.CustomProperty || !(mapControl.CustomProperty is IFeatureLayer))
              return;

            IFeatureLayer featureLayer = (IFeatureLayer)mapControl.CustomProperty;

            //Launch the layer's properties
            Type typ;
            object obj;
            Guid[] g;

            // METHOD 1: Instantiating a COM object and displaying its property pages
            // ONLY WORKS ON TRUE COM OBJECTS!  .NET objects that have rolled their own
            // ISpecifyPropertyPages implementation will error out when you try to cast
            // the instantiated object to your own ISpecifyPropertyPages implementation.

            // Get the typeinfo for the ActiveX common dialog control
            typ = Type.GetTypeFromProgID("MSComDlg.CommonDialog");

            // Create an instance of the control.  We pass it to the property frame function
            // so the property pages have an object from which to get current settings and apply
            // new settings.
            obj = Activator.CreateInstance(typ);
            // This handy function calls IPersistStreamInit->New on COM objects to initialize them
            ActiveXMessageFormatter.InitStreamedObject(obj);

            // Get the property pages for the control using the direct CAUUID method
            // This only works for true COM objects and I demonstrate it here only
            // to show how it is done.  Use the static method
            // PropertyPage.GetPagesForType() method for real-world use.
            ISpecifyPropertyPages pag = (ISpecifyPropertyPages)obj;
            CAUUID cau = new CAUUID(0);
            pag.GetPages(ref cau);
            g = cau.GetPages();

            // Instantiating a .NET object and displaying its property pages
            // WORKS ON ALL OBJECTS, .NET or COM

            // Create an instance of the .NET control, MyUserControl
            typ = Type.GetTypeFromProgID("SymbolSelector.PropertySheet");

            // Retrieve the pages for the control
            g = PropertyPage.GetPagesForType(typ);

            // Create an instance of the control that we can give to the property pages
            obj = Activator.CreateInstance(typ);

            ((SymbolSelector.PropertySheet)obj).OnFeatureLayerRendererChanged += new FeatureLayerRendererChanged(OnFeatureLayerRendererChanged);

            //add the yahoo layer to the property-sheet control
            ((SymbolSelector.PropertySheet)obj).FeatureLayer = featureLayer;

            // Display the OLE Property page for the control
            object[] items = new object[] { obj };

            PropertyPage.CreatePropertyFrame(IntPtr.Zero, 500, 500, "FeatureLayer Symbology", items, g);
              }
              catch (Exception ex)
              {
            System.Diagnostics.Trace.WriteLine(ex.Message);
              }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Retrieves the configuration dependent property pages.
        /// </summary>
        /// <param name="pages">The pages to return.</param>
        private void GetCfgPropertyPages(CAUUID[] pages)
        {
            // We do not check whether the supportsProjectDesigner is set to true on the ProjectNode.
            // We rely that the caller knows what to call on us.
            if (pages == null)
            {
                throw new ArgumentNullException("pages");
            }

            if (pages.Length == 0)
            {
                throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
            }

            // Retrive the list of guids from hierarchy properties.
            // Because a flavor could modify that list we must make sure we are calling the outer most implementation of IVsHierarchy
            string guidsList = String.Empty;
            IVsHierarchy hierarchy = project.InteropSafeIVsHierarchy;
            object variant = null;
            ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID2.VSHPROPID_CfgPropertyPagesCLSIDList, out variant), new int[] { VSConstants.DISP_E_MEMBERNOTFOUND, VSConstants.E_NOTIMPL });
            guidsList = (string)variant;

            Guid[] guids = Utilities.GuidsArrayFromSemicolonDelimitedStringOfGuids(guidsList);
            if (guids == null || guids.Length == 0)
            {
                pages[0] = new CAUUID();
                pages[0].cElems = 0;
            }
            else
            {
                pages[0] = PackageUtilities.CreateCAUUIDFromGuidArray(guids);
            }
        }
    public void GetPages(ref CAUUID pPages)
    {
      Guid[] g = new Guid[2];

      g[0] = typeof(RSSLayerProps).GUID;
      g[1] = typeof(RSSLayerProps2).GUID;
      pPages.SetPages(g);
    }
Exemplo n.º 23
0
        public void GetPages(CAUUID[] pages)
        {
            // We do not check whether the supportsProjectDesigner is set to false on the ProjectNode.
            // We rely that the caller knows what to call on us.
            if (pages == null)
            {
                throw new ArgumentNullException("pages");
            }

            if (pages.Length == 0)
            {
                throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
            }
            // behave similar to C#\VB - return empty array
            pages[0] = new CAUUID();
            pages[0].cElems = 0;
        }
 public void GetPages(CAUUID[] pPages)
 {
     var cfg = _baseCfg as ISpecifyPropertyPages;
     if (cfg != null)
     {
         cfg.GetPages(pPages);
     }
 }
Exemplo n.º 25
0
 /// <summary>
 /// Implementation of the IVsSpecifyProjectDesignerPages. It will retun the pages that are configuration independent.
 /// </summary>
 /// <param name="pages">The pages to return.</param>
 /// <returns></returns>
 public virtual int GetProjectDesignerPages(CAUUID[] pages)
 {
     this.GetCommonPropertyPages(pages);
     return VSConstants.S_OK;
 }
 public int GetProjectDesignerPages(CAUUID[] pPages)
 {
     var cfg = _baseCfg as IVsSpecifyProjectDesignerPages;
     if (cfg != null)
     {
         return cfg.GetProjectDesignerPages(pPages);
     }
     return VSConstants.E_NOTIMPL;
 }
Exemplo n.º 27
0
 void ISpecifyPropertyPages.GetPages(CAUUID[] pPages)
 {
     pPages[0]        = new CAUUID();
     pPages[0].cElems = 0;
 }
Exemplo n.º 28
0
        //==========================================================================================
        // ISpecifyPropertyPages Implementation
        //==========================================================================================
        void ISpecifyPropertyPages.GetPages(CAUUID[] pages)
        {
            Tracer.VerifyNonEmptyArrayArgument(pages, "pages");

            pages[0] = new CAUUID();
            pages[0].cElems = 0;

            // Get the property pages that the project supports
            if (this.ShouldTriggerPropertyPages)
            {
            #if !VS_2003 // TODO: On VS 2003, we get an error when showing a property page, saying something like "There is not enough storage space to complete the current operation."
                Guid[] propertyPageGuids = this.Node.Hierarchy.AttachedProject.CommonPropertyPageGuids;
                pages[0] = PackageUtility.CreateCAUUIDFromGuidArray(propertyPageGuids);
            #endif
            }
        }