Example #1
0
        private static ImageSource GetImage(DependencyObject owner, string file, __VSUIDATAFORMAT format, out bool themeIcon)
        {
            IVsImageService imageService = ServiceProvider.GlobalProvider.GetService(typeof(SVsImageService)) as IVsImageService;
            BitmapSource result = null;
            uint iconSource = (uint)__VSIconSource.IS_Unknown;

            if (imageService != null && !string.IsNullOrWhiteSpace(file))
            {
                IVsUIObject image = imageService.GetIconForFileEx(file, format, out iconSource);
                if (image != null)
                {
                    object imageData = GetObjectData(image);
                    result = imageData as BitmapSource;
                }
            }

            themeIcon = (iconSource == (uint)__VSIconSource.IS_VisualStudio);

            if (themeIcon && result != null && owner != null)
            {
                return ThemeImage(owner, result);
            }

            return result;
        }
Example #2
0
 public VsUIObject(object value, string type, __VSUIDATAFORMAT format) {
     _data = value;
     _type = type;
     _format = (uint)format;
 }