示例#1
0
        // =========================================================================================
        // Methods
        // =========================================================================================

        /// <summary>
        /// Hides all of the tabs in the Add Reference dialog except for the browse tab, which will search for wixlibs.
        /// </summary>
        /// <param name="project">The project that will contain the reference.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        internal static int AddProjectReference(WixProjectNode project)
        {
            CCITracing.TraceCall();

            Guid   showOnlyThisTabGuid = Guid.Empty;
            Guid   startOnThisTabGuid  = VSConstants.GUID_BrowseFilePage;
            string helpTopic           = "VS.AddReference";
            string machineName         = String.Empty;
            string browseFilters       = WixProjectReferenceNode.AddReferenceDialogFilter;
            string browseLocation      = WixProjectReferenceNode.GetAddReferenceDialogInitialDirectory(project.WixPackage);

            // initialize the structure that we have to pass into the dialog call
            VSCOMPONENTSELECTORTABINIT[] tabInitializers = new VSCOMPONENTSELECTORTABINIT[2];

            // tab 1 is the Project References tab: passing VSHPROPID_ShowProjInSolutionPage will tell the Add Reference
            // dialog to call into our GetProperty to determine if we should show ourself in the dialog
            tabInitializers[0].dwSize         = (uint)Marshal.SizeOf(typeof(VSCOMPONENTSELECTORTABINIT));
            tabInitializers[0].guidTab        = VSConstants.GUID_SolutionPage;
            tabInitializers[0].varTabInitInfo = (int)__VSHPROPID.VSHPROPID_ShowProjInSolutionPage;

            // tab 2 is the Browse tab
            tabInitializers[1].dwSize         = (uint)Marshal.SizeOf(typeof(VSCOMPONENTSELECTORTABINIT));
            tabInitializers[1].guidTab        = VSConstants.GUID_BrowseFilePage;
            tabInitializers[1].varTabInitInfo = 0;

            // initialize the flags to control the dialog
            __VSCOMPSELFLAGS flags = __VSCOMPSELFLAGS.VSCOMSEL_HideCOMClassicTab |
                                     __VSCOMPSELFLAGS.VSCOMSEL_HideCOMPlusTab |
                                     __VSCOMPSELFLAGS.VSCOMSEL_IgnoreMachineName |
                                     __VSCOMPSELFLAGS.VSCOMSEL_MultiSelectMode;

            // get the dialog service from the environment
            IVsComponentSelectorDlg dialog = WixHelperMethods.GetService <IVsComponentSelectorDlg, SVsComponentSelectorDlg>(project.Site);

            try
            {
                // show the dialog
                ErrorHandler.ThrowOnFailure(dialog.ComponentSelectorDlg(
                                                (uint)flags,
                                                (IVsComponentUser)project,
                                                WixProjectReferenceNode.AddReferenceDialogTitle,
                                                helpTopic,
                                                ref showOnlyThisTabGuid,
                                                ref startOnThisTabGuid,
                                                machineName,
                                                (uint)tabInitializers.Length,
                                                tabInitializers,
                                                browseFilters,
                                                ref browseLocation));
            }
            catch (COMException e)
            {
                CCITracing.Trace(e);
                return(e.ErrorCode);
            }

            return(VSConstants.S_OK);
        }
示例#2
0
        // =========================================================================================
        // Methods
        // =========================================================================================

        /// <summary>
        /// Hides all of the tabs in the Add Reference dialog except for the browse tab, which will search for wixlibs.
        /// </summary>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public override int AddProjectReference()
        {
            try
            {
                this.ShowProjectInSolutionPage = false;
                return(WixProjectReferenceNode.AddProjectReference(this));
            }
            finally
            {
                this.ShowProjectInSolutionPage = true;
            }
        }
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixProjectReferenceNodeProperties"/> class.
        /// </summary>
        /// <param name="node">The node that contains the properties to expose via the Property Browser.</param>
        public WixProjectReferenceNodeProperties(WixProjectReferenceNode node)
            : base(node)
        {
        }
 // =========================================================================================
 // Constructors
 // =========================================================================================
 /// <summary>
 /// Initializes a new instance of the <see cref="WixProjectReferenceNodeProperties"/> class.
 /// </summary>
 /// <param name="node">The node that contains the properties to expose via the Property Browser.</param>
 public WixProjectReferenceNodeProperties(WixProjectReferenceNode node)
     : base(node)
 {
 }