コード例 #1
0
        /// <summary>
        /// The get icon for parameter override.
        /// </summary>
        /// <param name="thingStatus">
        /// The parameter or override.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        private object GetIconForParameterOverride(ThingStatus thingStatus, ParameterUsageKind usage)
        {
            Uri uri = null;

            switch (usage)
            {
            case ParameterUsageKind.Unused:
                uri = new Uri("pack://application:,,,/CDP4Composition;component/Resources/Images/orangeball.jpg");
                break;

            case ParameterUsageKind.SubscribedByOthers:
                uri = new Uri("pack://application:,,,/CDP4Composition;component/Resources/Images/blueball.gif");
                break;

            case ParameterUsageKind.Subscribed:
                uri = new Uri("pack://application:,,,/CDP4Composition;component/Resources/Images/whiteball.jpg");
                break;
            }

            if (uri == null)
            {
                return(null);
            }

            return(thingStatus.HasError
                ? IconUtilities.WithErrorOverlay(uri)
                : thingStatus.HasRelationship
                    ? IconUtilities.WithOverlay(uri, IconUtilities.RelationshipOverlayUri, OverlayPositionKind.TopRight)
                    : new BitmapImage(uri));
        }
コード例 #2
0
        /// <summary>
        /// Queries the <see cref="BitmapSource"/> with an error icon overlayed from the cache if the cache contains it else the <see cref="BitmapSource"/>
        /// is created, added to the cache and then returned.
        /// </summary>
        /// <param name="uri">
        /// The uri of the <see cref="BitmapSource"/>
        /// </param>
        /// <returns>
        /// An instance of <see cref="BitmapSource"/>
        /// </returns>
        public BitmapSource QueryErrorOverlayBitmapSource(Uri uri)
        {
            BitmapSource bitmapSource;

            this.bitmapSources.TryGetValue(uri, out bitmapSource);
            if (bitmapSource == null)
            {
                bitmapSource = IconUtilities.WithErrorOverlay(uri);
                this.bitmapSources.Add(uri, bitmapSource);
            }

            return(bitmapSource);
        }