Пример #1
0
        static object CreateImageUIObject(CompletionIcon icon, IImageMonikerService imageMonikerService)
        {
            var icon2 = icon as CompletionIcon2;

            if (icon2 == null)
            {
                var iconSource = icon.IconSource;
                if (iconSource == null)
                {
                    return(null);
                }
                return(new Image {
                    Width = 16,
                    Height = 16,
                    Source = iconSource,
                });
            }

            var imageReference = imageMonikerService.ToImageReference(icon2.IconMoniker);

            if (imageReference.IsDefault)
            {
                return(null);
            }
            var image = new DsImage {
                ImageReference = imageReference
            };

            if (!((icon as IDsCompletionIcon)?.ThemeImage ?? false))
            {
                DsImage.SetBackgroundColor(image, null);
                DsImage.SetBackgroundBrush(image, null);
            }
            return(image);
        }
Пример #2
0
        static object CreateImageUIObject(CompletionIcon icon)
        {
            var dsIcon = icon as DsCompletionIcon;

            if (dsIcon == null)
            {
                var iconSource = icon.IconSource;
                if (iconSource == null)
                {
                    return(null);
                }
                return(new Image {
                    Width = 16,
                    Height = 16,
                    Source = iconSource,
                });
            }

            var imageReference = dsIcon.ImageReference;

            if (imageReference.IsDefault)
            {
                return(null);
            }
            var image = new DsImage {
                ImageReference = imageReference
            };

            if (!dsIcon.ThemeImage)
            {
                DsImage.SetBackgroundColor(image, null);
                DsImage.SetBackgroundBrush(image, null);
            }
            return(image);
        }
Пример #3
0
		static object CreateImageUIObject(CompletionIcon icon, IImageMonikerService imageMonikerService) {
			var icon2 = icon as CompletionIcon2;
			if (icon2 == null) {
				var iconSource = icon.IconSource;
				if (iconSource == null)
					return null;
				return new Image {
					Width = 16,
					Height = 16,
					Source = iconSource,
				};
			}

			var imageReference = imageMonikerService.ToImageReference(icon2.IconMoniker);
			if (imageReference.IsDefault)
				return null;
			var image = new DsImage { ImageReference = imageReference };
			if (!((icon as IDsCompletionIcon)?.ThemeImage ?? false)) {
				DsImage.SetBackgroundColor(image, null);
				DsImage.SetBackgroundBrush(image, null);
			}
			return image;
		}