Exemple #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 = XSharpProjectPackage.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);
            }
        }
Exemple #2
0
        static XSharpXMLDocTools()
        {
            _XMLMemberIndexService = (IVsXMLMemberIndexService)XSharpProjectPackage.GetGlobalService(typeof(SVsXMLMemberIndexService));
            // create default entry so our own xml lookup will work
            var node        = @"HKEY_LOCAL_MACHINE\Software\XSharpBV\XSharp";
            var InstallPath = (string)Microsoft.Win32.Registry.GetValue(node, "XSharpPath", "");
            var assemblies  = Path.Combine(InstallPath, "Assemblies");
            var location    = Path.Combine(assemblies, "XSharp.Core.dll");
            IVsXMLMemberIndex index;

            _XMLMemberIndexService.CreateXMLMemberIndex(location, out index);
            if (index != null)
            {
                _memberIndexes.Add(location, index);
                coreLoc   = location;
                coreIndex = index;
            }
        }
Exemple #3
0
        /// <summary>
        /// Refreshes the data in the property browser
        /// </summary>
        internal static void RefreshPropertyBrowser()
        {
            IVsUIShell vsuiShell = XSharpProjectPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

            if (vsuiShell == null)
            {
                string message = XHelperMethods.SafeStringFormat(CultureInfo.CurrentUICulture, Resources.GetString(Resources.CannotGetService), typeof(IVsUIShell).Name);
                throw new InvalidOperationException(message);
            }
            else
            {
                int hr = vsuiShell.RefreshPropertyBrowser(0);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }
        }
Exemple #4
0
 static XSharpXMLDocTools()
 {
     _XMLMemberIndexService = (IVsXMLMemberIndexService)XSharpProjectPackage.GetGlobalService(typeof(SVsXMLMemberIndexService));
 }