Beispiel #1
0
        /// <summary>
        /// Returns a standard VS color or a system color, if the VS colors service is not available
        /// </summary>
        /// <param name="visualStudioColor">Color enum</param>
        /// <returns>The color itself</returns>
        internal static Color GetVsColor(Vs2010Color visualStudioColor)
        {
            uint        win32Color = 0;
            IVsUIShell2 vsuiShell2 = WixPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell2;

            if (vsuiShell2 != null && vsuiShell2.GetVSSysColorEx((Int32)visualStudioColor, out win32Color) == VSConstants.S_OK)
            {
                Color color = ColorTranslator.FromWin32((int)win32Color);
                return(color);
            }

            // We need to fall back to some reasonable colors when we're not running in VS
            // to keep the forms/property pages editable in the designers
            switch (visualStudioColor)
            {
            case Vs2010Color.VSCOLOR_BUTTONFACE:
                return(SystemColors.ButtonFace);

            case Vs2010Color.VSCOLOR_BUTTONTEXT:
                return(SystemColors.ControlText);

            case Vs2010Color.VSCOLOR_WINDOW:
                return(SystemColors.Window);

            default:
                return(Color.Red);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes the package by registering all of the services that we support.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            this.settings = new WixPackageSettings(this);
            this.RegisterProjectFactory(new WixProjectFactory(this));

            WixPackage.instance = this;
        }
Beispiel #3
0
        /// <summary>
        /// Gets the initial directory for the Add Reference dialog box.
        /// </summary>
        /// <param name="package">The package to retrieve the settings from.</param>
        /// <returns>Directory path for the Add Reference dialog box.</returns>
        private static string GetAddReferenceDialogInitialDirectory(WixPackage package)
        {
            // get the tools directory from the registry, which has the wixlibs that we ship with
            string toolsDirectory = package.Settings.ToolsDirectory;

            if (String.IsNullOrEmpty(toolsDirectory) || !Directory.Exists(toolsDirectory))
            {
                return(Directory.GetCurrentDirectory());
            }

            return(toolsDirectory);
        }
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixProjectNode"/> class.
        /// </summary>
        /// <param name="package">The <see cref="WixPackage"/> to which this project belongs.</param>
        public WixProjectNode(WixPackage package)
        {
            WixHelperMethods.VerifyNonNullArgument(package, "package");

            this.package = package;

            // We allow destructive deletes on the project
            this.CanProjectDeleteItems = true;

            this.CanFileNodesHaveChilds = true;

            this.InitializeCATIDs();
        }
Beispiel #5
0
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixProjectNode"/> class.
        /// </summary>
        /// <param name="package">The <see cref="WixPackage"/> to which this project belongs.</param>
        public WixProjectNode(WixPackage package)
        {
            WixHelperMethods.VerifyNonNullArgument(package, "package");

            this.package = package;

            // We allow destructive deletes on the project
            this.CanProjectDeleteItems = true;

            this.CanFileNodesHaveChilds = true;

            this.InitializeCATIDs();
        }
Beispiel #6
0
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixProjectNode"/> class.
        /// </summary>
        /// <param name="package">The <see cref="WixPackage"/> to which this project belongs.</param>
        public WixProjectNode(WixPackage package)
        {
            WixHelperMethods.VerifyNonNullArgument(package, "package");

            this.package = package;

            // We allow destructive deletes on the project
            this.CanProjectDeleteItems = true;

            // use the VS 2005 style property pages (project designer) instead of the old VS 2003 dialog
            this.SupportsProjectDesigner = true;

            this.InitializeCATIDs();
        }
Beispiel #7
0
        /// <summary>
        /// Refreshes the data in the property browser
        /// </summary>
        internal static void RefreshPropertyBrowser()
        {
            IVsUIShell vsuiShell = WixPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

            if (vsuiShell == null)
            {
                string message = WixHelperMethods.SafeStringFormat(CultureInfo.CurrentUICulture, WixStrings.CannotGetService, typeof(IVsUIShell).Name);
                throw new InvalidOperationException(message);
            }
            else
            {
                int hr = vsuiShell.RefreshPropertyBrowser(0);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }
        }
Beispiel #8
0
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixProjectFactory"/> class.
        /// </summary>
        /// <param name="package">The <see cref="WixPackage"/> to which this project factory belongs.</param>
        public WixProjectFactory(WixPackage package)
            : base(package)
        {
        }
        /// <summary>
        /// Gets the initial directory for the Add Reference dialog box.
        /// </summary>
        /// <param name="package">The package to retrieve the settings from.</param>
        /// <returns>Directory path for the Add Reference dialog box.</returns>
        private static string GetAddReferenceDialogInitialDirectory(WixPackage package)
        {
            // get the tools directory from the registry, which has the wixlibs that we ship with
            string toolsDirectory = package.Settings.ToolsDirectory;
            if (String.IsNullOrEmpty(toolsDirectory) || !Directory.Exists(toolsDirectory))
            {
                return Directory.GetCurrentDirectory();
            }

            return toolsDirectory;
        }
Beispiel #10
0
        /// <summary>
        /// Initializes the package by registering all of the services that we support.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            this.settings = new WixPackageSettings(this);
            this.RegisterProjectFactory(new WixProjectFactory(this));

            WixPackage.instance = this;
        }
Beispiel #11
0
 // =========================================================================================
 // Constructors
 // =========================================================================================
 /// <summary>
 /// Initializes a new instance of the <see cref="WixProjectFactory"/> class.
 /// </summary>
 /// <param name="package">The <see cref="WixPackage"/> to which this project factory belongs.</param>
 public WixProjectFactory(WixPackage package)
     : base(package)
 {
 }